【发布时间】:2020-11-26 10:35:05
【问题描述】:
我已经按照这个 Android 指南进行操作和设置:https://github.com/wix/Detox/blob/master/docs/Introduction.Android.md
这是我在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
}
}
}
我正在使用这个命令行来构建 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
构建后,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
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 ..
【问题讨论】:
-
也许这会有所帮助? - stackoverflow.com/questions/49423572/…
-
我试过了,但仍然没有任何变化,因为例外情况不同
-
我现在意识到
targetInvocationEspresso.json是一个排毒资源。您能否再次检查您是否已将 Detox 集成到您的项目(本机)作为非编译项目(即.aar)?参考this guide -
我已经按照前面提到的指南进行了设置,唯一没有提到的是我在
package.json: "detox": "^17.3.4 中添加了这些排毒库", "detox-expo-helpers": "^0.6.0", "expo-detox-hook": "^1.0.10", -
会不会是重复资源的原因? @d4vidi
标签: android react-native detox