skip to Main Content

I recently updated my projects build.gradle to target Android SDK 32 with the statements:
compileSdkVersion 32
targetSdkVersion 32

After this process, I am now unable to Rebuild my project and have it run on my mobile device.
The manifest merger process gives this error:

Error:
android:exported needs to be explicitly specified for . 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.

Execution failed for task ‘:app:processDebugMainManifest’.

Despite adding the ` android:exported=”false” ` property to each activity in my manifest the project is still failing to rebuild.
I tried to comment out all the activities in the manifest and to only leave the LauncherActivity but to my surprise the same error keeps popping up.

If anyone has come across this problem after updating to Android 12 SDK please help out!!
Running Android Studio Arctic Fox 2020.3.1 Patch 4

**EDIT 1**

Tried out solutions and suggested comments on [this S/O thread][1]

2

Answers


  1. Chosen as BEST ANSWER

    After upgrading my Android Studio to Bumblebee, I was able to get a much more descriptive error message that pointed out the missing attributes for the services and activities.

    To my surprise, the Activities and Service were from a USSD automation library we use called Hover. I've had to override these and declare them manually in our Manifest to add the missing android:exported attribute. These are the affected Hover components in the error message:

    <service#com.hover.sdk.requests.HoverAccessibilityService>
    <activity#com.hover.sdk.api.SessionActivity>
    <activity#com.hover.sdk.permissions.PermissionActivity>
    

    These have to be implicitly defined in your Manifest.


  2. It’s probably one of your dependencies’ manifest.

    Check your merged manifest (there is a tab for that in the IDE if you open your manifest file) and see what component is missing the export property.

    Once you identified the library, you can update it to it’s latest version.

    If the library is already updated to its latest version, you can manually override their manifest item and fix it temporarily until they release a fix.

    I’ll update my answer soon with an example.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search