Java 如何将 jar 文件转换为 apk 格式?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4346924/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I convert a jar file into apk format?
提问by Ralph El Helou
I need to find a way to convert jar file to apk file. I have reached a road block!
我需要找到一种将 jar 文件转换为 apk 文件的方法。我已经到了一个路障!
回答by Blender
Is the JAR natively made for Android? If not, you'll have to run it in an emulation layer or something like this: http://microemu.blogspot.com/2008/11/running-java-me-applications-on-android.html
JAR 是为 Android 原生制作的吗?如果没有,您必须在仿真层或类似的东西中运行它:http: //microemu.blogspot.com/2008/11/running-java-me-applications-on-android.html
Good luck?
祝你好运?
回答by Jason Plank
According to this threadon xda-devs, you might be able to use something like this. However, if you have the source for the jar, then you might as well compile the apk from the source. It seems to depend on what the jar was compiled as.
根据此线程上XDA-开发者,你也许能够使用的东西像这样。但是,如果您有 jar 的源代码,那么您不妨从源代码编译 apk。这似乎取决于 jar 被编译为什么。
回答by Telmo Marques
I've never tried this tool, but you can give it a go:
我从未尝试过这个工具,但你可以试一试:
http://www.netmite.com/android/srv/1.7/getapk.php
http://www.netmite.com/android/srv/1.7/getapk.php
If it doesn't work then I think you'll have to use an emulator on the device, or create an apk from source, as expressed by Blender and burpen.
如果它不起作用,那么我认为您必须在设备上使用模拟器,或者从源创建一个 apk,如 Blender 和 burpen 所表达的那样。
回答by Ralph El Helou
ok, guess the only way around it is to run the application on an android emulator, when that is done, an apk file is automatically generated in the project directory. If the application is not built by using android libraries then the only way to get an apk file is to rewrite the code by using android libraries and run it on an emulator. Bad news for me and some of you.
好的,猜测唯一的解决方法是在 android 模拟器上运行应用程序,完成后,会在项目目录中自动生成一个 apk 文件。如果应用程序不是使用 android 库构建的,那么获取 apk 文件的唯一方法是使用 android 库重写代码并在模拟器上运行它。对我和你们中的一些人来说是个坏消息。