Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradle 升级到 7.1.1 遇到的问题及解决 #110

Open
soapgu opened this issue Feb 21, 2022 · 0 comments
Open

Gradle 升级到 7.1.1 遇到的问题及解决 #110

soapgu opened this issue Feb 21, 2022 · 0 comments
Labels
problem problem or trouble 安卓 安卓

Comments

@soapgu
Copy link
Owner

soapgu commented Feb 21, 2022

我们的Android Studio 的版本迎来了Bumblebee
图片
先不管feature,反正颜值高就是了

然后我们的原有项目都prompt了升级提示
图片

  • Hilt插件报错

结果一下就报错了

* Exception is:
java.lang.NoClassDefFoundError: com/android/build/api/extension/AndroidComponentsExtension
	at dagger.hilt.android.plugin.HiltGradlePlugin.configureTransformASM(HiltGradlePlugin.kt:237)
	at dagger.hilt.android.plugin.HiltGradlePlugin.configureHilt(HiltGradlePlugin.kt:79)
	at dagger.hilt.android.plugin.HiltGradlePlugin.access$configureHilt(HiltGradlePlugin.kt:50)
	at dagger.hilt.android.plugin.HiltGradlePlugin$apply$1.execute(HiltGradlePlugin.kt:57)
	at dagger.hilt.android.plugin.HiltGradlePlugin$apply$1.execute(HiltGradlePlugin.kt:50)
	at org.gradle.configuration.internal.DefaultUserCodeApplicationContext$CurrentApplication$1.execute(DefaultUserCodeApplicationContext.java:123)
	at org.gradle.api.internal.DefaultCollectionCallbackActionDecorator$BuildOperationEmittingAction$1.run(DefaultCollectionCallbackActionDecorator.java:110)
Caused by: java.lang.ClassNotFoundException: com.android.build.api.extension.AndroidComponentsExtension
	... 193 more

看报错信息云里雾里,不过基本能定位是Hilt这个插件执行不了。

  • 解决方案
    看StackOverflow看不出啥端倪,看mvnrepository这Hilt的组件已经升到2.41了,成功了。看来组件库的定期升级是需要的

  • 警告信息

Your project has set android.useAndroidX=true, but configuration debugRuntimeClasspath still contains legacy support libraries, which may cause runtime issues.

  • 解决方案
    gradle.properties里面加上android.enableJetifier=true
@soapgu soapgu added 安卓 安卓 problem problem or trouble labels Feb 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
problem problem or trouble 安卓 安卓
Projects
None yet
Development

No branches or pull requests

1 participant