虚拟机创建失败
1.报错消息
阅读之前请切记,这个方法有不确定性,慎用。
并且可能导致其他jar文件运行失败。
:jar
> Task :jar UP-TO-DATE
Error: Could not create the Java Virtual Machine.
Could not create the Java Virtual Machine.
-Djava.ext.dirs=F:\android-sdk-windows\build-tools\29.0.3\lib is not supported. Use -classpath instead.
Error: A fatal exception has occurred. Program will exit.
A fatal exception has occurred. Program will exit.
[jarAndroid]
上午 1:04:08: 正在执行 'jarAndroid'…
aliyun repositories
aliyun allprojects CrimsonStar
> Task :compileJava UP-TO-DATE
> Task :processResources NO-SOURCE
> Task :classes UP-TO-DATE
> Task :jar UP-TO-DATE
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
-Djava.ext.dirs=F:\android-sdk-windows\build-tools\29.0.3\lib is not supported. Use -classpath instead.
> Task :jarAndroid
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.2.1/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
BUILD SUCCESSFUL in 1s
3 actionable tasks: 1 executed, 2 up-to-date
上午 1:04:10: 执行完成 'jarAndroid'。
2.解决方式
注意这里的报错消息
-Djava.ext.dirs=F:\android-sdk-windows\build-tools\29.0.3\lib is not supported. Use -classpath instead.
-Djava.ext.dirs
的问题
那就好办了
请找到android-sdk
的文件路径,在\build-tools\29.0.3
文件下的d8.bat
文件。
打开后,你会在最后一行看到
call "%java_exe%" %javaOpts% -Djava.ext.dirs="%frameworkdir%" -cp "%jarpath%" com.android.tools.r8.D8 %params%
-Djava.ext.dirs=
为-classpath
。
注意!-classpath
后面是有空格,然后再是"%frameworkdir%"
更改后
call "%java_exe%" %javaOpts% -classpath "%frameworkdir%" -cp "%jarpath%" com.android.tools.r8.D8 %params%
上午 12:24:40: 正在执行 'deploy'…
aliyun repositories
aliyun allprojects CrimsonStar
> Task :compileJava UP-TO-DATE
> Task :processResources NO-SOURCE
> Task :classes UP-TO-DATE
> Task :jar
> Task :jarAndroid
> Task :deploy
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.2.1/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
BUILD SUCCESSFUL in 7s
4 actionable tasks: 3 executed, 1 up-to-date
上午 12:24:48: 执行完成 'deploy'。