Hello my co programmers, if you are facing this error or similar error, note that you're encountering, invalid source release: 17, typically happens when your Java version is not set correctly.
This error indicates that the code you're compiling is targeting Java 17, but the version of Java used by your system is lower than that or incorrectly configured.
NOTE: share_plus or some other dependencies who act natively or work with phone hardware need java in other to work.
Here’s how you can resolve the issue: ensure you do all from No. 1 till No. 4
1. Run this command to check the current Java version:
java -version
OR
java --version
2. Set Java Version in Flutter:
You can configure your Flutter project to use Java 17 by adding the following to your android/build.gradle file:
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
}
Also, make sure your gradle.properties file includes the following line:
org.gradle.java.home=/path/to/your/java17
NOTE: If you are on Macincloud or Mac PC, comment out the above line of code
3. Set Kotlin version: Open Android/build.gradle file
SHARE THIS POST
0 comments:
Post a Comment