I have MyContentProvider
in my app which works fine when I develop and run in debug mode.
<provider android:name=".MyContentProvider"
android:authorities="com.contactcities"
android:exported="false">
</provider>
But when I export the app, download it and run it, it crashes instantly :
10-10 18:24:37.682 E/AndroidRuntime(10428): FATAL EXCEPTION: main
10-10 18:24:37.682 E/AndroidRuntime(10428): java.lang.RuntimeException: Unable to get provider com.contactcities.MyContentProvider: java.lang.ClassNotFoundException: com.contactcities.MyContentProvider in loader dalvik.system.PathClassLoader[/system/framework/com.google.android.maps.jar:/data/app/com.contactcities-1.apk]
10-10 18:24:37.682 E/AndroidRuntime(10428): at android.app.ActivityThread.installProvider(ActivityThread.java:4509)
10-10 18:24:37.682 E/AndroidRuntime(10428): at android.app.ActivityThread.installContentProviders(ActivityThread.java:4281)
10-10 18:24:37.682 E/AndroidRuntime(10428): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4237)
10-10 18:24:37.682 E/AndroidRuntime(10428): at android.app.ActivityThread.access$3000(ActivityThread.java:125)
10-10 18:24:37.682 E/AndroidRuntime(10428): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2071)
10-10 18:24:37.682 E/AndroidRuntime(10428): at android.os.Handler.dispatchMessage(Handler.java:99)
10-10 18:24:37.682 E/AndroidRuntime(10428): at android.os.Looper.loop(Looper.java:123)
I can reproduce it on all my devices, 2.2, 4.0, 4.1
I have read through numerous threads today. Some of them blaming ProGuard for this. I have tried adding
-keep public class com.contactcities.MyContentProvider
but with no luck.
When I disable proguard, by not putting proguard.config=proguard.cfg
in my project.properties
. It still gives the same error in release version. Debug is again fine.
Maybe its not enough to disable proguard like that?
Maybe the hint is that it refers to maps.jar in this crash. Im not sure why it does that
in loader dalvik.system.PathClassLoader[/system/framework/com.google.android.maps.jar
Any clues will be much appreciated
MyContentProvider
? – Flagrantmaps.jar
has nothing to do with it. This is just showing the classpath that the class loader is using. In your case the classpath contains the maps.jar and your entire apk. – Caneghem