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?
And does both projects needs to be Android projects? Should the framework project be a library? Thanks for any help!
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.
if the library project is java , its exactly as using other java projects.