Cannot start android app because one of the tests fail
See original GitHub issueYour Environment
- Plugin version: 0.6.3
- Platform: Android
- OS version: 9
- Device manufacturer and model: Pocophone (Tested on other devices, getting same error)
- Running in Simulator: no
- React Native version: 0.61
- Plugin configuration options:
- Link to your project:
Context
When I run:
react-native run-android --deviceId=<<my device id>>
Console throws the following error and app stops building
com.marianhello.backgroundgeolocation.PostLocationTaskTest > persistTaskShouldRejectAfterShutdown FAILED
java.lang.AssertionError
46 tests completed, 1 failed
> Task :@mauron85_react-native-background-geolocation-common:testDebugUnitTest FAILED
FAILURE: Build failed with an exception.
Expected Behavior
The app should build without a problem
Actual Behavior
Console throws an error and app stops building
Possible Fix
I could track down the issue to the following test:
@Test
public void persistTaskShouldRejectAfterShutdown() {
exception.expect(RejectedExecutionException.class);
LocationDAO mockDAO = mock(LocationDAO.class);
PostLocationTaskListener mockListener = mock(PostLocationTaskListener.class);
PostLocationTask task = new PostLocationTask(mockDAO,mockListener, connectivityListener);
Config config = Config.getDefault();
config.setUrl(TEST_PROTOCOL + "://localhost:3000/locations");
config.setSyncUrl(TEST_PROTOCOL + "://localhost:3000/sync");
task.setConfig(config);
for (int i = 0; i < 10; i++) {
task.add(new BackgroundLocation());
}
task.shutdown();
task.add(new BackgroundLocation());
}
PostLocationsTask.add does not throw the expected error
Steps to Reproduce
- react-native run-android --deviceId=
- Build fails
Context
I cannot continue my app development without commenting persistTaskShouldRejectAfterShutdown
test
Debug logs
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 4265 file(s) to forward-jetify. Using 4 workers...
info Starting JS server...
info Building the app...
> Task :@mauron85_react-native-background-geolocation-common:testDebugUnitTest
com.marianhello.backgroundgeolocation.PostLocationTaskTest > persistTaskShouldRejectAfterShutdown FAILED
java.lang.AssertionError
46 tests completed, 1 failed
> Task :@mauron85_react-native-background-geolocation-common:testDebugUnitTest FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':@mauron85_react-native-background-geolocation-common:testDebugUnitTest'.
> There were failing tests. See the report at: file:///home/mikail/code/undp/app/node_modules/@mauron85/react-native-background-geolocation/android/common/build/reports/tests/testDebugUnitTest/index.html
* 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.5/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 19s
101 actionable tasks: 2 executed, 99 up-to-date
error Failed to build the app. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew build -x lint
at makeError (/home/mikail/code/undp/app/node_modules/execa/index.js:174:9)
at Function.module.exports.sync (/home/mikail/code/undp/app/node_modules/execa/index.js:338:15)
at buildApk (/home/mikail/code/undp/app/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:190:22)
at runOnSpecificDevice (/home/mikail/code/undp/app/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:171:7)
at buildAndRun (/home/mikail/code/undp/app/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:156:12)
at then.result (/home/mikail/code/undp/app/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:125:12)
at process._tickCallback (internal/process/next_tick.js:68:7)
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
Top Results From Across the Web
Run Android instrumented tests fail - Stack Overflow
It basically amounts to unchecking the box next to Run Android instrumented tests using Gradle in the testing settings. This worked for me....
Read more >Android Emulator app test failing with the error ... - Sauce Labs
When tests fail with this error, the response to the POST session ... Original error: Cannot start the 'com.swaglabsmobileapp' application.
Read more >Troubleshoot known issues with Android Emulator
On ChromeOS, Android Virtual Devices (AVDs) might fail to launch because the libnss3 dependency is missing. To launch the AVDs successfully, run ...
Read more >Fix an installed Android app that isn't working - Google Support
Step 1: Restart & update · Step 2: Check for a larger app issue.
Read more >Get started testing for Android with Firebase Test Lab - Google
When you run a test or a set of test cases against devices and configurations you've selected, Test Lab runs the test against...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@jaktonn Yes! I tested without the deviceId and it is working now.
I’m also getting test failures when specifing a device id on the react-native run-android command (
react-native run-android --deviceId=...
), even more than described above. Relevant output isWithout specifying a device id (just running
react-native run-android
), the build is executed successfully though, both with an android simulator as well as a physical device connected. So my assumption is it has something to do with the deviceId parameter. I tried running the command with and without deviceId parameter set with the same phone connected, and it only worked without specifying the device id.