admin管理员组文章数量:1122832
Edited
I still don't know the solution to this but I change from using @capacitor/barcode-scanner
to html5-qrcode
npm package. It still gives off the same functionalities but I don't have to deal with the error anymore.
But if you know the solution to my issue, feel free to share.
I'm using @capacitor/barcode-scanner in a reactjs project. The web version runs perfectly, but an error occurs for the mobile app ver.
I got this error when running the application
Execution failed for task ':capacitor-barcode-scanner:compileDebugKotlin'. Inconsistent JVM-target compatibility detected for tasks 'compileDebugJavaWithJavac' (17) and 'compileDebugKotlin' (21).
I tried to change the java version in capacitor.build.gradle file but it will revert back to original when sync.
I also install jdk 17 and jdk 21 to try which one is suitable, but still received the same error.
Here are the solutions I've tried: Link 1 Link 2 Link 3
Does the error come from Capacitor Barcode Scanner plugin or the Android?
Edited
I still don't know the solution to this but I change from using @capacitor/barcode-scanner
to html5-qrcode
npm package. It still gives off the same functionalities but I don't have to deal with the error anymore.
But if you know the solution to my issue, feel free to share.
I'm using @capacitor/barcode-scanner in a reactjs project. The web version runs perfectly, but an error occurs for the mobile app ver.
I got this error when running the application
Execution failed for task ':capacitor-barcode-scanner:compileDebugKotlin'. Inconsistent JVM-target compatibility detected for tasks 'compileDebugJavaWithJavac' (17) and 'compileDebugKotlin' (21).
I tried to change the java version in capacitor.build.gradle file but it will revert back to original when sync.
I also install jdk 17 and jdk 21 to try which one is suitable, but still received the same error.
Here are the solutions I've tried: Link 1 Link 2 Link 3
Does the error come from Capacitor Barcode Scanner plugin or the Android?
Share Improve this question edited Dec 3, 2024 at 8:01 nur najihah asked Nov 22, 2024 at 1:46 nur najihahnur najihah 816 bronze badges2 Answers
Reset to default 0If jdk 21 version not works. Then java 17 is always safer option to choose.
in gradle change source and target compatibility to 17 version for better stability
If you are using latest JDK to your project then you can make changes in build.gradle(app-level) and your project will run successfully.
compileOptions {
sourceCompatibility JavaVersion.VERSION_21 // Adjust the version to the one that works for your project.
targetCompatibility JavaVersion.VERSION_21 // Adjust the version to the one that works for your project.
}
and
kotlinOptions {
jvmTarget = '21' // Adjust the version to the one that works for your project.
}
本文标签:
版权声明:本文标题:android - Reactjs + Capacitor Barcode Scanner: Execution failed for task ':capacitor-barcode-scanner:compileDebugKotlin& 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736306174a1932860.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论