usabilla-u4a-android-sdk
usabilla-u4a-android-sdk copied to clipboard
ContentProvider introduced in 7.3.3 breaks instant-app
What happens
Crash java.lang.RuntimeException: Unable to get provider com.usabilla.sdk.ubform.utils.UbFileProvider
when opening the Instant App. Full crash log below.
Why
We use Usabilla SDK as part of a dynamic-feature module that's only installed when required. The module where usabilla SDK lives is not part of the instant app but the manifest gets merged in any case (this is always the case in Android).
Since the introduction of the ContentProvider in version 7.3.3 of the Usabilla SDK, the merged AndroidManifest.xml (the one available inside the APK) contains the following new content provider:
<provider
android:name="com.usabilla.sdk.ubform.utils.UbFileProvider"
android:exported="false"
android:authorities="com.myapp.flavor.usabilla.fileprovider"
android:grantUriPermissions="true"
android:splitName="usabilla">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@ref/0x7f140000" />
</provider>
This ContentProvider tries to load the class UbFileProvider and it crashes the app at runtime, the only two options we have found to work are
1- downgrade to version 7.3.2
2- add this content provider in our manifest with the extra tag to remove it tools:node="remove"
We have chosen to downgrade because it's the safest option without official support for disabling the content provider or info about the consequences of doing it.
Full crash log
java.lang.RuntimeException: Unable to get provider com.usabilla.sdk.ubform.utils.UbFileProvider: java.lang.ClassNotFoundException: Didn't find class "com.usabilla.sdk.ubform.utils.UbFileProvider" on path: DexPathList[[zip file "/data/app/~~FlxpAD7htOGQSQAMO35g4w==/com.myapp-fbEpJUaHsMMG43UkP1DAEQ==/base.apk", zip file "/data/app/~~FlxpAD7htOGQSQAMO35g4w==/com.myapp-fbEpJUaHsMMG43UkP1DAEQ==/split_deeplink.apk", zip file "/data/app/~~FlxpAD7htOGQSQAMO35g4w==/com.myapp-fbEpJUaHsMMG43UkP1DAEQ==/split_dynamicui.apk"],nativeLibraryDirectories=[/data/app/~~FlxpAD7htOGQSQAMO35g4w==/com.myapp-fbEpJUaHsMMG43UkP1DAEQ==/lib/arm64, /system/lib64, /system/system_ext/lib64, /product/lib64]]
at android.app.ActivityThread.installProvider(ActivityThread.java:7317)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6853)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6748)
at android.app.ActivityThread.access$1400(ActivityThread.java:242)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1929)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:368)
at android.app.ActivityThread.main(ActivityThread.java:7730)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:954)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.usabilla.sdk.ubform.utils.UbFileProvider" on path: DexPathList[[zip file "/data/app/~~FlxpAD7htOGQSQAMO35g4w==/com.myapp-fbEpJUaHsMMG43UkP1DAEQ==/base.apk", zip file "/data/app/~~FlxpAD7htOGQSQAMO35g4w==/com.myapp-fbEpJUaHsMMG43UkP1DAEQ==/split_deeplink.apk", zip file "/data/app/~~FlxpAD7htOGQSQAMO35g4w==/com.myapp-fbEpJUaHsMMG43UkP1DAEQ==/split_dynamicui.apk"],nativeLibraryDirectories=[/data/app/~~FlxpAD7htOGQSQAMO35g4w==/com.myapp-fbEpJUaHsMMG43UkP1DAEQ==/lib/arm64, /system/lib64, /system/system_ext/lib64, /product/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.AppComponentFactory.instantiateProvider(AppComponentFactory.java:147)
at androidx.core.app.CoreComponentFactory.instantiateProvider(CoreComponentFactory.java:67)
at android.app.ActivityThread.installProvider(ActivityThread.java:7301)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6853)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6748)
at android.app.ActivityThread.access$1400(ActivityThread.java:242)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1929)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:368)
at android.app.ActivityThread.main(ActivityThread.java:7730)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:954)
Hi @sebaslogen ,
Thank you for bring this to our attention, our developers will investigate this shortly.
If you have any additional questions, please don't hesitate to send them to [email protected].
Kind Regards, Xander
Hi @sebaslogen ,
Our Developers have looked into this issue and got back to me regarding this.
You mentioned that you have chosen to downgrade because it being the safest option without official support for disabling the content provider or information about the consequences of doing it.
Please could you clarify if you mean lack of support from Android/Google or lack of support from us? If this is the latter case, the ContentProvider is exclusively used for the screenshot component in the passive form, so if you don't use it, there shouldn’t be a problem.
The Developers also suggested that you could create a "dummy class" in your base module with the path: com.usabilla.sdk.ubform.utils.UbFileProvider
extending FileProvider
and leave it empty. This should be properly overwritten once you download the module where our SDK depencey is.
Please let me know if this resolves this issue
Kind Regards, Xander
Hi @xanderwernecke, Thanks for the response.
Regarding the lack of support I meant in your SDK, since there is no API or documentation I could find about disabling it, thanks to your comment is now clearer what would happen if we disable it from the Android manifest.
As for the suggestion of creating a dummy class, it seems like a temporary workaround and we could give it a try. On the other hand, we wouldn't want to adopt this as a long term solution because any future change made in the SDK to the package name or class name of the provider would still compile fine and then crash at runtime, possibly in production if we miss the test in the instant app.
Hi @sebaslogen , I hope you are doing well. Until we provide a solution, I was wondering how is the situation at the moment? Have you applied the removal workaround which is:
<provider
android:name="com.usabilla.sdk.ubform.utils.UbFileProvider"
android:authorities="${applicationId}.usabilla.fileprovider"
tools:node="remove"
/>
Did it work for now? is there any side effects you have?
Thanks in advance. Best Regards,
Hi there, I'm not involved in the project anymore. But I know that the chosen solution was to stay on version 7.3.2 until further progress was made on this ticket.
Hi @sebaslogen Thanks for letting us know.