【问题标题】:android.useAndroidX property is not enabled, why it should be?android.useAndroidX 属性未启用,为什么应该启用?
【发布时间】:2020-04-26 17:18:02
【问题描述】:

我在使用 androidDx 库时遇到问题,所以当我将 shimmer 库添加到我的项目或 glide 照片库时,或者当我将 google play services 广告更新到 19.1.0 时,它一直要求我启用 android dx

错误:此项目使用 AndroidX 依赖项,但未启用“android.useAndroidX”属性。在 gradle.properties 文件中将此属性设置为 true 并重试。 检测到以下 AndroidX 依赖项:androidx.annotation:annotation:1.0.1

但我不想启用它,还是必须启用它?

这是我的 gradle 文件

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "folo.new.test.my"
        minSdkVersion 15
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
        debug {
            multiDexEnabled true
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:exifinterface:28.0.0'
    implementation 'com.android.support:animated-vector-drawable:28.0.0'
    implementation 'com.android.support:customtabs:28.0.0'
    implementation 'com.android.support:support-media-compat:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.facebook.shimmer:shimmer:0.5.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    implementation 'com.google.code.gson:gson:2.8.5'
    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation 'com.android.volley:volley:1.1.0'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.google.android.gms:play-services-ads:17.1.3'
    implementation 'org.jsoup:jsoup:1.10.3'
}

【问题讨论】:

  • 你找到解决办法了吗??

标签: android-studio gradle androidx


【解决方案1】:

android.useAndroidX=true 添加到gradle.properties 文件中。

我从这个link找到了解决方案。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-03-23
    • 2020-09-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-02-12
    • 1970-01-01
    相关资源
    最近更新 更多