我想编译classes.jar
并获取.dex
一个模块以使用 DexClassLoad 进一步加载它。但是,在编译时,我收到以下错误:
C:\Users\today\AppData\Local\Android\Sdk\build-tools\26.0.1>dx -dex -output loadable.dex classes.jar
ERROR: No suitable Java found. In order to properly use the Android Developer
Tools, you need a suitable version of Java JDK installed on your system.
We recommend that you install the JDK version of JavaSE, available here:
http://www.oracle.com/technetwork/java/javase/downloads
If you already have Java installed, you can define the JAVA_HOME environment
variable in Control Panel / System / Avanced System Settings to point to the
JDK folder.
You can find the complete Android SDK requirements here:
http://developer.android.com/sdk/requirements.html
不过我注册了JAVA_HOME,也就是jdk的路径已经在PATH里面了:
C:\Program Files\Java\jdk-11.0.8
我开始检查 find_java.bat:
PS C:\Users\today\AppData\Local\Android\Sdk\tools\lib> ./find_java.bat
ERROR: No suitable Java found. In order to properly use the Android Developer
Tools, you need a suitable version of Java JDK installed on your system.
We recommend that you install the JDK version of JavaSE, available here:
http://www.oracle.com/technetwork/java/javase/downloads
If you already have Java installed, you can define the JAVA_HOME environment
variable in Control Panel / System / Avanced System Settings to point to the
JDK folder.
You can find the complete Android SDK requirements here:
http://developer.android.com/sdk/requirements.html
找不到java
原来不支持Java 11版本,所以切换到Java 8版本解决了问题,dx批处理文件工作