將我的應用程式上傳到 google play 商店進行內部測驗后,我收到以下錯誤訊息:
You uploaded an APK or Android App Bundle which has an activity, activity alias, service or broadcast receiver with intent filter, but without the 'android:exported' property set. This file can't be installed on Android 12 or higher. See: developer.android.com/about/versions/12/behavior-changes-12#exported
我試過android:exported="true"在我的清單中設定如下:
<receiver
android:name="com.ryanheise.audioservice.MediaButtonReceiver"
android:exported="true"
>
<intent-filter>
<action android:name="android.intent.action.MEDIA_BUTTON" />
</intent-filter>
</receiver>
但我仍然遇到同樣的錯誤。在我的 build.gradle 檔案中,我有這些配置:
compileSdkVersion 31
minSdkVersion 21
targetSdkVersion 31
buildscript {
ext.kotlin_version = '1.6.10'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.5'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.5.1'
}
}
感覺我什么都試過了。這可能是 SDK 版本問題,還是我在這里遺漏了什么?
uj5u.com熱心網友回復:
什么是出口接收器?
安卓:匯出。廣播接收器是否可以從其應用程式之外的非系統源接收訊息 - 如果可以,則為“true”,如果不能,則為“false”。
您需要在 AndroidManifest.xml 檔案中為每個活動頁面添加匯出的屬性。
例子 :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.nisaefendioglu.weather">
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:usesCleartextTraffic="true"
android:supportsRtl="true"
android:theme="@style/Theme.AppCompat">
<activity android:name="com.nisaefendioglu.weather.view.MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/440827.html
