question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NoClassDefFoundError exception

See original GitHub issue

This happens when pressing the button with the Intent.

final Intent chooserIntent = new Intent(context, DirectoryChooserActivity.class);
final DirectoryChooserConfig chooserConfig = DirectoryChooserConfig.builder()
         .newDirectoryName("Dir")
         .allowReadOnlyDirectory(false)
         .allowNewDirectoryNameModification(true)
         .build();
chooserIntent.putExtra(DirectoryChooserActivity.EXTRA_CONFIG, chooserConfig);
startActivityForResult(chooserIntent, REQUEST_DIRECTORY);

Logcat:

08-18 17:43:11.354  27433-27433/com.javiersantos.myapp E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.javiersantos.myapp, PID: 27433
    java.lang.NoClassDefFoundError: Failed resolution of: Lcom/gu/option/Option;
            at net.rdrei.android.dirchooser.DirectoryChooserFragment.<init>(DirectoryChooserFragment.java:60)
            at net.rdrei.android.dirchooser.DirectoryChooserFragment.newInstance(DirectoryChooserFragment.java:90)
            at net.rdrei.android.dirchooser.DirectoryChooserActivity.onCreate(DirectoryChooserActivity.java:38)
            at android.app.Activity.performCreate(Activity.java:5990)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2309)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2418)
            at android.app.ActivityThread.access$900(ActivityThread.java:154)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5289)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "com.gu.option.Option" on path: DexPathList[[zip file "/data/app/com.javiersantos.myapp-2/base.apk"],nativeLibraryDirectories=[/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 net.rdrei.android.dirchooser.DirectoryChooserFragment.<init>(DirectoryChooserFragment.java:60)
            at net.rdrei.android.dirchooser.DirectoryChooserFragment.newInstance(DirectoryChooserFragment.java:90)
            at net.rdrei.android.dirchooser.DirectoryChooserActivity.onCreate(DirectoryChooserActivity.java:38)
            at android.app.Activity.performCreate(Activity.java:5990)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2309)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2418)
            at android.app.ActivityThread.access$900(ActivityThread.java:154)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5289)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699)
    Suppressed: java.lang.ClassNotFoundException: com.gu.option.Option
            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)
            ... 17 more
     Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:19 (8 by maintainers)

github_iconTop GitHub Comments

33reactions
Phantastcommented, Mar 28, 2016

As this thread is quite long, here the summary of what solved it for me:

repositories {
    maven { url 'http://guardian.github.com/maven/repo-releases' }
}

dependencies {
    compile 'com.gu:option:1.3'
    compile 'net.rdrei.android.dirchooser:library:3.2@aar'
}

Hope it helps somebody else when checking this issue.

11reactions
javiersantoscommented, Aug 19, 2015

Fixed. I have included this lines in my own build.gradle

repositories {
    mavenCentral()
    maven { url 'http://guardian.github.com/maven/repo-releases' }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    ...
    compile ('net.rdrei.android.dirchooser:library:3.0@aar') { transitive = true; }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Resolve the NoClassDefFoundError in Java - Rollbar
NoClassDefFoundError is a Java error that occurs when the JVM is unable to find a class at runtime which was available at compile-time....
Read more >
Why am I getting a NoClassDefFoundError in Java?
java.lang.NoClassDefFoundError This exception indicates that the JVM looked in its internal class definition data structure for the definition ...
Read more >
3 ways to solve java.lang.NoClassDefFoundError in Java J2EE
NoClassDefFoundError in Java comes when Java Virtual Machine is not able to find a particular class at runtime which was available at compile...
Read more >
java.lang.NoClassDefFoundError - DigitalOcean
java.lang.NoClassDefFoundError is runtime error thrown when a required class is not found in the classpath and hence JVM is unable to load it ......
Read more >
ClassNotFoundException Vs NoClassDefFoundError in Java
Java · As the name suggests, ClassNotFoundException is an exception while NoClassDefFoundError is an error. · ClassNotFoundException occurs when ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found