question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

app crashes at launch due to contact permission

See original GitHub issue

I’m having an issue that I found the cause but I couldn’t manage to resolve.

My cordova app crashes on android 8.0.0. I did a logcat which revealed that the app is trying to access contacts.

The weird thing is I have no plugin for contacts nor using contacts in my app.

On the logcat, I have this error:

12-11 17:29:42.094 E/AndroidRuntime( 5609): java.lang.RuntimeException: java.lang.RuntimeException: java.lang.SecurityException: Permission Denial: opening provider com.android.providers.contacts.ContactsProvider2 from ProcessRecord{6155964 5609:com.pierrickmartelliere.UPHAIRR/u0a210} (pid=5609, uid=10210) requires android.permission.READ_CONTACTS or [android.permission.WRITE_CONTACTS]

I tried everything, added

<config-file parent="/manifest" target="AndroidManifest.xml"> <uses-permission android:name="android.permission.READ_CONTACTS" /> <uses-permission android:name="android.permission.WRITE_CONTACTS" /> <uses-permission android:name="android.permission.GET_ACCOUNTS" /> </config-file>

to my config.xml, it adds well on AndroidManifest.xml when building but I still got the error.

I tried both tags uses-permission and uses-permission-sdk as stated here but without luck.

I also tried the cordova-plugin-permission, as in deviceready listener:

var permissions = cordova.plugins.permissions;
    permissions.requestPermission(
      permissions.READ_CONTACTS,
      function(success) {},
      function(error) {}
    );
    permissions.requestPermission(
      permissions.WRITE_CONTACTS,
      function(success) {},
      function(error) {}
    );

But nothing changed. The app crashes before the “deviceready” event is fired so I can do nothing on runtime.

Cordova-android version: 6.2.3

As stated here, if I change the targetSdkVersion to lower than 23 (even 25), the crash disappears, but Im’ not able to upload it to google play anymore since play console doesn’t accept targetSdkVersion < 26.

Also, if I manually authorize contact access from app setting and I force stop and relaunch the app, it works. This is driving me crazy.

Some help on this would be very appreciated.

Thanks to anyone who will take the time to read or answer.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
hAz4rd0uScommented, Dec 16, 2018

Yeah right, Thank you very much for the support 😃

1reaction
janpiocommented, Dec 16, 2018

That is probably a question for the maintainers of the cordova-crosswalk-webview plugin. I have no experience with it (but I think I remember it was deprecated and should not be used any more anyway).

Read more comments on GitHub >

github_iconTop Results From Across the Web

App crashes when changing privacy settings - Apple Developer
I have an application recording audio in background, but when I go to settings and change some permissions like photos, the application crashes...
Read more >
Cordova - android app crashes at launch due to contact ...
My cordova app crashes on android 8.0.0. I did a logcat which revealed that the app is trying to access contacts.
Read more >
View crashes and application not responding (ANR) errors
View crashes and application not responding (ANR) errors · Find your data. Open Play Console. Select an app. · Crashes. This page shows...
Read more >
How to Diagnose App Issues Using Crash Logs - Papertrail
All I have is a method to kickstart the phone call. Not explicitly verifying the user has granted the required permission may lead...
Read more >
Why Do My Apps Keep Crashing on Android? - Avast
Apps can sometimes be corrupted upon initial download, or yours might just need to be updated — reinstalling can address both problems. To ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found