pchmn / expo-material3-theme

Manage Material 3 theme in your React Native App
MIT License
84 stars 3 forks source link

Build Error: Inconsistent JVM-target compatibility detected #16

Open RunRanger opened 1 month ago

RunRanger commented 1 month ago

Whenever i run "expo run:android" via npm package.json this error occurs:

│
│ FAILURE: Build failed with an exception.
│
│ * What went wrong:
│ Execution failed for task ':pchmn-expo-material3-theme:compileDebugKotlin'.
│ > Inconsistent JVM-target compatibility detected for tasks 'compileDebugJavaWithJavac' (17) and 'compileDebugKotlin' (19).
│
│   Consider using JVM Toolchain: https://kotl.in/gradle/jvm/toolchain
│   Learn more about JVM-target validation: https://kotl.in/gradle/jvm/target-validation
│
│ * Try:
│ > Run with --stacktrace option to get the stack trace.
│ > Run with --info or --debug option to get more log output.
│ > Run with --scan to get full insights.
│ > Get more help at https://help.gradle.org.
│
│ BUILD FAILED in 50s
│ 465 actionable tasks: 92 executed, 359 from cache, 14 up-to-date

app.json (expo-build-properties):

"android": { "compileSdkVersion": 34, "targetSdkVersion": 34, "buildToolsVersion": "34.0.0" }

package.json dependencies:

"dependencies": {
    "@config-plugins/ffmpeg-kit-react-native": "^8.0.0",
    "@expo/metro-config": "^0.18.11",
    "@expo/vector-icons": "^14.0.4",
    "@pchmn/expo-material3-theme": "^1.3.2",
    "@react-native-async-storage/async-storage": "^1.24.0",
    "@react-native-masked-view/masked-view": "^0.3.1",
    "@react-navigation/drawer": "^6.7.2",
    "@react-navigation/native": "^6.1.18",
    "expo": "^51.0.38",
    "expo-asset": "~10.0.10",
    "expo-build-properties": "~0.12.5",
    "expo-constants": "^16.0.2",
    "expo-dev-client": "~4.0.27",
    "expo-device": "~6.0.2",
    "expo-file-system": "~17.0.1",
    "expo-font": "^12.0.10",
    "expo-linear-gradient": "~13.0.2",
    "expo-linking": "~6.3.1",
    "expo-localization": "^15.0.3",
    "expo-media-library": "^16.0.5",
    "expo-router": "^3.5.23",
    "expo-screen-orientation": "~7.0.5",
    "expo-splash-screen": "^0.27.6",
    "expo-status-bar": "~1.12.1",
    "expo-system-ui": "~3.0.7",
    "expo-web-browser": "~13.0.3",
    "ffmpeg-kit-react-native": "^6.0.2",
    "i18n": "*",
    "lodash": "^4.17.21",
    "react": "18.3.1",
    "react-native": "^0.75.4",
    "react-native-gesture-handler": "~2.20.0",
    "react-native-paper": "^5.12.5",
    "react-native-reanimated": "^3.16.1",
    "react-native-safe-area-context": "^4.11.0",
    "react-native-screens": "^3.31.1",
    "react-native-svg": "^15.7.1",
    "react-native-track-player": "^4.1.1",
    "react-native-web": "^0.19.12",
    "shaka-player": "^4.11.7"
  }
fudzi9nine commented 1 week ago

Hello, mate. There is a chance that Android Studio lost your JAVA_HOME Check here Settings => Build, Execution, Deployment => Build Tools => Gradle Take a look at Gradle JDK field and make sure it's set up correctly, in your case it should be 17 (17 should be in path also, not 19)

pchmn commented 3 hours ago

@RunRanger did you manage to build your app ultimately ?

As @fudzi9nine said, it seems you were trying to build your app with JDK 19 while it should be JDK 17. You can run java --version to confirm the JDK version you use.