I have build my aplication usnign ionic vie js.
Recently Android play updated its policy to have minimum targetSdkVersion = 31. So i have to update targetSdkVersion in my varaiables.gradlen from 30 to 31
ext {
minSdkVersion = 21
compileSdkVersion = 31
targetSdkVersion = 31
But after it i am facing following error while building my application in android studio. I tried following commands as well (but still its not building)
> ionic cap sync android
> npx jetified
gradle clean
project re-build
Error details:
Task :capacitor-cordova-android-plugins:compileDebugJavaWithJavac FAILED An exception has occurred in the compiler (1.8.0_242-release). Please file a bug against the Java compiler via the Java bug reporting page ( http://bugreport.java.com ) after checking the Bug Database ( http://bugs.java.com ) for duplicates. Include your program and the following diagnostic in your report. Thank you. java.lang.AssertionError: annotationType(): unrecognized Attribute name MODULE (class com.sun.tools.javac.util.UnsharedNameTable$NameImpl) at com.sun.tools.javac.util.Assert.error(Assert.java:133) at com.sun.tools.javac.code.TypeAnnotations.annotationType(TypeAnnotations.java:231) at com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.separateAnnotationsKinds(TypeAnnotations.java:294) at com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitMethodDef(TypeAnnotations.java:1066) at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:778) at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49) at ... ... Task :app:checkDebugAarMetadata Task :capacitor-android:javaPreCompileDebug Task :capacitor-android:generateDebugRFile Task :app:javaPreCompileDebug Task :capacitor-android:mergeDebugJavaResource
FAILURE: Build failed with an exception.
- What went wrong: Execution failed for task ':capacitor-cordova-android-plugins:compileDebugJavaWithJavac'.
Can anyone help?
Update 2 - after upgrading JAVA After upgrading the JAVA. I have following error:
Manifest merger failed : uses-sdk:minSdkVersion 1 cannot be smaller
than version 27 declared in library
[:capacitor-cordova-android-plugins]
app\android\capacitor-cordova-android-plugins\build\intermediates\library_manifest\debug\AndroidManifest.xml
as the library might be using APIs not available in 1 Suggestion: use
a compatible library with a minSdk of at most 1, or increase this
project's minSdk version to at least 27, or use
tools:overrideLibrary="capacitor.android.plugins" to force usage (may
lead to runtime failures)
Although in my Manifest is have
<uses-sdk
android:minSdkVersion="27"
android:targetSdkVersion="31" />
1条答案
按热度按时间w6mmgewl1#
API级别
31
和Java1.8.0_242
不兼容,因为它不再是Java 8。使用Java 11构建当前API;这可能还需要更新的Gradle版本。