react-native-encrypted-storage icon indicating copy to clipboard operation
react-native-encrypted-storage copied to clipboard

Android build fails for AndroidTest with processDebugAndroidTestManifest FAILED w/ RN 0.69.7

Open killuhwhale opened this issue 2 years ago • 8 comments

I'm trying to use Detox for e2e tests and have failed to setup Detox with my project. I keep getting a build failure regarding react-native-encrypted-storage when running the gradle assembleAndroidTest command.

I execute: detox build --configuration android.emu.debug which executes: ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug

Versions: "react-native": "0.69.7", "react-native-encrypted-storage": "^4.0.3",

The following command fails: ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug

With the following message:

Task :react-native-encrypted-storage:processDebugAndroidTestManifest FAILED /home/killuh/ws_p38/fitform/FitForm/node_modules/react-native-encrypted-storage/android/build/intermediates/tmp/manifest/androidTest/debug/tempFile1ProcessTestManifest11953716120453094683.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. /home/killuh/ws_p38/fitform/FitForm/node_modules/react-native-encrypted-storage/android/build/intermediates/tmp/manifest/androidTest/debug/tempFile1ProcessTestManifest11953716120453094683.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. /home/killuh/ws_p38/fitform/FitForm/node_modules/react-native-encrypted-storage/android/build/intermediates/tmp/manifest/androidTest/debug/tempFile1ProcessTestManifest11953716120453094683.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 failed with an exception. The following commands work to build the app on emulator or physical device: npx react-native run-android cd android/ && ./gradlew clean && ./gradlew bundleRelease && cd .. && npx react-native run-android --variant=release

However, ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug continues to fail.

Any help would be greatly appreciated, thanks!

Edit: For anyone else that may run into this issue, I used rn-secure-storage instead, which solved the issue and took 2 mins.

killuhwhale avatar Feb 22 '23 07:02 killuhwhale

I have the same issue with detox v18.1.0, react-native v.70.6 and react-native-encrypted-storage v4.0.2. Any feedback would be appreciated. I would prefer NOT to change storage libraries. Thank you!

mfelix5 avatar Mar 06 '23 19:03 mfelix5

+1

yannick-softwerft avatar Mar 08 '23 16:03 yannick-softwerft

There are no activities in the library that I could find. I think this error refers to an outdated test library. I had this issue. Working after upgrading 'androidx.test.ext:junit' to version '1.1.5'.

androidTestImplementation 'androidx.test.ext:junit:1.1.5'

In libraries build.gradle folder.

px-amaac avatar Mar 13 '23 23:03 px-amaac

@px-amaac could you clarify exactly where you have added this line to fix the issue? In my case, adding androidTestImplementation 'androidx.test.ext:junit:1.1.5' in android/app/build.gradle under dependencies before or after the androidTestImplementation('com.wix:detox:+') line does NOT change the behavior for me.

mfelix5 avatar Mar 14 '23 13:03 mfelix5

Actually, @px-amaac , I now understand what you found. The required update is in the build.gradle file in node_modules/react-native-encrypted-storage/android.

mfelix5 avatar Mar 14 '23 13:03 mfelix5

Here is the open PR: https://github.com/emeraldsanto/react-native-encrypted-storage/pull/81

mfelix5 avatar Mar 14 '23 13:03 mfelix5

Here is a new PR that solves this issue: https://github.com/emeraldsanto/react-native-encrypted-storage/pull/115

mfelix5 avatar Apr 20 '23 16:04 mfelix5

Can we get the PR merged? My android build is failing as well, I'm on RN 72