执行命令react-native run-android时如何解决错误“权限拒绝”?

时间:2018-12-09 18:22:07

标签: android android-studio react-native expo

我想在手机上运行Expokit应用程序,但是当我运行“ react-native run-android”命令时却出现此错误。

Error Image

很明显,我已经研究了解决方法,我看到的答案是添加'android:exported =“ true”',但是它不起作用,我该怎么办?我的AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest
  package="host.exp.exponent"
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:exported="true">

  <permission
    android:name="MY_PACKAGE.permission.C2D_MESSAGE"
    android:protectionLevel="signature"/>

  <!-- These are required permissions to make the app run -->
  <uses-permission android:name="MY_PACKAGE.permission.C2D_MESSAGE" />
  <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  <uses-permission android:name="android.permission.INTERNET" />
  <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
  <uses-permission android:name="android.permission.WAKE_LOCK" />


      <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.MANAGE_DOCUMENTS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.READ_CALENDAR" />
<uses-permission android:name="android.permission.WRITE_CALENDAR" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.anddoes.launcher.permission.UPDATE_COUNT" />
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
<uses-permission android:name="com.google.android.gms.permission.ACTIVITY_RECOGNITION" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="com.htc.launcher.permission.READ_SETTINGS" />
<uses-permission android:name="com.htc.launcher.permission.UPDATE_SHORTCUT" />
<uses-permission android:name="com.majeur.launcher.permission.UPDATE_BADGE" />
<uses-permission android:name="com.sec.android.provider.badge.permission.READ" />
<uses-permission android:name="com.sec.android.provider.badge.permission.WRITE" />
<uses-permission android:name="com.sonyericsson.home.permission.BROADCAST_BADGE" />
<uses-permission android:name="com.android.vending.BILLING" />
      <uses-permission android:name="android.permission.READ_INTERNAL_STORAGE" tools:node="remove" />
<uses-permission android:name="android.permission.READ_SMS" tools:node="remove" />


  <!-- ADD TEST PERMISSIONS HERE -->

  <uses-feature android:glEsVersion="0x00020000" android:required="false" />
  <uses-feature android:name="android.software.leanback" android:required="false" />
  <uses-feature android:name="android.hardware.touchscreen" android:required="false" />

  <application
    android:name=".MainApplication"
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:largeHeap="true"
    android:exported="true">

    <activity
      android:name=".LauncherActivity"
      android:exported="true"
      android:launchMode="singleTask"
      android:screenOrientation="portrait"
      android:theme="@android:style/Theme.Translucent.NoTitleBar">
    </activity>

    <activity
      android:name=".experience.ExperienceActivity"
      android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
      android:theme="@style/Theme.Exponent.Light"
      android:windowSoftInputMode="adjustResize"
      android:exported="true">
    </activity>

    <activity
      android:name=".MainActivity"
      android:launchMode="singleTask"
      android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
      android:theme="@style/Theme.Exponent.Splash"
      android:windowSoftInputMode="adjustResize"
      android:exported="true">
      <intent-filter>
        <action android:name="android.intent.action.MAIN"/>
        <action android:name="android.intent.action.VIEW"/>
        <category android:name="android.intent.category.LAUNCHER"/>
        <category android:name="android.intent.category.DEFAULT"/>
        <category android:name="android.intent.category.BROWSABLE"/>
        <data android:scheme="MY_SCHEME"/>
      </intent-filter>
      <!-- ADD DETACH APP SPECIFIC INTENT FILTERS -->
    </activity>

    <activity
      android:name=".experience.ShellAppActivity"
      android:launchMode="singleTask"
      android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
      android:theme="@style/Theme.Exponent.Splash"
      android:windowSoftInputMode="adjustResize"
      android:exported="true">
      <!-- ADD SHELL INTENT FILTERS HERE -->
      <!-- ADD SHELL SCHEME HERE -->
      <!-- ADD SHELL APP SPECIFIC INTENT FILTERS -->
    </activity>

    <activity
      android:name=".experience.HomeActivity"
      android:label="@string/app_name"
      android:launchMode="singleTask"
      android:screenOrientation="portrait"
      android:theme="@style/Theme.Exponent.Light"
      android:exported="true">
    </activity>

    <activity
      android:name=".experience.TvActivity"
      android:label="@string/app_name"
      android:theme="@style/Theme.Exponent.Light"
      android:screenOrientation="landscape"
      android:exported="true">
     <!-- <intent-filter>
       <action android:name="android.intent.action.MAIN" />
       <category android:name="android.intent.category.LEANBACK_LAUNCHER" />
     </intent-filter> -->
   </activity>



    <activity android:exported="true" android:name="com.facebook.react.devsupport.DevSettingsActivity"/>
    <!-- WHEN_PREPARING_SHELL_REMOVE_FROM_HERE -->
    <!-- ADD DEV SETTINGS HERE -->
    <!-- BEGIN_SDK_31 -->
    <activity android:exported="true" android:name="abi31_0_0.com.facebook.react.devsupport.DevSettingsActivity"/>
    <!-- END_SDK_31 -->
    <!-- BEGIN_SDK_30 -->
    <activity android:exported="true" android:name="abi30_0_0.com.facebook.react.devsupport.DevSettingsActivity"/>
    <!-- END_SDK_30 -->
    <!-- BEGIN_SDK_29 -->
    <activity android:exported="true" android:name="abi29_0_0.com.facebook.react.devsupport.DevSettingsActivity"/>
    <!-- END_SDK_29 -->
    <!-- BEGIN_SDK_28 -->
    <activity android:exported="true" android:name="abi28_0_0.com.facebook.react.devsupport.DevSettingsActivity"/>
    <!-- END_SDK_28 -->
    <!-- BEGIN_SDK_27 -->
    <activity android:exported="true" android:name="abi27_0_0.com.facebook.react.devsupport.DevSettingsActivity"/>
    <!-- END_SDK_27 -->
    <!-- BEGIN_SDK_26 -->
    <activity android:exported="true" android:name="abi26_0_0.com.facebook.react.devsupport.DevSettingsActivity"/>
    <!-- END_SDK_26 -->
    <!-- BEGIN_SDK_25 -->
    <activity android:exported="true" android:name="abi25_0_0.com.facebook.react.devsupport.DevSettingsActivity"/>
    <!-- END_SDK_25 -->
    <!-- WHEN_PREPARING_SHELL_REMOVE_TO_HERE -->

    <activity
      android:name=".ExponentDevActivity"
      android:exported="true"
      android:label="@string/dev_activity_name"
      android:screenOrientation="portrait"
      android:theme="@style/Theme.Exponent.Dark"
      android:windowSoftInputMode="adjustPan">
    </activity>

    <activity
      android:name=".oauth.OAuthWebViewActivity"
      android:screenOrientation="portrait"
      android:theme="@style/Theme.Exponent.Light"
      android:exported="true">
    </activity>

    <activity
        android:name="net.openid.appauth.RedirectUriReceiverActivity"
        tools:node="replace"
        android:exported="true">
      <!-- <intent-filter>
        <action android:name="android.intent.action.VIEW"/>
        <category android:name="android.intent.category.DEFAULT"/>
        <category android:name="android.intent.category.BROWSABLE"/>
        <data android:scheme="MY_PACKAGE" android:path="oauthredirect"/>
      </intent-filter> -->
    </activity>

    <activity
    android:exported="true"
      android:name=".oauth.OAuthResultActivity">
    </activity>

    <!-- START OF STRIPE SCHEMES -->
    <activity
        android:exported="true"
        android:launchMode="singleTask"
        android:name="expo.modules.payments.stripe.RedirectUriReceiver"
        android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen">
        <!-- <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="expo.modules.payments.stripe.28f9ce90-03d1-4b7b-9739-6cfe3bfc6901" />
        </intent-filter> -->
    </activity>
    <!-- Versioned Activity for Stripe -->
    <activity
        android:exported="true"
        android:launchMode="singleTask"
        android:name="abi31_0_0.expo.modules.payments.stripe.RedirectUriReceiver"
        android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen">
        <!-- <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="abi31_0_0.expo.modules.payments.stripe" />
        </intent-filter> -->
    </activity>

    <!-- END OF STRIPE SCHEMES -->

    <activity
      android:exported="true"
      android:name=".chrometabs.ChromeTabsManagerActivity">
    </activity>

    <activity
      android:exported="true"
      android:name=".experience.ErrorActivity"
      android:theme="@style/Theme.Exponent.Dark"
      android:screenOrientation="portrait">
    </activity>

    <activity
      android:exported="true"
      android:name=".experience.InfoActivity"
      android:screenOrientation="portrait"
      android:theme="@style/Theme.Exponent.Light">
    </activity>

    <activity
      android:exported="true"
      android:name="com.facebook.FacebookActivity"
      android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
      android:label="@string/app_name"
      android:theme="@android:style/Theme.Translucent.NoTitleBar"
      tools:replace="android:theme" />

    <activity
      android:exported="true"
      android:name="com.facebook.ads.InterstitialAdActivity"
      android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
      android:label="@string/app_name"
      android:theme="@android:style/Theme.Translucent.NoTitleBar" />

    <service
      android:name=".ExponentIntentService"
      android:exported="true" />

    <!-- Analytics -->
    <receiver
      android:name="host.exp.exponent.referrer.InstallReferrerReceiver"
      android:exported="true">
      <!-- <intent-filter>
        <action android:name="com.android.vending.INSTALL_REFERRER" />
      </intent-filter> -->
    </receiver>

    <!--
    This crashes: https://code.google.com/p/analytics-issues/issues/detail?id=667
    TODO: turn it back on when it's fixed
    <service
      android:name="com.google.android.gms.analytics.CampaignTrackingService"
      android:enabled="true"
      android:exported="false" />-->

    <receiver android:name="com.google.android.gms.analytics.AnalyticsReceiver"
              android:enabled="true">
      <!-- <intent-filter>
        <action android:name="com.google.android.gms.analytics.ANALYTICS_DISPATCH" />
      </intent-filter> -->
    </receiver>

    <service android:name="com.google.android.gms.analytics.AnalyticsService"
             android:enabled="true"
            />

    <!-- GCM -->
    <receiver
      android:name="com.google.android.gms.gcm.GcmReceiver"
      android:exported="true"
      android:permission="com.google.android.c2dm.permission.SEND">
      <!-- <intent-filter>
        <action android:name="com.google.android.c2dm.intent.RECEIVE"/>
        <action android:name="com.google.android.c2dm.intent.REGISTRATION"/>

        <category android:name="MY_PACKAGE"/>
      </intent-filter> -->
    </receiver>

    <service
      android:name=".gcm.ExponentGcmListenerService"
      android:exported="true">
      <!-- <intent-filter>
        <action android:name="com.google.android.c2dm.intent.RECEIVE"/>
      </intent-filter> -->
    </service>
    <service
      android:name=".gcm.ExponentInstanceIDListenerService"
      android:exported="true">
      <!-- <intent-filter>
        <action android:name="com.google.android.gms.iid.InstanceID"/>
      </intent-filter> -->
    </service>
    <service
      android:name=".gcm.GcmRegistrationIntentService"
      android:exported="true">
    </service>

    <!-- FCM -->
    <service
      android:exported="true"
      android:name=".fcm.ExpoFcmMessagingService">
      <!-- <intent-filter>
        <action android:name="com.google.firebase.MESSAGING_EVENT"/>
      </intent-filter> -->
    </service>
    <meta-data
      android:name="com.google.firebase.messaging.default_notification_icon"
      android:resource="@drawable/shell_notification_icon" />
    <meta-data
      android:name="com.google.firebase.messaging.default_notification_color"
      android:resource="@color/colorAccent" />
    <service
      android:name=".fcm.FcmRegistrationIntentService"
      android:exported="true">
    </service>

    <!-- ImagePicker native module -->
    <activity
      android:name="com.theartofdev.edmodo.cropper.CropImageActivity"
      android:theme="@style/Base.Theme.AppCompat"
      android:exported="true">
    </activity>


    <!-- ADD FABRIC CONFIG HERE -->
    <!-- BEGIN FABRIC CONFIG -->
    <meta-data
      android:name="io.fabric.ApiKey"
      android:value="MY_APIKEY"/>
    <!-- END FABRIC CONFIG -->

    <!-- ADD GOOGLE MAPS CONFIG HERE -->
    <!-- BEGIN GOOGLE MAPS CONFIG -->
    <meta-data
      android:name="com.google.android.geo.API_KEY"
      android:value="MY_APIKEY"/>
    <!-- END GOOGLE MAPS CONFIG -->

    <!-- ADD BRANCH CONFIG HERE -->

    <!-- The Facebook SDK runs FacebookInitProvider on startup and crashes if there isn't an ID here -->
    <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="fb0"/>

    <meta-data android:name="standaloneStripeScheme" android:value="MY_VALUE" />
  </application>

</manifest>

Ps:我编辑了敏感数据而不显示它们。

它甚至在AVD中也不起作用,有人可以帮助我吗?

0 个答案:

没有答案