dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'com.android.support:appcompat-v7:28.0.0-alpha1' implementation 'com.android.support.constraint:constraint-layout:1.1.0' implementation 'com.android.support:design:28.0.0-alpha1' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' implementation 'androidx.appcompat:appcompat:1.2.0' implementation 'androidx.fragment:fragment:1.3.0' }以上代码要如何修改?
时间: 2024-01-04 15:02:45 浏览: 384
解决android-support-v7.jar类不全的问题
你需要将 Android Support 库的依赖项移除,只保留 AndroidX 库的依赖项。修改后的代码如下:
```
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.google.android.material:material:1.3.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
```
注意,这里的 `com.google.android.material:material:1.3.0` 是使用 AndroidX 库的 Material Design 库,可以替代原来的 `com.android.support:design`。
阅读全文