Reputation: 43
When I run "react-native run-android" or "npx react-native run-android" or "cd andriod ./gradlew clean" those commands then the errors show
PS D:\work\Myproject-app> npx react-native run-android
info Starting JS server...
Starting a Gradle Daemon, 2 incompatible and 2 stopped Daemons could not be reused, use --status for details
> Configure project :app
Reading env from: .env
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* What went wrong:
A problem occurred evaluating project ':app'.
> A problem occurred starting process 'command 'security''
* 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.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':app'.
> compileSdkVersion is not specified.
* 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
BUILD FAILED in 19s
error Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
error Command failed: gradlew.bat app:installDebug. Run CLI with --verbose flag for more details.
I tried also to use the latest version of Gradle!
OS Windows 10 Node: 14.2.0 Java: java version "1.8.0_251" Java(TM) SE Runtime Environment (build 1.8.0_251-b08) Java HotSpot(TM) 64-Bit Server VM (build 25.251-b08, mixed mode) Gradle version: 5.1.1
JAVA_HOME, ANDROID_HOME, and path added to the environment
Upvotes: 4
Views: 48718
Reputation: 11
I met the same question, but the first answer is too simple. I don't know how to add a getPassword method and where to add.
However, the first answer inspired me. ‘My situation was that the project worked fine on a mac. However, I needed to get it running on a windows system. ’
we should shift right of CLI commands on Windows 10. type 'cmd' to use the command line tool on by right click, choose administrator mode. and try 'yarn react-native run-android' or 'npx react-native run-android' again.
yarn will automatically downloads proper vision of gradle which needs. if you see these changes, let's rock.
Upvotes: 1
Reputation: 66
I don't have enough rep to comment, but....
I ran into this problem today. My situation was that the project worked fine on a mac. However, I needed to get it running on a windows system. Within my android\app\build.gradle file, I setup a getPassword method that would make it easy for me to sign my apk's. Within the getPassword method I had this call:
commandLine 'security', '-q', 'find-generic-password', '-a', currentUser, '-s', keyChain, '-w'
I commented out all of the references to the getPassword method and it started working without a problem.
The root of the problem is that the "security" commandline tool that mac uses isn't available on windows. Since I'm now needing to use a windows box as well, I've configured the passwords within an external credentials file.
Upvotes: 4