I'm using a FileProvider to get photos from the device. The implementation works just fine in debug builds (minifyEnabled false) but when I'm building the release build (minifyEnabled true) I get an error:
java.lang.RuntimeException: Unable to get provider android.support.v4.content.FileProvider:
java.lang.ClassNotFoundException: Didn't find class "android.support.v4.content.FileProvider"
on path: DexPathList[[zip file "/data/app/com.package.name-2/base.apk"],
nativeLibraryDirectories=[/data/app/om.package.name-2/lib/arm, /vendor/lib, /system/lib]]
So I guess this has someting to do with the proguard setup
I have
compile 'com.android.support:support-v13:23.1.1'
which is a superset of v4 in my gradle file and
minSdkVersion 21
targetSdkVersion 23
and
-keep class android.support.v4.app.** { *; }
-keep class android.support.v4.content.** { *; }
-keep interface android.support.v4.app.** { *; }
-keep interface android.support.v4.content.** { *; }
-keep class * extends android.content.ContentProvider
in my proguard-rules.pro file
I have tested with both Android 5 and 6 and same thing happens. Any suggestion would be usefull, thanks in advance.
After a couple of hours of more googling around I've ended up updating gradle and google services to
previously the version ware
I guess there needs to be something with the google-services library
The following worked for me:
In your module build.gradle file:
}
Then:
}
And finally, ensure that your application class has one of the following:
A. If you do not extend your application class:
B. If you do extend your Application class and but can change the base class:
C. If you do extend your Application class and cannot change the base class:
For more info:
https://developer.android.com/studio/build/multidex.html#mdex-gradle