Detox: unable to build android with react native 0.71.1, got error `android:exported needs to be explicitly specified for element `

What happened?

setup android test on a react native (version 0.71.1) app following the instructions. when building the android app regularly, it does not throw this error. ios test works fine as well. keep getting error:

android:exported needs to be explicitly specified for element <activity#androidx.test.core.app.InstrumentationActivityInvoker$BootstrapActivity>. 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.

What was the expected behaviour?

should not throw above error

Was it tested on latest Detox?

  • I have tested this issue on the latest Detox release and it still reproduces.

Did your test throw out a timeout?

Help us reproduce this issue!

No response

In what environment did this happen?

Detox version: 20.1.2 React Native version: 0.71.1 Has Fabric (React Native’s new rendering system) enabled: (yes/no) Node version: 18.11.0 Device model: Android version: Test-runner (select one): jest

Detox logs

Detox logs
npx detox build --configuration android.emu.debug --loglevel trace
cd android ; ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug ; cd -

> Task :app:processDebugAndroidTestManifest FAILED
/Users/emilyxiong/Code/tmp/reactNative711/android/app/build/intermediates/tmp/manifest/androidTest/debug/tempFile1ProcessTestManifest17853538679311875052.xml:27:9-33:20 Error:
        android:exported needs to be explicitly specified for element <activity#androidx.test.core.app.InstrumentationActivityInvoker$BootstrapActivity>. 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.
/Users/emilyxiong/Code/tmp/reactNative711/android/app/build/intermediates/tmp/manifest/androidTest/debug/tempFile1ProcessTestManifest17853538679311875052.xml:34:9-40:20 Error:
        android:exported needs to be explicitly specified for element <activity#androidx.test.core.app.InstrumentationActivityInvoker$EmptyActivity>. 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.
/Users/emilyxiong/Code/tmp/reactNative711/android/app/build/intermediates/tmp/manifest/androidTest/debug/tempFile1ProcessTestManifest17853538679311875052.xml:41:9-47:20 Error:
        android:exported needs to be explicitly specified for element <activity#androidx.test.core.app.InstrumentationActivityInvoker$EmptyFloatingActivity>. 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.

See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.


FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:processDebugAndroidTestManifest'.
> Manifest merger failed with multiple errors, see logs

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
java.lang.StackOverflowError (no error message)

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================

* Get more help at https://help.gradle.org

BUILD FAILED in 9s
37 actionable tasks: 6 executed, 31 up-to-date

Device logs

Device logs
npx detox build --configuration android.emu.debug --record-logs all
cd android ; ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug ; cd -
Starting a Gradle Daemon, 1 stopped Daemon could not be reused, use --status for details

> Task :app:processDebugAndroidTestManifest FAILED
/Users/emilyxiong/Code/tmp/reactNative711/android/app/build/intermediates/tmp/manifest/androidTest/debug/tempFile1ProcessTestManifest12150465681108452725.xml:27:9-33:20 Error:
        android:exported needs to be explicitly specified for element <activity#androidx.test.core.app.InstrumentationActivityInvoker$BootstrapActivity>. 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.
/Users/emilyxiong/Code/tmp/reactNative711/android/app/build/intermediates/tmp/manifest/androidTest/debug/tempFile1ProcessTestManifest12150465681108452725.xml:34:9-40:20 Error:
        android:exported needs to be explicitly specified for element <activity#androidx.test.core.app.InstrumentationActivityInvoker$EmptyActivity>. 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.
/Users/emilyxiong/Code/tmp/reactNative711/android/app/build/intermediates/tmp/manifest/androidTest/debug/tempFile1ProcessTestManifest12150465681108452725.xml:41:9-47:20 Error:
        android:exported needs to be explicitly specified for element <activity#androidx.test.core.app.InstrumentationActivityInvoker$EmptyFloatingActivity>. 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.

See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.


FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:processDebugAndroidTestManifest'.
> Manifest merger failed with multiple errors, see logs

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
java.lang.StackOverflowError (no error message)

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================

* Get more help at https://help.gradle.org

BUILD FAILED in 20s
38 actionable tasks: 3 executed, 35 up-to-date

More data, please!

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 7
  • Comments: 18

Most upvoted comments

This is caused by android.test:core < v1.4.0.

Adding this to android/app/build.gradle fixes for me :

configurations.all {
    resolutionStrategy {
        force 'androidx.test:core:1.5.0'
    }
}

This is still an issue 20.11.1

edit: I cannot see it stated I the original description, however we had Fabric and the new RN Arch enabled. We disabled it and for us this issue then stopped.