Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Class Not Found Exception when Running YouTube API Demos for Android

Lately I am not able to run any if the YouTube API Demos for Android. I get a ClassNotFoundException when instanciating the first activity that has some dependency to the YouTube API class. This happens with any app that uses the YouTube API.

My YouTube app is updated to 4.5.+, and I'm running JellyBean on a Samsung Galaxy s3 mini.

Is there any setup I can be missing in my phone or in Eclipse ?

[EDIT] Here is the logcat copy (this time run on a Nexus S):

06-18 09:45:26.796: D/libEGL(15140): loaded /vendor/lib/egl/libEGL_POWERVR_SGX540_120.so
06-18 09:45:26.832: D/libEGL(15140): loaded /vendor/lib/egl/libGLESv1_CM_POWERVR_SGX540_120.so
06-18 09:45:26.836: D/libEGL(15140): loaded /vendor/lib/egl/libGLESv2_POWERVR_SGX540_120.so
06-18 09:45:26.964: D/OpenGLRenderer(15140): Enabling debug mode 0
06-18 09:45:35.796: W/dalvikvm(15140): Unable to resolve superclass of Lcom/examples/youtubeapidemo/YouTubeFailureRecoveryActivity; (109)
06-18 09:45:35.796: W/dalvikvm(15140): Link of class 'Lcom/examples/youtubeapidemo/YouTubeFailureRecoveryActivity;' failed
06-18 09:45:35.804: W/dalvikvm(15140): Unable to resolve superclass of Lcom/examples/youtubeapidemo/PlayerViewDemoActivity; (102)
06-18 09:45:35.804: W/dalvikvm(15140): Link of class 'Lcom/examples/youtubeapidemo/PlayerViewDemoActivity;' failed
06-18 09:45:35.820: D/AndroidRuntime(15140): Shutting down VM
06-18 09:45:35.820: W/dalvikvm(15140): threadid=1: thread exiting with uncaught exception (group=0x41a1a300)
06-18 09:45:35.855: E/AndroidRuntime(15140): FATAL EXCEPTION: main
06-18 09:45:35.855: E/AndroidRuntime(15140): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.examples.youtubeapidemo/com.examples.youtubeapidemo.PlayerViewDemoActivity}: java.lang.ClassNotFoundException: com.examples.youtubeapidemo.PlayerViewDemoActivity
06-18 09:45:35.855: E/AndroidRuntime(15140):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1983)
06-18 09:45:35.855: E/AndroidRuntime(15140):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
06-18 09:45:35.855: E/AndroidRuntime(15140):    at android.app.ActivityThread.access$600(ActivityThread.java:130)
06-18 09:45:35.855: E/AndroidRuntime(15140):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
06-18 09:45:35.855: E/AndroidRuntime(15140):    at android.os.Handler.dispatchMessage(Handler.java:99)
06-18 09:45:35.855: E/AndroidRuntime(15140):    at android.os.Looper.loop(Looper.java:137)
06-18 09:45:35.855: E/AndroidRuntime(15140):    at android.app.ActivityThread.main(ActivityThread.java:4745)
06-18 09:45:35.855: E/AndroidRuntime(15140):    at java.lang.reflect.Method.invokeNative(Native Method)
06-18 09:45:35.855: E/AndroidRuntime(15140):    at java.lang.reflect.Method.invoke(Method.java:511)
06-18 09:45:35.855: E/AndroidRuntime(15140):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
06-18 09:45:35.855: E/AndroidRuntime(15140):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
06-18 09:45:35.855: E/AndroidRuntime(15140):    at dalvik.system.NativeStart.main(Native Method)
06-18 09:45:35.855: E/AndroidRuntime(15140): Caused by: java.lang.ClassNotFoundException: com.examples.youtubeapidemo.PlayerViewDemoActivity
06-18 09:45:35.855: E/AndroidRuntime(15140):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
06-18 09:45:35.855: E/AndroidRuntime(15140):    at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
06-18 09:45:35.855: E/AndroidRuntime(15140):    at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
06-18 09:45:35.855: E/AndroidRuntime(15140):    at android.app.Instrumentation.newActivity(Instrumentation.java:1053)
06-18 09:45:35.855: E/AndroidRuntime(15140):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1974)
06-18 09:45:35.855: E/AndroidRuntime(15140):    ... 11 more

[SOLVED!]

Cool I found the answer. Seems to be a bug in a late ADT update. This link explains it all: https://groups.google.com/d/msg/adt-dev/epOfZbKPFdk/v4a-pTbq1OwJ

Or to quote it:

Project right-click > Properties > Java Build Path > Order and Export > Check Android Private Libraries > OK

Then Project > Clean...

And rebuild/run.

like image 783
Mic Avatar asked Jun 18 '13 06:06

Mic


1 Answers

Seems to be a bug in a late ADT update. This link explains it all: https://groups.google.com/d/msg/adt-dev/epOfZbKPFdk/v4a-pTbq1OwJ

Or to quote it:

Project right-click > Properties > Java Build Path > Order and Export > Check Android Private Libraries > OK

Then Project > Clean...

And rebuild/run.

like image 134
Mic Avatar answered Nov 15 '22 00:11

Mic