热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

迁移到AndroidX时无法解析变量'${animal.sniffer.version}'

如何解决《迁移到AndroidX时无法解析变量'${animal.sniffer.version}'》经验,为你挑选了4个好方法。

我正在使用Android Studio 3.2 Beta5将我的项目迁移到AndroidX.当我重建我的应用程序时,我遇到了这些错误:

错误:[TAG]无法解析变量'$ {animal.sniffer.version}'

错误:[TAG]无法解析变量'$ {junit.version}'

完全清洁和重建不起作用!有人知道怎么修这个东西吗?请帮我.

gradle.properties

android.enableJetifier=true
android.useAndroidX=true

的build.gradle

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
}

应用程序/的build.gradle

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'

Beto.. 98

我通过两个步骤修复此问题

1)文件 - >无效缓存/重启... 在此输入图像描述

2)构建 - >清理项目 在此输入图像描述



1> Beto..:

我通过两个步骤修复此问题

1)文件 - >无效缓存/重启... 在此输入图像描述

2)构建 - >清理项目 在此输入图像描述


以某种方式工作了几次重建,但我现在再次得到同样的错误..
对我来说,清洁项目就足够了

2> A Droid..:

使用AndroidX Test依赖项更新build.gradle文件后,出现了相同的错误。原来我忘了删除旧的junit依赖项。因此,对我来说,解决方法是简单地删除以下依赖项:

dependencies {
    ...
    testImplementation 'junit:junit:4.12'
}



3> Dhaval Patel..:

添加的Java 8支持的build.gradle文件固定的问题对我来说

android {
     ...

     //Add the following configuration in order to target Java 8.
     compileOptions {
         sourceCompatibility JavaVersion.VERSION_1_8
         targetCompatibility JavaVersion.VERSION_1_8
     }
}


不,不,我想你必须使用androidx包.

4> Vince..:

这似乎是Glide的问题.

我有同样的错误,我刚刚将Glide的依赖项更新为4.8,并且没有构建错误.

科特林:

// Glide
def glide_version = "4.8.0"
implementation "com.github.bumptech.glide:glide:$glide_version"
kapt "com.github.bumptech.glide:compiler:$glide_version"

Java:

// Glide
def glide_version = "4.8.0"
implementation "com.github.bumptech.glide:glide:$glide_version"
annotationProcessor "com.github.bumptech.glide:compiler:$glide_version"

一定要在gradle.properties中启用:

android.useAndroidX=true
android.enableJetifier=true

资料来源:https://github.com/bumptech/glide/issues/3124

希望对你有帮助!


在没有Glide作为依赖关系的情况下,我也会出现此错误
推荐阅读
  • nuxt 内存溢出
    nuxt部署到生产环境后会出现内存溢出的情况,经过压力测试发现每一个请求都会增加内存并且释放不了。 ... [详细]
  • Firefox火狐浏览器关闭到http://detectportal.firefox.com的流量问题解决办法
    本文介绍了使用Firefox火狐浏览器时出现关闭到http://detectportal.firefox.com的流量问题,并提供了解决办法。问题的本质是因为火狐默认开启了Captive portal技术,当连接需要认证的WiFi时,火狐会跳出认证界面。通过修改about:config中的network.captive-portal-service.en的值为false,可以解决该问题。 ... [详细]
  • Google Play推出全新的应用内评价API,帮助开发者获取更多优质用户反馈。用户每天在Google Play上发表数百万条评论,这有助于开发者了解用户喜好和改进需求。开发者可以选择在适当的时间请求用户撰写评论,以获得全面而有用的反馈。全新应用内评价功能让用户无需返回应用详情页面即可发表评论,提升用户体验。 ... [详细]
  • 解决VS写C#项目导入MySQL数据源报错“You have a usable connection already”问题的正确方法
    本文介绍了在VS写C#项目导入MySQL数据源时出现报错“You have a usable connection already”的问题,并给出了正确的解决方法。详细描述了问题的出现情况和报错信息,并提供了解决该问题的步骤和注意事项。 ... [详细]
  • imx6ull开发板驱动MT7601U无线网卡的方法和步骤详解
    本文详细介绍了在imx6ull开发板上驱动MT7601U无线网卡的方法和步骤。首先介绍了开发环境和硬件平台,然后说明了MT7601U驱动已经集成在linux内核的linux-4.x.x/drivers/net/wireless/mediatek/mt7601u文件中。接着介绍了移植mt7601u驱动的过程,包括编译内核和配置设备驱动。最后,列举了关键词和相关信息供读者参考。 ... [详细]
  • 欢乐的票圈重构之旅——RecyclerView的头尾布局增加
    项目重构的Git地址:https:github.comrazerdpFriendCircletreemain-dev项目同步更新的文集:http:www.jianshu.comno ... [详细]
  • 在IDEA中运行CAS服务器的配置方法
    本文介绍了在IDEA中运行CAS服务器的配置方法,包括下载CAS模板Overlay Template、解压并添加项目、配置tomcat、运行CAS服务器等步骤。通过本文的指导,读者可以轻松在IDEA中进行CAS服务器的运行和配置。 ... [详细]
  • tcpdump 4.5.1 crash 深入分析
    tcpdump 4.5.1 crash 深入分析 ... [详细]
  • 判断编码是否可立即解码的程序及电话号码一致性判断程序
    本文介绍了两个编程题目,一个是判断编码是否可立即解码的程序,另一个是判断电话号码一致性的程序。对于第一个题目,给出一组二进制编码,判断是否存在一个编码是另一个编码的前缀,如果不存在则称为可立即解码的编码。对于第二个题目,给出一些电话号码,判断是否存在一个号码是另一个号码的前缀,如果不存在则说明这些号码是一致的。两个题目的解法类似,都使用了树的数据结构来实现。 ... [详细]
  • imnewtotheswiftandxcodeworld,soimhavingaproblemtryingtointegrateapackagetomypro ... [详细]
  • 1.移除consol.log()的babel插件安装:npmibabel-plugin-transform-remove-console-D配置:babel.config.js:这 ... [详细]
  • 商品信息|都会_淘淘商城8.6
    篇首语:本文由编程笔记#小编为大家整理,主要介绍了淘淘商城---8.6相关的知识,希望对你有一定的参考价值。继续八月五号写的,今天晚上花点时间开发这个项目& ... [详细]
  • 无限_iOS无限轮播视图
    篇首语:本文由编程笔记#小编为大家整理,主要介绍了iOS无限轮播视图相关的知识,希望对你有一定的参考价值。  以前曾经写过一个用UICollectionView的无限轮播 ... [详细]
  • 使用Jmeter录制复杂web测试脚本,提高测试效率
    [版权所有:whoistester.com&jmeter.cf]Jmeter的功能简单,不需要有脚本语言的编写经验,纯图形界面添加测试场景࿰ ... [详细]
  • protobuf在序列化和反序列化中的优势:1):序列化后体积相比Json和XML很小,适合网络传输2):支持跨平台多语言3):消息格式升级和兼容性还不错4):序列化反序列化速度很 ... [详细]
author-avatar
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有