android java.lang.SecurityException:权限拒绝:启动Intent React Native

ldioqlga  于 2023-08-01  发布在  Android
关注(0)|答案(1)|浏览(192)

我使用的是react native 0.69.2。
我的项目中有一个活动,我想将其设置为android:exported='false',但在构建时,我收到一个错误“java.lang.SecurityException:权限拒绝:启动Intent".`

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>

<application
  android:name=".MainApplication"
  android:label="@string/app_name"
  android:icon="@mipmap/ic_launcher"
  android:roundIcon="@mipmap/ic_launcher_round"
  android:allowBackup="false"
  android:theme="@style/AppTheme">
  <activity
    android:name=".MainActivity"
    android:label="@string/app_name"
    android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
    android:launchMode="singleTask"
    android:windowSoftInputMode="adjustResize"
    android:screenOrientation="portrait"
    android:exported="false">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>`

字符串
第一个月

nx7onnlm

nx7onnlm1#

每当您尝试启动未导出的Activity时,您都会得到java.lang.SecurityException: Permission Denial: starting Intent。不能将android:exported=false设置为启动器活动。如果您这样做,那么您的应用程序将无法从应用程序抽屉中启动。
有关更多信息,请查看此doc

相关问题