Repository: wix/Detox

Issue #3867: unable to build android with react native 0.71.1, got error `android:exported needs to be explicitly specified for element `
Created: 2023-01-23T21:58:49Z
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?

 I have followed the instructions under Identifying which synchronization mechanism causes us to wait too much.

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

Duplicate issue #4082: Task :app:processDebugAndroidTestManifest FAILED Error for Android Build with Detox
Created: 2023-05-22T20:34:47Z
What happened?
When I run the detox build command for android I get the below error
 % detox build --configuration android.emu.debug --debug
cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug


> Configure project :react-native-flipper
WARNING:Software Components will not be created automatically for Maven publishing from Android Gradle Plugin 8.0. To opt-in to the future behavior, set the Gradle property android.disableAutomaticComponentCreation=true in the `gradle.properties` file or use the new publishing DSL.

> Configure project :react-native-quick-base64
react-native-quick-base64: node_modules/ found at: /Users/<username>/repos/<repo_name>/node_modules

> Configure project :react-native-reanimated
AAR for react-native-reanimated has been found
/Users/<username>/repos/<repo_name>/node_modules/react-native-reanimated/android/react-native-reanimated-71-hermes.aar

> Task :app:processDebugAndroidTestManifest FAILED
/Users/<username>/repos/<repo-name>/app/<app_name>/android/app/build/intermediates/tmp/manifest/androidTest/debug/tempFile1ProcessTestManifest4246039871275064926.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/<username>/repos/<repo-name>/app/<app_name>/android/app/build/intermediates/tmp/manifest/androidTest/debug/tempFile1ProcessTestManifest4246039871275064926.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/<username>/repos/<repo-name>/app/<app_name>/android/app/build/intermediates/tmp/manifest/androidTest/debug/tempFile1ProcessTestManifest4246039871275064926.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 https://developer.android.com/r/studio-ui/build/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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 16s
716 actionable tasks: 21 executed, 695 up-to-date


Important: 'detox build' is a convenience shortcut for calling your own build command, as provided in the config file.
Failures in this build command are not the responsibility of Detox. You are responsible for maintaining this command.

Command failed: cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug


What was the expected behaviour?
No response
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?

 I have followed the instructions under Identifying which synchronization mechanism causes us to wait too much.

Help us reproduce this issue!
No response
In what environment did this happen?
Detox version: 20.9
React Native version: 0.71.8
Has Fabric (React Native's new rendering system) enabled: (yes/no) no
Node version: 16.20.0
Device model: Emulator
Android version:
Test-runner (select one): jest / other jest
Detox logs
Detox logs
% detox build --configuration android.emu.debug --debug
cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug

> Configure project :react-native-flipper
WARNING:Software Components will not be created automatically for Maven publishing from Android Gradle Plugin 8.0. To opt-in to the future behavior, set the Gradle property android.disableAutomaticComponentCreation=true in the `gradle.properties` file or use the new publishing DSL.

> Configure project :react-native-quick-base64
react-native-quick-base64: node_modules/ found at: /Users/<username>/repos/<repo_name>/node_modules

> Configure project :react-native-reanimated
AAR for react-native-reanimated has been found
/Users/<username>/repos/<repo_name>/node_modules/react-native-reanimated/android/react-native-reanimated-71-hermes.aar

> Task :app:processDebugAndroidTestManifest FAILED
/Users/<username>/repos/<repo-name>/app/<app_name>/android/app/build/intermediates/tmp/manifest/androidTest/debug/tempFile1ProcessTestManifest4246039871275064926.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/<username>/repos/<repo-name>/app/<app_name>/android/app/build/intermediates/tmp/manifest/androidTest/debug/tempFile1ProcessTestManifest4246039871275064926.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/<username>/repos/<repo-name>/app/<app_name>/android/app/build/intermediates/tmp/manifest/androidTest/debug/tempFile1ProcessTestManifest4246039871275064926.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 https://developer.android.com/r/studio-ui/build/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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 16s
716 actionable tasks: 21 executed, 695 up-to-date


Important: 'detox build' is a convenience shortcut for calling your own build command, as provided in the config file.
Failures in this build command are not the responsibility of Detox. You are responsible for maintaining this command.

Command failed: cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug```

</details>

### Device logs

<details><summary>Device logs</summary>


N/A

</details>

### More data, please!

_No response_

Closing comment (2023-05-28T14:39:03Z): Duplicate of #3867