离子电容器应用程序给我很多错误 [英] Ionic Capacitor app give me lots of errors
问题描述
我在Windows 10上,并且已经使用Capacitor 2.0.0创建了一个Ionic 5.0.7应用程序.
I'm on Windows 10 and I've created a Ionic 5.0.7 app with Capacitor 2.0.0.
我使用以下命令来构建应用程序:
I use this command to build app:
ionic build
之后,我使用以下命令:
After, I use this command:
npx cap sync
最后,我使用以下命令打开Android Studio:
And, to finish, I use this command to open Android Studio:
npx cap open android
第一个问题是在Android Studio上构建期间出现的问题
The first problem come during building on Android Studio:
org.gradle.api.reflect.ObjectInstantiationException:无法创建 类型的实例 com.novoda.release.internal.compat.gradle5_3.AndroidSoftwareComponentCompat_Gradle_5_3.
org.gradle.api.reflect.ObjectInstantiationException: Could not create an instance of type com.novoda.release.internal.compat.gradle5_3.AndroidSoftwareComponentCompat_Gradle_5_3.
由以下原因引起:org.gradle.api.reflect.ObjectInstantiationException:无法创建 类型的实例 com.novoda.release.internal.compat.gradle5_3.AndroidSoftwareComponentCompat_Gradle_5_3.
Caused by: org.gradle.api.reflect.ObjectInstantiationException: Could not create an instance of type com.novoda.release.internal.compat.gradle5_3.AndroidSoftwareComponentCompat_Gradle_5_3.
然后...
java.lang.NoClassDefFoundError: org/gradle/api/internal/java/usagecontext/LazyConfigurationUsageContext
java.lang.NoClassDefFoundError: org/gradle/api/internal/java/usagecontext/LazyConfigurationUsageContext
原因:java.lang.NoClassDefFoundError: org/gradle/api/internal/java/usagecontext/LazyConfigurationUsageContext
Caused by: java.lang.NoClassDefFoundError: org/gradle/api/internal/java/usagecontext/LazyConfigurationUsageContext
我还有其他随机错误...这很奇怪...
I've other random errors... It's weird...
推荐答案
此问题已在电容器版本2.1.2
中得到解决.
This issue has been resolved in Capacitor version 2.1.2
.
https://github.com/ionic-team/capacitor/issues/3003
请将package.json中的Capacitor依赖项更新为版本2.1.2
,然后在Android Studio中单击按钮以将项目与Gradle同步.
Please update the Capacitor dependencies in package.json to version 2.1.2
and then in Android Studio click the button to sync the project with Gradle.
"@capacitor/android": "^2.1.2",
"@capacitor/core": "2.1.2",
这篇关于离子电容器应用程序给我很多错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!