Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy does my Android app crash with NoClassDefFoundError for one specific library?
    primarykey
    data
    text
    <p>I have an Android application project (A) and an Android library project (L). A uses L as a library.</p> <p>L, the library project, uses a few external libraries already: Apache Commons Codec 1.7, Apache Commons Lang3 3.1, the Android Support library V4, and ActionBarSherlock 4.0, referenced as a library project. All of these libraries, and the code that calls them, work perfectly fine, and have been working fine for a while.</p> <p>However, I recently added one more library: Apache Commons IO 2.4. Now my application crashes any time the library code (in L) tries to call a method in Commons IO.</p> <p>I've added the IO library in exactly the same way as I've added every other external library: <img src="https://i.stack.imgur.com/tA6MQ.png" alt="build path"></p> <p>When my application first starts I get:</p> <pre><code>11-01 12:32:14.243: I/dalvikvm(3815): Could not find method org.apache.commons.io.FileUtils.copyInputStreamToFile, referenced from method au.com.grdc.alib.helpers.LibraryCommon.download 11-01 12:32:14.243: W/dalvikvm(3815): VFY: unable to resolve static method 7039: Lorg/apache/commons/io/FileUtils;.copyInputStreamToFile (Ljava/io/InputStream;Ljava/io/File;)V </code></pre> <p>Later on I get:</p> <pre><code>11-01 14:50:48.913: E/AndroidRuntime(10030): FATAL EXCEPTION: AsyncTask #1 11-01 14:50:48.913: E/AndroidRuntime(10030): java.lang.RuntimeException: An error occured while executing doInBackground() ... 11-01 12:35:10.268: E/AndroidRuntime(4493): Caused by: java.lang.NoClassDefFoundError: org.apache.commons.io.FileUtils 11-01 12:35:10.268: E/AndroidRuntime(4493): at au.com.grdc.alib.helpers.LibraryCommon.download(LibraryCommon.java:89) </code></pre> <p>I saw that it was recommended to rename my "lib" folder to "libs", which I've done &mdash; this hasn't fixed the problem.</p> <p>I also saw recommendations to mark external libraries to be exported, which I've also done, and which also hasn't fixed the problem.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload