I have added android:exported="true"
to my only activity in manifest but still getting below error after updating compile sdk and target sdk version to 31.I also tried rebuilding the project , invalidating cache and restart but that didn’t helped
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. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.
AndroidManifest File
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xyz.abc">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:name=".framework.presentation.BaseApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name="com.xyz.presentation.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>
Merged manifest error
Other Manifest Files (Included in merge, but did not contribute any
elements) firebase-installations:17.0.0 manifest,
versionedparcelable:1.1.1 manifest, runtime:1.0.1 manifest,
test:core:1.2.0 manifest, loader:1.0.0 manifest, facebook-share:11.1.0
manifest, leakcanary:leaksentry:2.0-alpha-3 manifest,
material-dialogs:input:3.2.1 manifest, material-icons-extended:1.0.0
manifest, play-services-stats:17.0.0 manifest, interpolator:1.0.0
manifest, activity-compose:1.3.1 manifest, material-ripple:1.0.0
manifest, foundation:1.0.0 manifest, asynclayoutinflater:1.0.0
manifest, savedstate-ktx:1.1.0 manifest,
navigation-dynamic-features-fragment:2.3.5 manifest,
firebase-ui-auth:7.2.0 manifest, animation:1.0.1 manifest,
animation-core:1.0.1 manifest, installreferrer:1.0 manifest,
firebase-crashlytics:18.0.0 manifest, ui:1.0.1 manifest,
lifecycle-viewmodel-savedstate:2.3.1 manifest,
play-services-auth-base:17.0.0 manifest, hilt-android:2.35.1 manifest,
material-dialogs:core:3.2.1 manifest, AndroidManifest.xml navigation
file, savedstate:1.1.0 manifest, cursoradapter:1.0.0 manifest,
sqlite-framework:2.0.1 manifest, room-ktx:2.1.0 manifest,
leakcanary-android-core:2.0-alpha-3 manifest, AndroidManifest.xml
navigation file, media:1.0.0 manifest, coordinatorlayout:1.1.0
manifest, legacy-support-core-utils:1.0.0 manifest,
lifecycle-runtime:2.3.1 manifest, coil-kt:coil:1.3.1 manifest,
ui-tooling-preview:1.0.0 manifest, facebook-core:11.1.0 manifest,
core:1.6.0 manifest, material:1.0.0 manifest, firebase-common:20.0.0
manifest, documentfile:1.0.0 manifest,
lifecycle-viewmodel-compose:2.4.0-beta01 manifest,
play-services-base:17.1.0 manifest, ui-tooling-data:1.0.0 manifest,
coil-base:1.3.1 manifest, firebase-analytics-ktx:19.0.0 manifest,
localbroadcastmanager:1.0.0 manifest, swiperefreshlayout:1.1.0-alpha03
manifest, constraintlayout-compose:1.0.0-beta02 manifest,
core-ktx:1.6.0 manifest, firebase-database-collection:18.0.0 manifest,
coil-compose-base:1.3.1 manifest, activity:1.3.1 manifest,
AndroidManifest.xml navigation file, facebook-messenger:11.1.0
manifest, print:1.0.0 manifest, customview:1.1.0 manifest,
material-icons-core:1.0.0 manifest,
play-services-measurement-sdk:19.0.0 manifest, fragment:1.3.4
manifest, firebase-appcheck-interop:16.0.0-beta01 manifest,
facebook-login:11.1.0 manifest, cardview:1.0.0 manifest,
runtime-rxjava2:1.0.0 manifest, viewpager2:1.0.0 manifest,
play-services-ads-identifier:17.0.0 manifest,
play-services-measurement-impl:19.0.0 manifest,
lifecycle-livedata-core:2.3.1 manifest, play-services-safetynet:17.0.0
manifest, AndroidManifest.xml navigation file,
lifecycle-viewmodel-ktx:2.3.1 manifest, transport-backend-cct:3.0.0
manifest, fragment-ktx:1.2.4 manifest, appcompat:1.3.0 manifest,
transport-runtime:3.0.0 manifest, lifecycle-livedata-core-ktx:2.2.0
manifest, firebase-firestore-ktx:23.0.0 manifest,
legacy-support-v4:1.0.0 manifest, play-services-basement:17.1.1
manifest, firebase-storage:20.0.0 manifest,
play-services-auth-api-phone:17.4.0 manifest,
leakcanary-android:2.0-alpha-3 manifest, firebase-auth-interop:20.0.0
manifest, lifecycle-viewmodel:2.3.1 manifest, browser:1.0.0 manifest,
firebase-auth:21.0.1 manifest, material:1.2.1 manifest,
slidingpanelayout:1.0.0 manifest, vectordrawable:1.1.0 manifest,
recyclerview:1.1.0 manifest, play-services-auth:19.0.0 manifest,
room-runtime:2.1.0 manifest, dagger-lint-aar:2.35.1 manifest,
navigation-dynamic-features-runtime:2.3.5 manifest,
play-services-measurement-api:19.0.0 manifest,
firebase-encoders-json:18.0.0 manifest, sqlite:2.0.1 manifest,
facebook-android-sdk:11.1.0 manifest, firebase-components:17.0.0
manifest, transport-api:3.0.0 manifest,
protolite-well-known-types:18.0.0 manifest, markdown-processor:0.1.3
manifest, play-services-measurement-base:19.0.0 manifest,
firebase-common-ktx:20.0.0 manifest, activity-ktx:1.3.1 manifest,
firebase-crashlytics-ktx:18.0.0 manifest, coil-compose:1.3.1 manifest,
multidex:2.0.1 manifest, core-runtime:2.1.0 manifest,
fragment-testing:1.2.0 manifest, ui-graphics:1.0.1 manifest,
AndroidManifest.xml navigation file, ui-tooling:1.0.0 manifest,
grpc-android:1.28.0 manifest, ui-unit:1.0.1 manifest,
play-services-measurement:19.0.0 manifest, play:core:1.9.1 manifest,
annotation-experimental:1.1.0 manifest,
play-services-measurement-sdk-api:19.0.0 manifest,
play-services-tasks:17.0.0 manifest, firebase-analytics:19.0.0
manifest, facebook-common:11.1.0 manifest, drawerlayout:1.1.1
manifest, AndroidManifest.xml navigation file,
navigation-compose:2.4.0-alpha09 manifest,
facebook-gamingservices:11.1.0 manifest, firebase-firestore:23.0.0
manifest, lifecycle-livedata:2.2.0 manifest,
legacy-support-core-ui:1.0.0 manifest, test:monitor:1.2.0 manifest,
AndroidManifest.xml navigation file, facebook-applinks:11.1.0
manifest, viewpager:1.0.0 manifest, ui-geometry:1.0.1 manifest,
lifecycle-runtime-ktx:2.3.1 manifest, constraintlayout:2.0.4 manifest,
ui-text:1.0.1 manifest, AndroidManifest.xml navigation file,
firebase-installations-interop:17.0.0 manifest, transition:1.3.0
manifest, foundation-layout:1.0.1 manifest, appcompat-resources:1.3.1
manifest, runtime-livedata:1.0.0 manifest, runtime-saveable:1.0.1
manifest, firebase-measurement-connector:19.0.0 manifest,
vectordrawable-animated:1.1.0 manifest, main nav_graph.xml navigation
file Merging Errors: Error: android:exported needs to be explicitly
specified for . Apps targeting Android 12 and higher are
required to specify an explicit value forandroid:exported
when the
corresponding component has an intent filter defined. See
https://developer.android.com/guide/topics/manifest/activity-element#exported
for details. Dairy.app main manifest (this file) Error:
android:exported needs to be explicitly specified for . Apps
targeting Android 12 and higher are required to specify an explicit
value forandroid:exported
when the corresponding component has an
intent filter defined. See
https://developer.android.com/guide/topics/manifest/activity-element#exported
for details. Dairy.app main manifest (this file) Error:
android:exported needs to be explicitly specified for . Apps
targeting Android 12 and higher are required to specify an explicit
value forandroid:exported
when the corresponding component has an
intent filter defined. See
https://developer.android.com/guide/topics/manifest/activity-element#exported
for details. Dairy.app main manifest (this file)
18
Answers
To solve this error in target sdk 31-
1.First of all set target sdk to 30
2.Then go to the merged manifest
3.Find if there’s any activity, service, receiver or provider that does not have
android:exported
set.Override all those entries and set theirandroid:exported
to true or false.4.set target sdk back to 31 and run project
I had this problem, I add
android:exported="true"
and alsotools:node="merge"
toAndroidManifest.xml
but however this error was appeared .I found this is not about my project’s Activates rather is about some dependencies, like this:
so check your project dependencies, you will find it surely.
The following in
app/build.gradle
may be the cause.Solution 1
Update
fragment-testing
to1.4.0-alpha03
or higher.Solution 2
Add the following to
AndroidManifest.xml
.androidx.test:core
library version 1.3.0. Upgrading to version 1.4.0 fixed the issue.This issue originates from dependencies of project. Right click on
intent-filter
and select find usages option. Now, in all usage places check that if exported assigned value or nor. If not, assign a value (Even in cache folders for libraries). This will fix issue until cache refresh but you have identifies the libraries creating this problem.if you use ogury Ads put this in youre AndroidManifest file
if you are using flutter , upgrading
flutter_local_notifications
to the latest version (now is 9.3.2) solved this error for me..See also android:exported needs to be explicitly specified for <activity>. Apps targeting Android 12 and higher are required to specify.
Thanks to @faizy, @Android Developer I made this.
Upgrade these libraries to new versions:
I replaced
debugImplementation
withandroidTestImplementation
in these dependencies.Press
Sync Project with Gradle Files
. Run the project (or rebuild, or runLint
). Probably it won’t help. Then you should make this.targetSdkVersion
to 30.Run the project again. Probably it will compile.
In my case all needed
android:exported="true"
andandroid:exported="false"
presented inactivity
,service
,receiver
andprovider
of mergedAndroidManifest
where<intent-filter>
occured.To find merged
AndroidManifest
, switch toProject
and expandapp
module, then build > intermediates > merged_manifest > debug.If some
android:exported
was missing, find a correspondingAndroidManifest
and add it there.targetSdkVersion
to 31.Run the project again. If it won’t compile, probably you should rebuild the project. As usually, Build > Rebuild Project, File > Invalidate Caches > Invalidate and Restart.
After some time (several gradle syncs, restarts of Android Studio) it compiled.
These steps solve the problem:
targetSdkVersion
if 31 change to 30add line in AndroidManifest inside <activity
android:exported="true"
/>update gradle and gradle tools latest version.
remove fabric imports and tools.
clean and run
I found the answer,
you should add
android:exported="true"
to all activities, services and receivers in the AndroidManifest.xml file as following.and for receiver
android { compileSdk 31
It is important to use latest version of Gradle and Gradle Plugin.
Update your all dependencies to latest version also.
If problem still persists.
android:exported="true"
orandroid:exported="false"
where error was mentioned in merged manifest.Note: Updating that dependency to the latest version will probably also fix that issue. Because in the latest versions of dependencies
exported
properties are already set.Explicitly add the conflicting service to
PropertiesAndroidManifest.xml
file, so that when it is merged in by your plugin it retains theandroid:exported="true"
(or false).In my case the problem was with a dependency that strictly uses version 1.0.0 of
androidx.test.core
, so i can’t upgrade it. what i did is to addandroid:exported="false"
to androidx.test.core activity in my main manifest with tools:node="merge" so it can be merged with origin manifestand add the tools namespace.
for me the solution was to add this tools:node="merge" behind each android:exported="true" and add xmlns:tools="http://schemas.android.com/tools" property in your manifest balise.
The solution is very simple, all you have to do is make sure that all of these tags are present…
just add android:exported="true" to all dont change any thing
and If you do not have any of the tags, you must add them all
Got the solution for this one for Nativescript project. [Tried and Tested]
Search
intent-filter
in the build project directory (./platforms
)Check if each
intent-filter
parent (activity, service, reciever..) have propertyandroid:exported="true"
.If it does not have
android:exported="true"
then copy the whole<service/activity/reciever></service/activity/reciever>
blockand put it into
AndroidMenifest.xml
underApp_resource
folder, updatethe tag with
android:exported="true"
and again build the project.Should Work Now.
if you are using flutter , upgrading flutter_local_notifications to the latest version (now is 9.3.2) may solve this error..
Add these dependencies :