取代的android.jar在eclipse [英] replace android.jar in eclipse

查看:168
本文介绍了取代的android.jar在eclipse的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要做的Andr​​oid源$ C ​​$ C改变(的android.jar)。

I need make changes in the android source code(android.jar).

我知道我可以修改和编译新的android.jar文件。我发现所以也对此一些链接。

I know I can make changes and compile a new android.jar file. I found some links on SO too regarding this.

但我想要做的是,为获得我的项目在Eclipse中运行,而不是创建的android.jar,我想补充framework.jar,common.jar,core.jar添加等个别,并取出在Eclipse构建路径的android.jar库。

But what I want to do is, for getting my project running on eclipse, rather than creating an android.jar, I want to add framework.jar, common.jar, core.jar, etc. individually, and remove the android.jar library from the build path in eclipse.

它甚至有可能。

我尝试过,但它不工作。我加的jar文件作为系统用户库。我甚至设定的jar文件在构建路径配置出口。我的code被编译,但它给一个发射误差仿真器。

I tried it, but it is not working. I added the jar files as system user libraries. I even set the jar files as exported in build path configuration. My code gets compiled, but it gives a launching error for the emulator.

谁能给我关于此错误的任何输入。

Can anyone give me any inputs regarding this error.

推荐答案

据我所知的的android.jar 库只是一个骨架,的实物模型的android.jar 库present一个运行Android系统。

Afaik the android.jar library is just a skeleton, a mock-up of the android.jar library present on a running Android system.

如果你编译它,我认为,在类中的大多数方法都只是一个抛出UnsupportedOperationException异常返回NULL 如果需要的话。

If you decompile it, I think that most methods in classes are implemented with just a throw UnsupportedOperationException and a return null if needed.

这已经这样做了编译/部署应用程序的速度更快,所得 .apk文件使用更少的空间。

This has been done so that compiling/deploying your application is faster and the resulting .apk uses less space.

从而改变该源$ C ​​$ C 的.jar 将是无用的,因为它不会部署到该设备/仿真器。

Thus changing source code in that .jar would be useless, as it would not get deployed to the device/emulator.

如果你有兴趣在不断变化的Andr​​oid源$ C ​​$ C,你应该检查文档Android的源$ C ​​$ C 并从源代码编译整个OS。

If you are interested in changing Android source code, you should really check the documentation for the Android source code and build the entire OS from source.

编辑:

重读你的问题的有关将部分的.jar 作为用户库。

Re-read the part of your question about adding the .jar as a user library.

如果您部署的android.jar 作为一个用户库(即不共享),那么你的应用程序在运行时尝试加载类多次(从不同的来源时崩溃),由于类是已经美元的的android.jar present p $ psent设备。

If you deploy android.jar as a user library (i.e. not shared), then your application will crash at runtime when trying to load classes multiple times (from different sources), as the classes are already present in the android.jar present on the device.

即。你将无法加载自己的实现应用,因为它会与应用是类的冲突启动应用程序时由Android初始化。您code不会运行,直到启动您的应用程序,因此当类加载应用程序,你就不能越权了。

I.e. you wouldn't be able to load your own implementation of Application, because it would conflict with the Application classes that are initialized by Android when starting your application. Your code will not be run until the Application class is loaded when starting your application and, thus, you wouldn't be able to "override" that.

您可以检查<一href=\"http://stackoverflow.com/questions/9951610/best-practice-extending-or-overriding-an-android-library-project-class\">this问题了一下更多信息(特别是已获得赏金的答案)。

You can check this question for a bit more info (esp. the answer that has been awarded a bounty).

还有关于<一一些信息href=\"http://stackoverflow.com/questions/8397780/custom-class-loading-overriding-android-native-classes\">this问题,而我想在这里补充一点,据我所知,你不能当你用它卸载类:如果你想使用自定义类加载器加载的系统类,你必须停止使用,你试图使用的类的实例应用程序的所有线程,保留有关类的现有实例和类的静态数据的信息,卸载Android系统类,加载你自定义的,重新创建你保留的有关信息,所有实例(也恢复静态数据),然后重新开始所有已停止线程。此外,期望事情在其他地方突破,也为所有其他类/库,你将不会覆盖可能依赖code,你改变。

There's also some info on this question, to which I'd like to add here that, afaik, you can't unload a class while you're using it: if you'd like to use a custom class loader to load your system classes, you'd have to stop all threads of the application that are using instances of the class that you're trying to use, retain information about the existing instances of the class and the class' static data, unload the Android system class, load you custom one, re-create all the instances you retained information about (also restore static data) and then resume all the threads that you have stopped. Also, expect things to break in other places, too, as all the other classes/libraries that you will not override might rely on code that you're changing.

这篇关于取代的android.jar在eclipse的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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