Failed to resolve variable '${animal.sniffer.version}' when migrate to AndroidX

前端 未结 16 1029
轻奢々
轻奢々 2021-01-30 04:36

I\'m using Android Studio 3.2 Beta5 to migrate my project to AndroidX. When I rebuild my app I got these errors:

ERROR: [TA

相关标签:
16条回答
  • 2021-01-30 05:23

    I got the same error after updating my build.gradle file with AndroidX Test dependencies. Turns out I forgot to remove the old junit dependency. So for me, the fix was simply to remove the following dependency:

    dependencies {
        ...
        testImplementation 'junit:junit:4.12'
    }
    
    0 讨论(0)
  • 2021-01-30 05:24

    Try removing this line:

    maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
    

    from the buildscript / repositories section of your build.gradle file.

    When I added that line, I got the error you described. When I removed it, no longer. That line should only be in the allprojects / repositories section.

    0 讨论(0)
  • 2021-01-30 05:28

    I fix this with two steps

    1) File -> Invalidate Caches / restart...

    2) Build -> Clean project

    0 讨论(0)
  • 2021-01-30 05:31

    Fixed it by going to the main directory and typing flutter clean

    0 讨论(0)
  • 2021-01-30 05:31

    I fixed it by refreshing the cahche (Instead of invalidating it - which also clears the local history):

    1. in gradle.properties file, comment the line org.gradle.caching=true.
    2. Clean, Rebuild.
    3. in gradle.properties file, un-comment the line org.gradle.caching=true.
    4. Clean, Rebuild.

    Thats it!

    0 讨论(0)
  • 2021-01-30 05:32

    Android version: 4.10.2

    I solved this issue with three simple steps: First i added below this in pubspec.yml: (with two spaces of identation)

    module:
      androidX: true 
    

    Adding this two lines below in gradle.properties, i have this in android/gradle.properties, in the project folder.

    android.useAndroidX=true
    android.enableJetifier=true
    

    And after this i wrote with the terminal:

    flutter clean
    

    Maybe you will have to stop the device and run again.

    0 讨论(0)
提交回复
热议问题