Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After upgrading to react native 0.66, build of android test fails due to missing android:exported value in androidManifest #3031

Closed
massanen7 opened this issue Oct 21, 2021 · 3 comments

Comments

@massanen7
Copy link

massanen7 commented Oct 21, 2021

Describe the bug

When running "detox build -c android.release && detox test -c android.release" build fails in the step of
> Task :app:processReleaseAndroidTestManifest due to the following error: android/app/build/intermediates/tmp/manifest/androidTest/release/manifestMerger5804382302689770830.xml 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.

  • When I build the app with Android, both from debug and release mode it works without problem
  • I reviewed both AndroidManifest.xml and Merged Manifest, and all the activities, services and receivers have the attribute android:exported="true/false"

Steps To Reproduce

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

  • This are the versions in build.gradle file (I can't compileSdkVersion with lower number)
    buildToolsVersion = "30.0.2" minSdkVersion = 26 compileSdkVersion = 31 targetSdkVersion = 31 ndkVersion = "21.4.7075529"

  • Java version is openjdk11

  1. Followed all the steps of the documentation
  2. Upgraded react native to version 0.66, to have my app compatible with iOS15 and Android 12
  3. When I made everything working, the detox build was failing when running the android:e2e-release script

Expected behavior

  • It should build correctly, like it build correctly when I distribute the app both to testflight and play store.

Detox Trace-Logs

Detox logs yarn run v1.22.17 $ detox build -c android.release && detox test -c android.release detox[65336] INFO: [build.js] cd android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release && cd ..

Configure project :@react-native-cookies_cookies
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01

Configure project :app
Reading env from: .env.production
Reading env from: .env.production
Reading env from: .env.qa
Reading env from: .env.qa

Task :app:bundleReleaseJsAndAssets
warning: the transform cache was reset.
Welcome to Metro!
Fast - Scalable - Integrated

info Writing bundle output to:, /Users/lingodaserver/lingoda/mobile/android/app/build/generated/assets/react/release/index.android.bundle
info Writing sourcemap output to:, /Users/lingodaserver/lingoda/mobile/android/app/build/generated/sourcemaps/react/release/index.android.bundle.map
info Done writing bundle output
info Done writing sourcemap output
info Copying 41 asset files
info Done copying assets

Task :app:bundleReleaseJsAndAssets_SentryUpload_1
Processing react-native sourcemaps for Sentry upload.
Analyzing 2 sources
Rewriting sources
Adding source map references
Uploading sourcemaps for release com.lingoda@1.0+1 distribution 1
Bundled 2 files for upload
Uploaded release files to Sentry
File upload complete (processing pending on server)
Organization: lingoda-gmbh
Project: mobile-app
Release: com.lingoda@1.0+1
Dist: 1

Source Map Upload Report
Minified Scripts
~/index.android.bundle (sourcemap at index.android.bundle.map)
Source Maps
~/index.android.bundle.map

Task :app:generateBundledResourcesHashRelease
5fe17446b55d5414a405359f85908a074f05c82258293627fe7edd5825a66c0e

Task :app:lintVitalRelease
w: Runtime JAR files in the classpath should have the same version. These files were found in the classpath:
/Users/lingodaserver/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.4.10/998caa30623f73223194a8b657abd2baec4880ea/kotlin-stdlib-jdk8-1.4.10.jar (version 1.4)
/Users/lingodaserver/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.4.10/30e46450b0bb3dbf43898d2f461be4a942784780/kotlin-stdlib-jdk7-1.4.10.jar (version 1.4)
/Users/lingodaserver/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.4.10/ea29e063d2bbe695be13e9d044dcfb0c7add398e/kotlin-stdlib-1.4.10.jar (version 1.4)
/Users/lingodaserver/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.4.10/6229be3465805c99db1142ad75e6c6ddeac0b04c/kotlin-stdlib-common-1.4.10.jar (version 1.4)
/Users/lingodaserver/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.5.21/2f537cad7e9eeb9da73738c8812e1e4cf9b62e4e/kotlin-stdlib-1.5.21.jar (version 1.5)
/Users/lingodaserver/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.5.21/cc8bf3586fd2ebcf234058b9440bb406e62dfacb/kotlin-stdlib-common-1.5.21.jar (version 1.5)
w: Some runtime JAR files in the classpath have an incompatible version. Consider removing them from the classpath

Task :app:processReleaseAndroidTestManifest FAILED
/Users/lingodaserver/lingoda/mobile/android/app/build/intermediates/tmp/manifest/androidTest/release/manifestMerger5804382302689770830.xml 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.
/Users/lingodaserver/lingoda/mobile/android/app/build/intermediates/tmp/manifest/androidTest/release/manifestMerger5804382302689770830.xml 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.
/Users/lingodaserver/lingoda/mobile/android/app/build/intermediates/tmp/manifest/androidTest/release/manifestMerger5804382302689770830.xml 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.

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

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:processReleaseAndroidTestManifest'.

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.

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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.9/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 6m 20s
729 actionable tasks: 11 executed, 718 up-to-date
detox[65336] WARN: [build.js]

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.

detox[65336] ERROR: [cli.js] Command failed: cd android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release && cd ..

Device logs (adb logcat)

Device logs (paste logs here)

Screenshots / Video

Environment

  • Detox: 18.22.2
  • React Native: 0.66
  • Node: v12.22.6
  • Device: any emulator, in headless mode, doesn´t matter
  • OS: Android
  • Test-runner (select one): jest
@FadiAboMsalam
Copy link

Same Issue here!

@d4vidi
Copy link
Collaborator

d4vidi commented Oct 24, 2021

Thanks. This sounds like a result of upgrading to Android 12.
Closing in favor of #2899, #3033 (please subscribe to notifications).

@xpt300
Copy link

xpt300 commented Dec 23, 2022

Hi, 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants