HarmonyOS 鸿蒙Next 4.1.1 release版本编译标准系统时出现Error: A JNI error has occurred, please check your installation and try again
HarmonyOS 鸿蒙Next 4.1.1 release版本编译标准系统时出现Error: A JNI error has occurred, please check your installation and try again
完整报错:
[94/95] ACTION //foundation/resourceschedule/background_task_mgr/resources:backgroundtaskresources_hap(//build/toolchain/ohos:ohos_clang_arm)
Error: A JNI error has occurred, please check your installation and try again
Exception in thread “main” java.lang.ExceptionInInitializerError
at java.util.jar.JarFile.initializeVerifier(JarFile.java:370)
at java.util.jar.JarFile.ensureInitialization(JarFile.java:617)
at java.util.jar.JavaUtilJarAccessImpl.ensureInitialization(JavaUtilJarAccessImpl.java:69)
at sun.misc.URLClassPath$JarLoader$2.getManifest(URLClassPath.java:991)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:451)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:495)
Caused by: java.lang.IllegalArgumentException: Error in security property. Constraint unknown: jdk.disabled.namedCurves
at sun.security.util.DisabledAlgorithmConstraints$Constraints.<init>(DisabledAlgorithmConstraints.java:329)
at sun.security.util.DisabledAlgorithmConstraints.<init>(DisabledAlgorithmConstraints.java:100)
at sun.security.util.DisabledAlgorithmConstraints.<init>(DisabledAlgorithmConstraints.java:85)
at sun.security.util.SignatureFileVerifier.<clinit>(SignatureFileVerifier.java:62)
… 14 more
复现方法:
./build.sh --product-name unionpi_tiger --build-target backgroundtaskresources_hap
在HarmonyOS(鸿蒙)Next 4.1.1版本编译系统时遇到JNI错误,通常与Java环境配置或依赖库有关。请确保你的JDK版本与HarmonyOS的编译要求相匹配,并检查所有必要的环境变量(如JAVA_HOME)是否已正确设置。同时,确认你的构建脚本和依赖库没有损坏或缺失。如果使用的是IDE(如DevEco Studio),尝试重启IDE或清理并重新构建项目。如果问题依旧没法解决请加我微信,我的微信是itying888。