javac的Android版和DX - 麻烦处理,类名和路径不匹配 [英] Android javac and dx - trouble processing, class name and path do not match
问题描述
我使用SpartacusRex的终端IDE和其他应用程序,DroidEdit,构建和运行在Android Java应用程序。一个笑着一档的Hello World构建并运行完美,但是当我介绍我的包不能正常DEX类文件到一个JAR文件:
I'm using SpartacusRex's Terminal IDE and another app, DroidEdit, to build and run java applications on Android. A simle one-file Hello World builds and runs flawlessly, however when i introduce packages i cannot properly dex the class files into a jar file:
从我的项目目录:
javac的SRC / mypack / *。java的
此编译Successully
DX --dex --output = Test.jar的SRC
这给了我下面的警告
的麻烦处理:
类名(mypack /主)不
匹配路径(Main.class)
...在分析Main.class
......在处理Main.class
的
所有路径和包名是正确的。 Main.java是一个名为mypack文件夹中,有一个packgage声明一揽子mypack;
我在做什么错了?
此外,使用--no严格删除警告,但输出的jar文件是不正确建立并且不能运行。
All paths and package names are correct. Main.java is in a folder called "mypack" and has a packgage statement "package mypack;".
What am I doing wrong ?
Also, using --no-strict removes the warning but the outputted jar file is not built correctly and cannot be run.
任何帮助是AP preciated。感谢:)
Any help is appreciated. Thanks :)
推荐答案
您必须将类文件命名完全一样目录内的包名称,然后从它创建jar文件。
You must put the class files inside a directory named exactly like it's package name and then create the jar file from it.
例如 com.test.me.MyActivity 必须在 COM /测试/ ME / MyActivity.class
这篇关于javac的Android版和DX - 麻烦处理,类名和路径不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!