ClassNotFoundException

262 views
Skip to first unread message

Ricky

unread,
Jul 5, 2012, 9:51:05 AM7/5/12
to android-support-v4...@googlegroups.com
I was hoping that someone here could help me. When I try to build the library from source, I get a ClassNotFoundException every time I try to use a class from the library. However using the precompiled library from the downloads section I do not have this problem.

I current have Arch linux x64 with Oracle JDK 1.7. I thought this was a compiler issues, so i tried adding compiler="javac1.6"  to the javac elements in build.xml. 

Pete Doyle

unread,
Jul 5, 2012, 12:14:07 PM7/5/12
to android-support-v4...@googlegroups.com
Hi Ricky,
Can you send the full stacktrace?  Also, are you getting it while building the jar from source or while building your project from a custom jar you were able to build?

My first thought is to make sure you have:
<application ....>
  <uses-library android:name="com.google.android.maps" />

   ... 
</application>

inside your AndroidManifest.xml, but you probably already do if you had the pre-built jars working.
Thanks,
Pete

Ricky

unread,
Jul 5, 2012, 6:21:38 PM7/5/12
to android-support-v4...@googlegroups.com
I only get the exception at runtime, and I can have a stack trace in the am. It only happens when I try to use a class from the library. For example, when I start an activity the extends FragmentActivity

My manifest has the uses library tag, and I get no compiler errors while building the library or my project.

I build the library with ant and my project in eclipse.

As I said the pre-compiled library works beautifully, I only get the exception when using a library that I compiled my self. I have not modified the library sources in any way.

I discovered this problem when trying to build one of the forks of your project. I thought that it was a problem with the fork, so I tried to build from your repo, with the same results.

I was working from master.

Ricky

unread,
Jul 6, 2012, 10:49:19 PM7/6/12
to android-support-v4...@googlegroups.com
07-06 22:45:51.206: E/AndroidRuntime(13640): FATAL EXCEPTION: main
07-06 22:45:51.206: E/AndroidRuntime(13640): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.TwentyCodes.android.FindMyCarFull/com.TwentyCodes.android.FindMyCarFull.Main}: java.lang.ClassNotFoundException: com.TwentyCodes.android.FindMyCarFull.Main
07-06 22:45:51.206: E/AndroidRuntime(13640): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1993)
07-06 22:45:51.206: E/AndroidRuntime(13640): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2104)
07-06 22:45:51.206: E/AndroidRuntime(13640): at android.app.ActivityThread.access$600(ActivityThread.java:132)
07-06 22:45:51.206: E/AndroidRuntime(13640): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1157)
07-06 22:45:51.206: E/AndroidRuntime(13640): at android.os.Handler.dispatchMessage(Handler.java:99)
07-06 22:45:51.206: E/AndroidRuntime(13640): at android.os.Looper.loop(Looper.java:137)
07-06 22:45:51.206: E/AndroidRuntime(13640): at android.app.ActivityThread.main(ActivityThread.java:4575)
07-06 22:45:51.206: E/AndroidRuntime(13640): at java.lang.reflect.Method.invokeNative(Native Method)
07-06 22:45:51.206: E/AndroidRuntime(13640): at java.lang.reflect.Method.invoke(Method.java:511)
07-06 22:45:51.206: E/AndroidRuntime(13640): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
07-06 22:45:51.206: E/AndroidRuntime(13640): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
07-06 22:45:51.206: E/AndroidRuntime(13640): at dalvik.system.NativeStart.main(Native Method)
07-06 22:45:51.206: E/AndroidRuntime(13640): Caused by: java.lang.ClassNotFoundException: com.TwentyCodes.android.FindMyCarFull.Main
07-06 22:45:51.206: E/AndroidRuntime(13640): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
07-06 22:45:51.206: E/AndroidRuntime(13640): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
07-06 22:45:51.206: E/AndroidRuntime(13640): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
07-06 22:45:51.206: E/AndroidRuntime(13640): at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
07-06 22:45:51.206: E/AndroidRuntime(13640): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1984)
07-06 22:45:51.206: E/AndroidRuntime(13640): ... 11 more


As mentioned before, the activity com.TwentyCodes.android.FindMyCarFull.Main extends FragmentActivity, and the application works perfectly with the pre-compiled version that you provide

Ricky

unread,
Jul 17, 2012, 12:22:38 PM7/17/12
to android-support-v4...@googlegroups.com
Since I can not compile a working version of the library, can someone please compile this fork for me? https://github.com/rfc1459/android-support-v4-googlemaps

Rick Barrette

unread,
Jul 19, 2012, 9:30:15 AM7/19/12
to android-support-v4...@googlegroups.com
I managed to get a working version of the library via building with eclipse

Andrea Baccega

unread,
Jul 31, 2012, 11:20:55 AM7/31/12
to android-support-v4...@googlegroups.com
I'm also having issues compiling the library using "ant".

I changed the libraries inside the libs folder and athe build.xml file to match the newly created folders. 

The compile task goes ok and it provides a valid jar file. The problem here is that I cannot get the compilation working even after git clone. Indeed the generated jar from the git repo also causes a classnotfoundexception.

Anyone knows the solution?
Reply all
Reply to author
Forward
0 new messages