android:需要为显式指定导出< activity>

1l5u6lss  于 2022-12-21  发布在  Android
关注(0)|答案(1)|浏览(446)

我得到错误:

* 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.

虽然我提到了每个活动的android:exported,但我不明白为什么我会得到这个错误。

<?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>

我读到添加一个意图过滤器可以解决这个问题,但是为什么呢?除了AdMob,我不明白为什么,如果是这样,应该添加什么?

2jcobegt

2jcobegt1#

也许你有一个依赖项需要android:exported

相关问题