-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NullPointerException on FileProvider Crash reports from Android 8/8.1 with 0.9.0-beta3 #1664
NullPointerException on FileProvider Crash reports from Android 8/8.1 with 0.9.0-beta3 #1664
Comments
I am also noticing the same issue. Occurring on devices 8.0 and up. |
Experiencing the same issue on Android 7.0, 8.0 and 8.1 on multiple devices (Xperia XZ2 Compact, Nokia 8 Sirocco, P10 lite, Xperia XZ1, Mate 10 Pro), using the current master version of this plugin. Not sure what the impact is. |
Actually, in my case another plugin caused this problem, namely I recommend that others with this problem check their generated AndroidManifest.xml for this issue, find which plugin that generates the code for the FileProvider section, and correct it. |
But in this plugin this code: cordova-plugin-local-notifications/plugin.xml Line 105 in 6d1b27f
|
True, but that is for |
@Gachapen I have Could you suggest how to test? Except publish to product and see into crash logs? |
Hm, it's a tricky issue. I wasn't able to reproduce the crash locally, and I have no idea when it happens, so I just made the change, tested that nothing broke, and published a new version. You could do the same, but publish it in the test channel, or do a partial rollout, and see if you get any crash reports. Also, if you build a release version and install it on your phone, you can still see crash reports in Play if you select to see "from all sources". |
@Gachapen Thanks. I'll try it. |
Thanks @Gachapen |
I think I discovered what the actual issue is. At least for me it seems to be because two plugins (this, and https://github.com/darryncampbell/darryncampbell-cordova-plugin-intent) both provide different providers through the same authorities ( Can you confirm that you also have two See more here: darryncampbell/darryncampbell-cordova-plugin-intent#58 (comment) |
Yes that's the case with me. This plugin had the AssetProvider as ${applicationId}.provider as well as another one of my plugins FileProvider as ${applicationId}.provider. |
And my plugins add the same lines:
|
Does anyone know the significance of the android:authorities? Does it reference something in the plugin's code or can it be anything with no other impacts? I ask because it seems like ".provider" is something that everyone uses. If it can be anything, can it be unique to this plugin? |
Yes, it is used in the code with the FileProvoder. See darryncampbell/darryncampbell-cordova-plugin-intent@767134c which does exactly what you suggest, i.e. making it unique. I have yet to test this in out app, but I assume it will solve the issue. I recommend anyone using the intent plugin to test the new version to see if it solves the issue. |
The thing is I don't use that plugin. The other plugin I use seems to have that code in a compiled SDK because I can't find it in their repo. I wanted to see if we can just change this repo's code. Any suggestions? |
@jasonandress Yes, you can change this repo's code. You need to do the equivalent of what was done in the commit I linked, i.e. change the provider in plugin.xml and change all uses of it in the code. As far as I can see, only AssetUtil.java uses it in this repo:
|
I changed in AssetUtil.java and in plugin.xml provider to LocalNotificationProvider and published in production. Error stoped. |
@ivanov84 thanks for letting us know. I've done the same but have left it in beta testing for a few days. No errors for me either so far. |
adjusting provider name as per katzer/cordova-plugin-local-notifications#1664 to fix nullpointer error
updating references to provider changed in plugin.xml. katzer/cordova-plugin-local-notifications#1664 (comment)
…1772) * Add namespace to provider authority to prevent crashes on Android. See #1664 * Comment out android-sdk requirement since it's not being applied correctly. See #1561 * oreo bug fix, no smallIcon set in notification (#1792) * Update AssetUtil.java Removing Resources.getSystem() to get resource ID because in android 8.1 (physical device) it fire an exception with the DEFALUT_ICON (res://icon) if no smallIcon is set in the notification schedule. Changed also Options.java for small icon fallback * Update Options.java Removed resId = context.getApplicationInfo().icon The application icon is set always and it is not able to select the resId = android.R.drawable.ic_popup_reminder. This is always set (API 1) and not showing ugly as app icon (notification small icon should be a silhouette)
Fix for crash katzer#1664
…atzer#1772) * Add namespace to provider authority to prevent crashes on Android. See katzer#1664 * Comment out android-sdk requirement since it's not being applied correctly. See katzer#1561 * oreo bug fix, no smallIcon set in notification (katzer#1792) * Update AssetUtil.java Removing Resources.getSystem() to get resource ID because in android 8.1 (physical device) it fire an exception with the DEFALUT_ICON (res://icon) if no smallIcon is set in the notification schedule. Changed also Options.java for small icon fallback * Update Options.java Removed resId = context.getApplicationInfo().icon The application icon is set always and it is not able to select the resId = android.R.drawable.ic_popup_reminder. This is always set (API 1) and not showing ugly as app icon (notification small icon should be a silhouette)
WARNING: IF YOU IGNORE THIS TEMPLATE, WE'LL IGNORE YOUR ISSUE. YOU MUST FILL THIS IN!
Provide a general summary of the issue.
Your Environment
Plugin version: 0.9.0-beta3
Platform: Android
OS version: 8.1 / 8.0
Device manufacturer / model: Mostly Pixels
Cordova version (cordova -v): 7.0.1
Cordova platform version (cordova platform ls): cordova-android 6.3.0
Plugin config
Ionic Version (if using Ionic)
Cordova CLI: 7.0.1
Gulp version: CLI version 3.9.1
Gulp local: Local version 3.9.1
Ionic Framework Version: 1.3.5
Ionic CLI Version: 1.7.16
Ionic App Lib Version: 0.7.3
OS:
Node Version: v6.11.0
Expected Behavior
Actual Behavior
After introducing version 0.9.0-beta3, I have been getting thousands of crash reports from Google for devices running Android 8.1. and 8.0 (error attached below). I have tested the app on a Samsung 8 running android 8.1 as well as a few emulators, and I haven't noticed any issues.
I've received one report from a user that they are seeing the Android error that reports that my app has crashed in the background.
Steps to Reproduce
Context
Debug logs
This is the error google has been reporting
java.lang.RuntimeException:
at android.app.ActivityThread.installProvider (ActivityThread.java:5868)
at android.app.ActivityThread.installContentProviders (ActivityThread.java:5457)
at android.app.ActivityThread.handleInstallProvider (ActivityThread.java:2936)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1688)
at android.os.Handler.dispatchMessage (Handler.java:102)
at android.os.Looper.loop (Looper.java:154)
at android.app.ActivityThread.main (ActivityThread.java:6131)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:776)
Caused by: java.lang.NullPointerException:
at android.support.v4.content.FileProvider.parsePathStrategy (FileProvider.java:591)
at android.support.v4.content.FileProvider.getPathStrategy (FileProvider.java:565)
at android.support.v4.content.FileProvider.attachInfo (FileProvider.java:378)
at android.app.ActivityThread.installProvider (ActivityThread.java:5865)
Source code
This is a simplified version of the code I use to set notifications:
The text was updated successfully, but these errors were encountered: