avatar

tetsai

原创声明

本文由tetsai原创,转载请注明来源

android studio 进行Build构建时遇到两个错误

java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.reflection.ReflectionCache

java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7

错误原因:gradle版本太低,修改gradle-wrapper.properties文件

修改之前:

#Mon May 25 23:05:12 CST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip

修改之后:

#Mon May 25 23:05:12 CST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip

然后重新build就好了。

参考资料:https://stackoverflow.com/questions/35000729/android-studio-could-not-initialize-class-org-codehaus-groovy-runtime-invokerhel

发表评论

电子邮件地址不会被公开。 必填项已用*标注