A.B*_*ami 6 android android-gradle-plugin androidx
我想使用一个库来获取用户的日期。
我使用的项目需要添加AndroidX库中的库和类。
一旦我通过添加模块或向 gradle 添加直接命令来添加此项目,就会出现以下错误:
使用的项目链接: https: //github.com/wdullaer/MaterialDateTimePicker
错误 :
Failed to resolve: androidx.appcompat:appcompat:1.0.2
Failed to resolve: androidx.recyclerview:recyclerview:1.0.0
Run Code Online (Sandbox Code Playgroud)
构建.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.**********"
minSdkVersion 14
targetSdkVersion 28
versionCode 1
versionName "1.0"
}
buildToolsVersion '28.0.3'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
}dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:support-vector-drawable:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:gridlayout-v7:28.0.0'
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.12'
implementation 'com.wdullaer:materialdatetimepicker:4.1.2'
}
Run Code Online (Sandbox Code Playgroud)
如果在gradle中添加以下命令,会看到如下错误
dependencies {
...
implementation 'com.wdullaer:materialdatetimepicker:4.1.2'
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
}
Run Code Online (Sandbox Code Playgroud)
错误 :
Failed to resolve: androidx.appcompat:appcompat:1.0.2
Failed to resolve: androidx.recyclerview:recyclerview:1.0.0
Run Code Online (Sandbox Code Playgroud)
我没有太多关于 AndroidX 库的信息,但我不认为有这样的库。
我该如何修复它?
这个问题有解决办法吗?
小智 0
如果要在新项目中使用AndroidX,需要将编译SDK设置为Android 9.0(API级别28)或更高版本
\n\nandroid.enableJetifier=true\nandroid.useAndroidX=true\nRun Code Online (Sandbox Code Playgroud)\n\n来自文档
\n\nandroid.useAndroidX:当设置为\xc2\xa0true时,Android插件使用适当的AndroidX库而不是支持库。如果不指定,则默认标志为\xc2\xa0false\xc2\xa0。
\n\nandroid.enableJetifier:当设置为\xc2\xa0true时,Android插件会通过重写二进制文件自动迁移现有的第三方库以使用AndroidX。如果不指定,则默认标志为\xc2\xa0false\xc2\xa0。
\n| 归档时间: |
|
| 查看次数: |
6211 次 |
| 最近记录: |