React-native-navigation: [V1]Tried to use permissions api while not attached to an activity

Created on 12 Feb 2019  ·  2Comments  ·  Source: wix/react-native-navigation

Tried to use permissions api while not attached to an activity

I've got this error. Problem occurs only on release apk & when app starts and location permission dialog appears and when giving location permission access then app crashes and when starting app again then no app crashes. I'm using react native maps

java.lang.RuntimeException · Failure delivering result ResultInfo{who=@android:requestPermissions:, request=0, result=-1, data=Intent { act=android.content.pm.action.REQUEST_PERMISSIONS launchParam=MultiScreenLaunchParams { mDisplayId=0 mBaseDisplayId=0 mFlags=0 } (has extras) }} to activity {com.minderapps.minder/com.reactnativenavigation.controllers.NavigationActivity}: java.lang.IllegalStateException: Tried to use permissions API while not attached to an Activity.

``` package="com.indulgeeapp"
xmlns:tools="http://schemas.android.com/tools"
>

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<application
  android:name=".MainApplication"
  android:label="@string/app_name"
  android:icon="@mipmap/ic_notification"
  android:allowBackup="false"
  android:theme="@style/AppTheme">
  <uses-library android:name="org.apache.http.legacy" android:required="false"/>
  <activity
    android:name=".MainActivity"
    android:label="@string/app_name"
    android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
    android:windowSoftInputMode="adjustResize">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
  </activity>
  <service android:name="io.invertase.firebase.messaging.RNFirebaseMessagingService">
    <intent-filter>
      <action android:name="com.google.firebase.MESSAGING_EVENT" />
    </intent-filter>
  </service>
  <service
    android:name="com.robinpowered.react.Intercom.IntercomIntentService"
    android:exported="false">
  <intent-filter android:priority="999">
      <action android:name="com.google.android.c2dm.intent.RECEIVE"/>
  </intent-filter>
  </service>
<receiver
  android:name="io.intercom.android.sdk.push.IntercomPushBroadcastReceiver"
  tools:replace="android:exported"
  android:exported="true" />
  <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
  <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
  <meta-data
    android:name="com.google.android.geo.API_KEY"
    android:value="google_api_key"/>
  <meta-data
    android:name="com.google.firebase.messaging.default_notification_icon"
    android:resource="@mipmap/ic_notification" />
</application>


```


Environment

  • React Native Navigation version: v1
  • React Native version: 0.58.3
  • Platform(s) (iOS, Android, or both?): Android
  • Device info (Simulator/Device? OS version? Debug/Release?): Only causes issue on Release apk, Debug apk is running fine

Most helpful comment

@IanOnFire see my pull request here. hope it will fix the issue. #4740

All 2 comments

Experiencing the same issue...
Pretty sure this is related to https://github.com/wix/react-native-navigation/issues/3316.
Unfortunately no solution yet..

@IanOnFire see my pull request here. hope it will fix the issue. #4740

Was this page helpful?
0 / 5 - 0 ratings