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

跟風遠走 提交于 2019-11-27 01:57:34

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'
Spiros

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!