从一个android项目引用到另一个Eclipse [英] Refering from one android project to another Eclipse

查看:180
本文介绍了从一个android项目引用到另一个Eclipse的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经尝试了2个小时了,我似乎没有让它上班。我想在另一个项目中为我的应用程序构建一个框架。首先我只想从另一个项目中接触到一个课程。代码编译但是在运行时失败,在我从框架中实例化一个对象的行。

I've tried this for 2 hours now and I dont seem to get it to work. I want to build a framework for my application, in another project. First of I'm just trying to reach a class from that other project. The code compiles but fails at runtime, at the line where i instantiate an object from a class from the framework.

05-24 18:04:01.645: E/dalvikvm(16927): Could not find class 'frame.test.Hello', referenced from method moduleLogin.activity.Login.loginClick
05-24 18:04:01.645: W/dalvikvm(16927): VFY: unable to resolve new-instance 190 (Lframe/test/Hello;) in LmoduleLogin/activity/Login;
05-24 18:04:02.715: W/dalvikvm(16927): threadid=1: thread exiting with uncaught exception (group=0x4001e578)
05-24 18:04:02.720: E/AndroidRuntime(16927):    at android.view.View$1.onClick(View.java:2154)
05-24 18:04:02.720: E/AndroidRuntime(16927):    at android.view.View.performClick(View.java:2538)
05-24 18:04:02.720: E/AndroidRuntime(16927):    at android.view.View$PerformClick.run(View.java:9152)
05-24 18:04:02.720: E/AndroidRuntime(16927):    at android.os.Handler.handleCallback(Handler.java:587)
05-24 18:04:02.720: E/AndroidRuntime(16927):    at android.os.Handler.dispatchMessage(Handler.java:92)
05-24 18:04:02.720: E/AndroidRuntime(16927):    at android.os.Looper.loop(Looper.java:130)
05-24 18:04:02.720: E/AndroidRuntime(16927):    at android.app.ActivityThread.main(ActivityThread.java:3691)
05-24 18:04:02.720: E/AndroidRuntime(16927):    at java.lang.reflect.Method.invokeNative(Native Method)
05-24 18:04:02.720: E/AndroidRuntime(16927):    at java.lang.reflect.Method.invoke(Method.java:507)
05-24 18:04:02.720: E/AndroidRuntime(16927):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:907)
05-24 18:04:02.720: E/AndroidRuntime(16927):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:665)
05-24 18:04:02.720: E/AndroidRuntime(16927):    at dalvik.system.NativeStart.main(Native Method)
05-24 18:04:02.720: E/AndroidRuntime(16927): Caused by: java.lang.reflect.InvocationTargetException
05-24 18:04:02.720: E/AndroidRuntime(16927):    at java.lang.reflect.Method.invokeNative(Native Method)
05-24 18:04:02.720: E/AndroidRuntime(16927):    at java.lang.reflect.Method.invoke(Method.java:507)
05-24 18:04:02.720: E/AndroidRuntime(16927):    at android.view.View$1.onClick(View.java:2149)
05-24 18:04:02.720: E/AndroidRuntime(16927):    ... 11 more
05-24 18:04:02.720: E/AndroidRuntime(16927): Caused by: java.lang.NoClassDefFoundError: frame.test.Hello
05-24 18:04:02.720: E/AndroidRuntime(16927):    at moduleLogin.activity.Login.loginClick(Login.java:49)
05-24 18:04:02.720: E/AndroidRuntime(16927):    ... 14 more

我知道有很多关于这个话题,但是我已经搜索了几个小时,没有任何解决这个问题的帖子。大多数主题是如何引用另一个项目。但是由于我的代码是编译,应该被引用?

I know there is a lot on this topic, but I've have searched for hours without any posts solving this problem. Most of the topics are how to reference to another project. But since my code is compiling it should be referenced?

这两个项目是否需要是Android项目?框架项目应该是图书馆吗?感谢任何帮助!

And does both projects needs to be Android projects? Should the framework project be a library? Thanks for any help!

推荐答案

如果图书馆项目是一个Android项目,您需要通过选择它来使其成为一个库从项目属性,然后通过相同的地方,但使用它的项目。
不要忘记使用库项目时有一些规则。请参阅我的帖子此处了解更多信息。

if the library project is an android project , you need to make it a library one by choosing it from the project properties , and then to reference it via the same place but on the project that uses it. don't forget that there are some rules when you use a library project . see my post here for more information.

如果库项目是java,它与其他java项目完全一样。

if the library project is java , its exactly as using other java projects.

这篇关于从一个android项目引用到另一个Eclipse的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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