ClassNotFoundException for a ContentProvider

The answers regarding proguard are incorrect. This would cause an easily reproducible error on every phone, every time, because the ContentProvider class would be completely missing. The developer clearly states that they cannot reproduce the error, meaning that the ContentProvider class is present but for some reason is not being found on one of their user's phones.

I have the same crash reported in the market for my app. The stack traces look identical, and the error is occurring at installProvider. I have about 15 test phones in my office and none of them can reproduce this problem. Any other ideas would be appreciated.

Fully qualified names in the manifest are only necessary if your java package names are not the same as your android package name. If a fully qualified name is not specified, the OS will automatically prepend the android package name to the class name specified in the manifest.


This sounds similar to an issue I had that was caused by an issue with the ClassLoader, see here: Bizarre behaviour when using Apache Commons lib in Android

This bug discusses an error relating to the class loader failing sometimes. The fix for me was to add this line:

Thread.currentThread().setContextClassLoader(this.getClassLoader());

in the constructor of the class that was calling the code that was failing.


Ensure twice that you have correct qualified class name specified in AndroidManifest.xml, it must read something like this:

<provider
    android:authorities="org.iii.romulus.meridian.mediasearch"
    android:name="org.iii.romulus.meridian.MediaSearchProvider">
</provider>

Notice that @name is fully qualified.

Tags:

Android