"Could not initialize class com.android.build.gradle.internal.dsl.decorator.AndroidPluginDslDecoratorKt" Error in android studio

huangapple go评论131阅读模式
英文:

"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

经过很多时间的努力,最终我找到了这个问题的解决方案。

  1. 在 build.gradle 文件中,将 classpath 'com.android.tools.build:gradle:7.2.0' 更新为 classpath 'com.android.tools.build:gradle:7.4.2'

  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.

  1. 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'

  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

huangapple
  • 本文由 发表于 2023年5月22日 14:02:49
  • 转载请务必保留本文链接:https://go.coder-hub.com/76303390.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定