简体   繁体   中英

android:exported needs to be explicitly specified for <activity>

I get the error:

* What went wrong:
Execution failed for task ':app:processEmbedNoRecordReleaseMainManifest'.
> Manifest merger failed : android:exported needs to be explicitly specified for <activity>. Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported` when the corresponding component has an intent filter defined.

While I mentioned android:exported for each activity, I don't understand why I'm getting this error. Here is the manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest
    package="org.love2d.android.executable"
    xmlns:android="http://schemas.android.com/apk/res/android" >
  <uses-permission android:name="android.permission.INTERNET" />
  <uses-permission android:name="android.permission.VIBRATE" />
  <uses-permission android:name="android.permission.BLUETOOTH" />
  <uses-permission android:name="android.permission.RECORD_AUDIO" />
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18" />

  <!-- OpenGL ES 2.0 -->
  <uses-feature android:glEsVersion="0x00020000" />
  <!-- Touchscreen support -->
  <uses-feature android:name="android.hardware.touchscreen" android:required="false" />
  <!-- Game controller support -->
  <uses-feature android:name="android.hardware.bluetooth" android:required="false" />
  <uses-feature android:name="android.hardware.gamepad" android:required="false" />
  <uses-feature android:name="android.hardware.usb.host" android:required="false" />
  <!-- External mouse input events -->
  <uses-feature android:name="android.hardware.type.pc" android:required="false" />
  <!-- Low latency audio -->
  <uses-feature android:name="android.hardware.audio.low_latency" android:required="false" />
  <uses-feature android:name="android.hardware.audio.pro" android:required="false" />

  <application
      android:allowBackup="true"
      android:icon="@drawable/love"
      android:label="Game Test"
      android:usesCleartextTraffic="true" >
    <activity
        android:name="org.love2d.android.GameActivity"
        android:exported="true"
        android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|keyboard|keyboardHidden|navigation"
        android:label="Game Test"
        android:launchMode="singleTask"
        android:screenOrientation="landscape"
        android:resizeableActivity="false"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
        <intent-filter>
          <action android:name="android.intent.action.MAIN" />
          <category android:name="android.intent.category.LAUNCHER" />
          <category android:name="tv.ouya.intent.category.GAME" />
        </intent-filter>
        <intent-filter>
          <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
        </intent-filter>
      </activity>

      <!--Needed by AdMob-->
      <activity
        android:name="com.google.android.gms.ads.AdActivity"
        android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
        android:exported="false">
      </activity>
    </application>
</manifest>

I read that adding an intent filter could solve the problem but where is why? Apart from AdMob I don't see why and if so what should be added?

It maybe you have a dependency that needs to have android:exported

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM