Issue
I have a ionic capacitor project. After some package updates I am getting some build error in android studio.
This is the error:
> Task :capacitor-android:compileDebugJavaWithJavac FAILED
Execution failed for task ':capacitor-android:compileDebugJavaWithJavac'.
> error: invalid source release: 17
* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':capacitor-android:compileDebugJavaWithJavac'.
at
etc
and then
Cause: error: invalid source release: 17
This is my configuration:
ext {
minSdkVersion = 21
compileSdkVersion = 33
targetSdkVersion = 33
androidxActivityVersion = '1.2.0'
androidxAppCompatVersion = '1.2.0'
androidxCoordinatorLayoutVersion = '1.1.0'
androidxCoreVersion = '1.3.2'
androidxFragmentVersion = '1.3.0'
junitVersion = '4.13.1'
androidxJunitVersion = '1.1.2'
androidxEspressoCoreVersion = '3.3.0'
cordovaAndroidVersion = '7.0.0'
}
classpath 'com.android.tools.build:gradle:7.4.0'
classpath 'com.google.gms:google-services:4.3.10'
I am kindof lost on where to go from here and don't want to continue making changes and making thins worse
Thanks for any help
Update ---
This is my capacitor.build file:
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle"
dependencies {
implementation project(':capacitor-community-sqlite')
implementation project(':capacitor-app')
implementation project(':capacitor-camera')
implementation project(':capacitor-filesystem')
implementation project(':capacitor-haptics')
implementation project(':capacitor-keyboard')
implementation project(':capacitor-status-bar')
implementation project(':capacitor-storage')
implementation project(':robingenz-capacitor-app-update')
implementation project(':robingenz-capacitor-file-picker')
implementation "com.android.support:support-v4:27.+"
implementation "com.android.billingclient:billing:4.0.0"
implementation "com.revenuecat.purchases:purchases-hybrid-common:2.0.1"
implementation "androidx.annotation:annotation:[1.2.0]"
}
Solution
When performing an Android build, the following error can be seen when Java 17 is expected in the build and the incorrect version of Java is being used:
Execution failed for task ':capacitor-cordova-android-plugins:compileDebugJavaWithJavac'.
> error: invalid source release: 17
To correct this issue, you will next want to update gradle to version 8 or greater in the build.gradle file or alternatively you can set the OVERRIDE_JAVA_VERSION environment variable to 17 as described in this documentation.
Answered By - Sarah
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.