英文:
"Could not initialize class com.android.build.gradle.internal.dsl.decorator.AndroidPluginDslDecoratorKt" Error in android studio
问题
"我刚刚创建了一个新项目,并在其中工作了大约一天。甚至在之前多次运行过,但我不知道为什么会出现这个错误:
> 无法初始化类 com.android.build.gradle.internal.dsl.decorator.AndroidPluginDslDecoratorKt
真的很感激对此的帮助。除了这个错误之外,有时我也会得到以下日志:
> java.lang.NoClassDefFoundError: org/objectweb/asm/commons/Method
我尝试过更改类路径和更改插件的名称以及实施插件的方法的名称,但这些都对我没有用。项目既不构建,也不清理或重建。"
英文:
I have just created a new project and worked with it for about a day. I even ran it many times before but I don't know why I get this error:
> Could not initialize class com.android.build.gradle.internal.dsl.decorator.AndroidPluginDslDecoratorKt
Would really appreciate some help regarding it. Besides this error I,m also getting the log sometimes:
> java.lang.NoClassDefFoundError: org/objectweb/asm/commons/Method
I tried changing classpaths and changing the names of plugins and methods of implementation of plugins but none of them work for me. The project neither builds, nor does it clean or rebuild.
答案1
得分: 1
经过很多时间的努力,最终我找到了这个问题的解决方案。
-
在 build.gradle 文件中,将 classpath 'com.android.tools.build:gradle:7.2.0' 更新为 classpath 'com.android.tools.build:gradle:7.4.2'
-
在 gradle-wrapper.properties 文件中,将 distributionUrl=https://services.gradle.org/distributions/gradle-7.3.3-all.zip. 更新为 distributionUrl=https://services.gradle.org/distributions/gradle-7.5-all.zip
英文:
After spending many time then finally I got solutions for this problem.
-
update dependencies in build.gradle gragle from classpath 'com.android.tools.build:gradle:7.2.0' to classpath 'com.android.tools.build:gradle:7.4.2'
-
update URL in gradle-wrapper.properties file distributionUrl=https://services.gradle.org/distributions/gradle-7.3.3-all.zip. to distributionUrl=https://services.gradle.org/distributions/gradle-7.5-all.zip
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论