Gradle 0.9.+/0.9.2 error: Unable to load class 'com.android.builder.testing.api.DeviceProvider'

前端 未结 2 1925
鱼传尺愫
鱼传尺愫 2020-11-29 10:03

This morning, all Android Studio projects started failing Gradle sync/build/clean with:

> Could not create plugin of type \'         


        
相关标签:
2条回答
  • 2020-11-29 10:27

    Per the latest in the bug report, the issue was that version 0.9.2 was being served from Maven central even though all the necessary components weren't yet available (and gradle doesn't register that as a problem). This breaks things because pieces are missing. Version 0.9.2 is now completely available and works, but if you're seeing this bug your gradle cache is corrupted.

    To fix:

    gradle --refresh-dependencies
    

    or delete

    ~/.gradle/caches
    

    and then re-sync.


    Prior fix, see above for update.

    Based on comments in the bug report, it appears that version 0.9.2 is the source of this problem.

    To fix, peg the gradle version to known-good version 0.9.1 instead of 0.9.+, 0.+, +, etc.

    In your build.gradle file, change

    classpath 'com.android.tools.build:gradle:0.9.+'
    

    to

    classpath 'com.android.tools.build:gradle:0.9.1'
    
    0 讨论(0)
  • 2020-11-29 10:49

    In order to use the latest Gradle version 0.9.+, you have to update gradlewrapper.properties file too.

    Open gradlewrapper.properties file which locate under youProjectPath/gradle/wrapper/gradlewrapper.properties path:

    change distributionUrl url From

    distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-all.zip
    

    To

    distributionUrl=http\://services.gradle.org/distributions/gradle-1.11-all.zip
    

    After that, I changed build.gradle dependencies to

    classpath 'com.android.tools.build:gradle:0.9.+'
    

    and synced gradle files and everything when good.

    Cheers

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