我怎样才能一罐添加到APK&安培;使APK是指它不使用Eclipse? [英] How can I add a jar to an APK & make the APK refer to it without Eclipse?

查看:182
本文介绍了我怎样才能一罐添加到APK&安培;使APK是指它不使用Eclipse?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这似乎有点不可思议,但我需要实现它。

This may seem a bit weird, but I need to implement it.

我有一个 APK &安培; 我不要有其源$ C ​​$ C。
现在,我可以打破APK,修改和放大器;重新包装,但在这样做,我需要我的自定义jar添加到它和放大器;使应用程序/ APK在运行时参考该库/瓶。

I have an APK & I dont have its source code. Now I can break the apk , modify & repack it, but while doing so, I need to add my custom jar to it & make the app/apk refer this library/jar at run time.

如果我刚刚创建APK&放一个文件夹里面库;把我的罐内,我得到一个错误NoClassDefFound

If I just create a folder libs inside the apk & put my jar inside, I get a NoClassDefFound error.

不知道如何使用ANT或任何其他工具实现它?
感谢名单提前

Any idea how to implement it using ANT or any other tool ? Thanx in advance

推荐答案

在你的Andr​​oid项目附加的jar(S),也不会复制到APK。

The Jar(s) you attach in your android project, are not copied into APK.

会发生什么事是,你的罐子code(S)文件将成为你的Andr​​oid code的一部分。这意味着你不能简单地将(或复制)中的JAR文件APK。

What happens is that, The code of your Jar(s) file becomes part of your Android code. That means you can not simply place(or copy) Jar files in your APK.

但是,周围有一个方法。在APK,源$ C ​​$ C可以在classes.dex文件中找到。

But, There is a way around. In APK, your source code can be found in the classes.dex file.

你需要做的是,按照步骤

What you need to do is, follow the steps

1 - APK用winrar解压

1 - Extract APK using winRAR

2 - 转换classes.dex使用是JAR的 dex2jar

2 - Convert classes.dex to Jar using dex2jar

3 - 提取.jar文件

3 - Extract Jar file

4 - 您将有源$ C ​​$ C中的* .class,您可以使用 JdGUI 将其转换为*的.java

4 - You will have source code in *.class, You can use JdGUI to convert it to *.java.

现在,您可以创建新的Andr​​oid项目,并使用code。

Now, you can create new android project and use the code.

这篇关于我怎样才能一罐添加到APK&安培;使APK是指它不使用Eclipse?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆