![](/img/trans.png)
[英]android:exported needs to be explicitly specified for <activity>
[英]android:exported needs to be explicitly specified for <activity>
我進行了很多探索,發現在所有活動中我們需要指定 android:exported 參數。 我已在清單中的所有活動中添加了參數,但我仍然收到此錯誤。
清單合並失敗:android:需要為 <activity> 顯式指定導出。 當相應組件定義了意圖過濾器時,需要針對 Android 12 及更高版本的應用程序為
android:exported
指定顯式值。 有關詳細信息,請參閱https://developer.android.com/guide/topics/manifest/activity-element#exported 。
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.soptle">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:roundIcon="@drawable/icon"
android:usesCleartextTraffic="true"
android:supportsRtl="true"
android:theme="@style/Theme.Soptle">
<activity
android:name=".ManufacturerDetailsActivity"
android:exported="true" />
<activity
android:name=".NotificationActivity"
android:exported="true" />
<activity
android:name=".SearchActivity"
android:exported="true" />
<activity
android:name=".UpdateUserInfoActivity"
android:exported="true" />
<activity
android:name=".OTPverificationActivity"
android:exported="true" />
<activity
android:name=".ViewAllActivity"
android:exported="true" />
<activity
android:name=".MyAddressesActivity"
android:exported="true" />
<activity
android:name=".AddAddressActivity"
android:exported="true" />
<activity
android:name=".DeliveryActivity"
android:exported="true" />
<activity
android:name=".OrderDetailsActivity"
android:exported="true" />
<activity
android:name=".ProductDetailsActivity"
android:exported="true" />
<activity
android:name=".CategoryActivity"
android:exported="true" />
<activity
android:name=".HomeActivity"
android:exported="true"
android:label="@string/title_activity_home"
android:screenOrientation="portrait"
android:theme="@style/Theme.Soptle.NoActionBar" />
<activity
android:name=".MainActivity"
android:exported="true"
android:screenOrientation="portrait"
android:theme="@style/Theme.SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".RegisterActivity"
android:exported="true"
android:screenOrientation="portrait" />
<meta-data
android:name="preloaded_fonts"
android:exported="true"
android:resource="@array/preloaded_fonts" />
</application>
</manifest>
在清單中使用意圖過濾器將 android:exported="true" 添加到活動中。xml 為我解決了問題
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.