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

Cannot build android with app:assembleAndroidTest - More than one file was found with OS independent path 'targetInvocationEspresso.json' #2258

Closed
baopn97 opened this issue Aug 7, 2020 · 4 comments

Comments

@baopn97
Copy link

baopn97 commented Aug 7, 2020

I've follow and setup exact like this guide for Android: https://github.com/wix/Detox/blob/master/docs/Introduction.Android.md
this is my detox configuration in package.json :

"detox": {
    "configurations": {
      "android": {
        "binaryPath": "android/app/build/outputs/apk/release/app-release.apk",
        "build": "cd android && ./gradlew app:assembleRelease app:assembleAndroidTest -DtestBuildType=release && cd ..",
        "type": "android.emulator",
        "name": "Pixel_3a_XL_API_30"
      }
    },
    "test-runner": "jest",
    "behavior": {
      "init": {
        "launchApp": false
      },
      "cleanup": {
        "shutdownDevice": false
      }
    }
  }

package.json:

"jest": "^26.2.2",
"jest-circus": "^26.0.1",
"jest": {
    "preset": "react-native"
},

and i'm using this commandline to build android:

react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/ && rm -rf android/app/src/main/res/raw/* && detox build -c android

After build, Android throw this exception:

react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/  && rm -rf android/app/src/main/res/raw/* && detox build -c android
warn The following packages use deprecated "rnpm" config that will stop working from next release:
  - react-native-orientation: https://github.com/yamill/react-native-orientation#readme
  - react-native-wheel-datepicker: https://github.com/pinguinjkeke/react-native-wheel-datepicker#readme
Please notify their maintainers about it. You can find more details at https://github.com/react-native-community/cli/blob/master/docs/configuration.md#migration-guide.
Loading dependency graph...warn The following packages use deprecated "rnpm" config that will stop working from next release:
  - react-native-orientation: https://github.com/yamill/react-native-orientation#readme
  - react-native-wheel-datepicker: https://github.com/pinguinjkeke/react-native-wheel-datepicker#readme
Please notify their maintainers about it. You can find more details at https://github.com/react-native-community/cli/blob/master/docs/configuration.md#migration-guide.
Loading dependency graph, done.
Loading dependency graph...info Writing bundle output to:, android/app/src/main/assets/index.android.bundle
info Done writing bundle output
info Copying 618 asset files
info Done copying assets
zsh: sure you want to delete all 16 files in /Users/baopn/Documents/bitbucket/academy-mobile/android/app/src/main/res/raw [yn]? y
detox[31002] INFO:  [build.js] cd android && ./gradlew app:assembleRelease app:assembleAndroidTest -DtestBuildType=release && cd ..
Configuration on demand is an incubating feature.

> Configure project :app
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)

> Configure project :react-native-wheel-datepicker
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

> Configure project :react-native-orientation
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

> Configure project :react-native-firebase
react-native-firebase: using React Native prebuilt binary from /Users/baopn/Documents/bitbucket/academy-mobile/node_modules/react-native/android

> Task :app:processReleaseGoogleServices
Parsing json file: /Users/baopn/Documents/bitbucket/academy-mobile/android/app/google-services.json

> Task :app:processReleaseManifest
/Users/baopn/Documents/bitbucket/academy-mobile/android/app/src/main/AndroidManifest.xml:15:9-25:20 Warning:
        provider#cl.json.RNShareFileProvider@android:authorities was tagged at AndroidManifest.xml:15 to replace other declarations but no other declaration present
/Users/baopn/Documents/bitbucket/academy-mobile/android/app/src/main/AndroidManifest.xml Warning:
        meta-data#android.support.FILE_PROVIDER_PATHS@android:resource was tagged at AndroidManifest.xml:0 to replace other declarations but no other declaration present
/Users/baopn/Documents/bitbucket/academy-mobile/android/app/src/main/AndroidManifest.xml:24:9-31:50 Warning:
        activity#com.google.firebase.auth.internal.FederatedSignInActivity@android:launchMode was tagged at AndroidManifest.xml:24 to replace other declarations but no other declaration present

> Task :app:transformResourcesWithMergeJavaResForReleaseAndroidTest FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformResourcesWithMergeJavaResForReleaseAndroidTest'.
> More than one file was found with OS independent path 'targetInvocationEspresso.json'

* 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 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 17s
541 actionable tasks: 10 executed, 531 up-to-date
detox[31002] ERROR: [cli.js] Error: Command failed: cd android && ./gradlew app:assembleRelease app:assembleAndroidTest -DtestBuildType=release && cd ..
@baopn97
Copy link
Author

baopn97 commented Aug 7, 2020

@LeoNatan leon @d4vidi can someone please take a look at this issue? Thanks

@support
Copy link

support bot commented Aug 10, 2020

We use the issue tracker exclusively for bug reports and feature requests. This issue appears to be a general usage or support question. Instead, please ask a question on Stack Overflow with the detox tag.

Feel free to post your Stack Overflow question here for more visibility. We'll take a look at it.

For issues with Expo apps, it is most likely not an issue with Detox itself, but with the Expo runtime or with incorrect Detox setup. For support on how to use Detox with Expo, you should contact the Expo team or the Expo community.

For more information on bots in this repository, read this discussion.

@support support bot closed this as completed Aug 10, 2020
@d4vidi
Copy link
Collaborator

d4vidi commented Aug 10, 2020

@baopn97 seems you're having trouble with building your app. With your existing Detox configuration, try to build using detox build -c android instead of using the react-native bundle command. Otherwise please post this on Stackoverflow post the link back here.

@baopn97
Copy link
Author

baopn97 commented Aug 10, 2020

@baopn97 seems you're having trouble with building your app. With your existing Detox configuration, try to build using detox build -c android instead of using the react-native bundle command. Otherwise please post this on Stackoverflow post the link back here.

I've always use command detox build -c android but the issue occured anyways, i assume that there are duplicate configuration inside my project? I've update stackoverflow link:
https://stackoverflow.com/questions/63278921/cannot-build-android-with-appassembleandroidtest-more-than-one-file-was-found

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

3 participants