android adt bundle gradle打包错误

来源:互联网 发布:青年网络公开课全集 编辑:程序博客网 时间:2024/05/16 11:54


adt-bundle-windows-x86_64-20140702


1. 在project目录,直接运行adt-bundle-windows-x86_64-20140702\sdk\tools\templates\gradle\wrapper\gradlew.bat clean会遇到error

* What went wrong:
A problem occurred evaluating root project 'myproject_name'.
> Could not create plugin of type 'AppPlugin'.

2. gradlew.bat clean --stacktrace看到error,原因不明。

Caused by: java.lang.ClassNotFoundException: org.gradle.api.artifacts.result.ResolvedModuleVersionResult

3. 因为之前有可以运行的环境,所以,进行了对比。发现:

之前使用的adt-bundle-windows-x86_64-20130522中,

adt-bundle-windows-x86_64-20130522\sdk\tools\templates\gradle\wrapper\gradle\wrapper\gradle-wrapper.properties

distributionUrl=http\://services.gradle.org/distributions/gradle-1.6-bin.zip

adt-bundle-windows-x86_64-20140702\sdk\tools\templates\gradle\wrapper\gradle\wrapper\gradle-wrapper.properties

distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-bin.zip

4. 修改gradle-wrapper.properties

adt-bundle-windows-x86_64-20140702\sdk\tools\templates\gradle\wrapper\gradle\wrapper\gradle-wrapper.properties

distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-bin.zip

distributionUrl=http\://services.gradle.org/distributions/gradle-1.6-bin.zip


5. 继续build,出现error。

* What went wrong:
A problem was found with the configuration of task ':zipalignDevRelease'.
> File 'xxx\adt-bundle-windows-x86_64-20140702\sdk\tools\zipalign.exe' sp
ecified for property 'zipAlignExe' does not exist.

6. 随便找一个zipalign.exe复制过来。

adt-bundle-windows-x86_64-20140702\sdk\build-tools\19.1.0\zipalign.exe -> adt-bundle-windows-x86_64-20140702\sdk\tools\zipalign.exe


7. ok


总结:修改gradle版本1.12->1.6,复制zipalign.exe。可以使新版SDK能gradle build。 否则,全部用旧版adt-bundle-windows-x86_64-20130522


另外,网络不好的时候 会耽误很多时间,因为gradle build过程中要下载gradle bin, maven等。 gradle缓存在这:C:\Users\username\.gradle 可以备份一下然后开始干净的测试。


0 0
原创粉丝点击