I'm trying to upgrade my SDK Version from 30 to 31, and add some android:export="true"
to my manifest but still got error Error: 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.
Here for my manifest
<application
android:name=".app.MyApp"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:usesCleartextTraffic="true"
android:theme="@style/NoActionBar">
<activity android:name=".ui.SplashScreen"
android:exported="true"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:screenOrientation="portrait"
android:exported="false"
android:theme="@style/NoActionBar"
android:windowSoftInputMode="stateHidden"/>
<service
android:name=".firebase.FcmServices"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
What's wrong with my codes? Is there something missing?
CodePudding user response:
It is very simple, You need to set android:exported="true"
in the <service>
tag
CodePudding user response:
Update your service ==> android:exported="true"
<service
android:name=".firebase.FcmServices"
android:exported="true">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>