MediaPlayer: Simplified Video Playback on Android | raywenderlich.com

Playing videos is a common requirement in Android apps. In this tutorial learn about handling video playback via the MediaPlayer API on Android.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/14273655-mediaplayer-simplified-video-playback-on-android

When i try to run the app with android studio it crashes. The error is :

java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.raywenderlich.mediaplayer/com.raywenderlich.mediaplayer.VideoActivity}: java.lang.ClassNotFoundException: Didn’t find class “com.raywenderlich.mediaplayer.VideoActivity” on path: DexPathList[[zip file “/data/app/com.raywenderlich.mediaplayer-1/base.apk”],nativeLibraryDirectories=[/data/app/com.raywenderlich.mediaplayer-1/lib/arm, /vendor/lib, /system/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2477)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2654)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1488)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5728)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
Caused by: java.lang.ClassNotFoundException: Didn’t find class “com.raywenderlich.mediaplayer.VideoActivity” on path: DexPathList[[zip file “/data/app/com.raywenderlich.mediaplayer-1/base.apk”],nativeLibraryDirectories=[/data/app/com.raywenderlich.mediaplayer-1/lib/arm, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at android.app.Instrumentation.newActivity(Instrumentation.java:1072)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2467)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2654)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1488)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5728)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
Suppressed: java.lang.NoClassDefFoundError: com.raywenderlich.mediaplayer.VideoActivity
at dalvik.system.DexFile.defineClassNative(Native Method)
at dalvik.system.DexFile.defineClass(DexFile.java:226)
at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:219)
at dalvik.system.DexPathList.findClass(DexPathList.java:338)
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
… 13 more
Suppressed: java.lang.ClassNotFoundException: com.raywenderlich.mediaplayer.VideoActivity
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
… 12 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

I have tried several solutions i have found online. but i haven’t been able to resolve the issue

1 Like

@rake_code I will get take a look and get back to you. Thank you for reporting this.