首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在迁移到${animal.sniffer.version}时未能解析变量“AndroidX {animal.sniffer.version}”

在迁移到${animal.sniffer.version}时未能解析变量“AndroidX {animal.sniffer.version}”
EN

Stack Overflow用户
提问于 2018-08-11 06:48:38
回答 16查看 78.5K关注 0票数 146

我正在使用AndroidStudio3.2 Beta5将我的项目迁移到AndroidX。当我重新构建我的应用程序时,我得到了以下错误:

错误:标记未能解析变量“${animal.sniffer.version}” 错误:标记未能解析变量“${junit.version}”

完全清洁和重建没有工作!有人知道怎么解决这个问题吗?

gradle.properties

代码语言:javascript
复制
android.enableJetifier=true
android.useAndroidX=true

build.gradle

代码语言:javascript
复制
buildscript {
    repositories {
        google()
        jcenter()
        mavenCentral()
        maven { url 'https://maven.fabric.io/public' }
        maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.0-beta05'

        classpath 'com.google.gms:google-services:4.0.1'
        classpath "io.realm:realm-gradle-plugin:5.3.1"
        classpath 'io.fabric.tools:gradle:1.25.4'
        classpath 'com.google.firebase:firebase-plugins:1.1.5'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()
        maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

app/build.gradle

代码语言:javascript
复制
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
apply plugin: 'io.fabric'
apply plugin: 'com.google.firebase.firebase-perf'

android {
    compileSdkVersion 28
    buildToolsVersion "28.0.0"
    defaultConfig {
        applicationId "com.iceteaviet.fastfoodfinder"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
        }
    }
    aaptOptions {
        cruncherEnabled = false
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    testImplementation 'junit:junit:4.12'

    implementation 'com.jakewharton:butterknife:9.0.0-SNAPSHOT'

    implementation 'androidx.appcompat:appcompat:1.0.0-rc01'
    implementation 'com.google.android.material:material:1.0.0-rc01'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0-rc01'
    implementation 'androidx.cardview:cardview:1.0.0-rc01'

    implementation 'com.google.maps.android:android-maps-utils:0.5'
    implementation 'com.google.android.gms:play-services-maps:15.0.1'
    implementation 'com.google.android.gms:play-services-location:15.0.1'
    implementation 'com.google.firebase:firebase-core:16.0.1'
    implementation 'com.google.firebase:firebase-database:16.0.1'
    implementation 'com.google.firebase:firebase-auth:16.0.1'
    implementation 'com.google.android.gms:play-services-auth:15.0.1'

    implementation 'com.github.bumptech.glide:glide:4.7.1'

    implementation 'com.google.code.gson:gson:2.8.5'
    implementation 'com.squareup.retrofit2:retrofit:2.4.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.4.0'

    implementation 'org.greenrobot:eventbus:3.1.1'

    implementation 'de.hdodenhof:circleimageview:2.2.0'

    implementation 'io.realm:realm-android-library:5.3.1'

    implementation 'com.facebook.android:facebook-android-sdk:4.34.0'

    implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
    implementation 'io.reactivex.rxjava2:rxjava:2.0.2'

    implementation 'androidx.multidex:multidex:2.0.0'

    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.4'
    implementation 'com.google.firebase:firebase-perf:16.0.0'

    implementation 'com.jakewharton.timber:timber:4.7.1'

    annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-SNAPSHOT'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'
}

apply plugin: 'com.google.gms.google-services'
EN

回答 16

Stack Overflow用户

回答已采纳

发布于 2018-09-07 15:30:46

我用两个步骤来解决这个问题

1)文件->使缓存失效/重新启动.

2)建立->清洁项目

票数 118
EN

Stack Overflow用户

发布于 2019-02-11 13:59:14

在用build.gradle更新我的AndroidX测试依赖关系文件后,我得到了同样的错误。结果我忘了删除旧的junit依赖项。因此,对我来说,修复方法只是删除以下依赖项:

代码语言:javascript
复制
dependencies {
    ...
    testImplementation 'junit:junit:4.12'
}
票数 35
EN

Stack Overflow用户

发布于 2018-12-27 14:56:59

添加Java 8支持build.gradle文件

代码语言:javascript
复制
android {
     ...

     //Add the following configuration in order to target Java 8.
     compileOptions {
         sourceCompatibility JavaVersion.VERSION_1_8
         targetCompatibility JavaVersion.VERSION_1_8
     }
}
票数 17
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51797219

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档