Cli: Task 'installDebug' not found in project ':app'

Created on 28 Mar 2020  ยท  6Comments  ยท  Source: react-native-community/cli

Hi guys, I'm getting getting error below when trying to init a new project:

BUILD FAILED in 1s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

  • What went wrong:
    Task 'installDebug' not found in project ':app'.

  • Try:
    Run gradlew tasks to get a list of available tasks. 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 1s

at makeError (/Users/XXXXXXX/Development/mrpos/androidDemo/node_modules/execa/index.js:174:9)
at Promise.all.then.arr (/Users/XXXXXXX/Development/mrpos/androidDemo/node_modules/execa/index.js:278:16)
at process._tickCallback (internal/process/next_tick.js:68:7)
bug report

Most helpful comment

Hi,

after fix the ANDROID_HOME environmental variable.

======================================================================
Common
โœ“ Node.js
โœ“ yarn
โœ“ Watchman - Used for watching changes in the filesystem when in development mode

Android
โœ“ ANDROID_HOME
โœ“ Android SDK - Required for building and installing your app on Android

iOS
โœ“ Xcode - Required for building and installing your app on iOS
โœ“ CocoaPods - Required for installing iOS dependencies
โœ“ ios-deploy - Required for installing your app on a physical device with the CLI

Errors: 0

Warnings: 0

when run react-native run-android the app has stopped.

terminal show below info :
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 962 file(s) to forward-jetify. Using 16 workers...
info JS server already running.
info Installing the app...

Task :app:stripDebugDebugSymbols UP-TO-DATE
Compatible side by side NDK version was not found.

Task :app:installDebug
10:00:21 V/ddms: execute: running am get-config
10:00:21 V/ddms: execute 'am get-config' on '192.168.56.103:5555' : EOF hit. Read: -1
10:00:21 V/ddms: execute: returning
Installing APK 'app-debug.apk' on 'Custom Tablet - 4.1.1' for app:debug
10:00:21 D/app-debug.apk: Uploading app-debug.apk onto device '192.168.56.103:5555'
10:00:21 D/Device: Uploading file onto device '192.168.56.103:5555'
10:00:21 D/ddms: Reading file permision of /Users/XXXXXXX/Development/mrpos/androidDemo/android/app/build/outputs/apk/debug/app-debug.apk as: rw-r--r--
10:00:21 V/ddms: execute: running pm install -r -t "/data/local/tmp/app-debug.apk"
10:00:23 V/ddms: execute 'pm install -r -t "/data/local/tmp/app-debug.apk"' on '192.168.56.103:5555' : EOF hit. Read: -1
10:00:23 V/ddms: execute: returning
10:00:23 V/ddms: execute: running rm "/data/local/tmp/app-debug.apk"
10:00:23 V/ddms: execute 'rm "/data/local/tmp/app-debug.apk"' on '192.168.56.103:5555' : EOF hit. Read: -1
10:00:23 V/ddms: execute: returning
Installed on 1 device.

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.0.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 4s
27 actionable tasks: 2 executed, 25 up-to-date
info Connecting to the development server...
adb: error: closed
warn Failed to connect to development server using "adb reverse": Command failed: adb -s 192.168.56.103:5555 reverse tcp:8081 tcp:8081
info Starting the app on "192.168.56.103:5555"...
Starting: Intent { cmp=com.androiddemo/.MainActivity }

Another I found out is that this happened to genymotion simulator.

Whereas the simulator automatically run by react-native rund-android(Android Studio) works ok.

All 6 comments

Can you run npx react-native info and npx react-native doctor and paste the output here?

hi,
npx react-native info:
System:
OS: macOS 10.15.3
CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
Memory: 459.27 MB / 32.00 GB
Shell: 3.2.57 - /bin/sh
Binaries:
Node: 10.16.0 - /usr/local/bin/node
Yarn: 1.16.0 - /usr/local/bin/yarn
npm: 6.9.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
Android SDK:
API Levels: 23, 26, 27, 28, 29
Build Tools: 23.0.1, 26.0.1, 27.0.3, 28.0.3, 29.0.0
System Images: android-26 | Google Play Intel x86 Atom, android-28 | Intel x86 Atom_64
Android NDK: Not Found
IDEs:
Android Studio: 3.4 AI-183.6156.11.34.5522156
Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild
Languages:
Python: 2.7.17 - /usr/local/bin/python
npmPackages:
@react-native-community/cli: Not Found
react: 16.11.0 => 16.11.0
react-native: 0.62.0 => 0.62.0
npmGlobalPackages:
react-native: Not Found

npx react-native doctor:
Common
โœ“ Node.js
โœ“ yarn
โœ“ Watchman - Used for watching changes in the filesystem when in development mode

Android
โœ– ANDROID_HOME
โœ“ Android SDK - Required for building and installing your app on Android

iOS
โœ“ Xcode - Required for building and installing your app on iOS
โœ“ CocoaPods - Required for installing iOS dependencies
โ— ios-deploy - Required for installing your app on a physical device with the CLI

Errors: 1
Warnings: 1

Fix your ANDROID_HOME environmental variable.

Hi,

after fix the ANDROID_HOME environmental variable.

======================================================================
Common
โœ“ Node.js
โœ“ yarn
โœ“ Watchman - Used for watching changes in the filesystem when in development mode

Android
โœ“ ANDROID_HOME
โœ“ Android SDK - Required for building and installing your app on Android

iOS
โœ“ Xcode - Required for building and installing your app on iOS
โœ“ CocoaPods - Required for installing iOS dependencies
โœ“ ios-deploy - Required for installing your app on a physical device with the CLI

Errors: 0

Warnings: 0

when run react-native run-android the app has stopped.

terminal show below info :
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 962 file(s) to forward-jetify. Using 16 workers...
info JS server already running.
info Installing the app...

Task :app:stripDebugDebugSymbols UP-TO-DATE
Compatible side by side NDK version was not found.

Task :app:installDebug
10:00:21 V/ddms: execute: running am get-config
10:00:21 V/ddms: execute 'am get-config' on '192.168.56.103:5555' : EOF hit. Read: -1
10:00:21 V/ddms: execute: returning
Installing APK 'app-debug.apk' on 'Custom Tablet - 4.1.1' for app:debug
10:00:21 D/app-debug.apk: Uploading app-debug.apk onto device '192.168.56.103:5555'
10:00:21 D/Device: Uploading file onto device '192.168.56.103:5555'
10:00:21 D/ddms: Reading file permision of /Users/XXXXXXX/Development/mrpos/androidDemo/android/app/build/outputs/apk/debug/app-debug.apk as: rw-r--r--
10:00:21 V/ddms: execute: running pm install -r -t "/data/local/tmp/app-debug.apk"
10:00:23 V/ddms: execute 'pm install -r -t "/data/local/tmp/app-debug.apk"' on '192.168.56.103:5555' : EOF hit. Read: -1
10:00:23 V/ddms: execute: returning
10:00:23 V/ddms: execute: running rm "/data/local/tmp/app-debug.apk"
10:00:23 V/ddms: execute 'rm "/data/local/tmp/app-debug.apk"' on '192.168.56.103:5555' : EOF hit. Read: -1
10:00:23 V/ddms: execute: returning
Installed on 1 device.

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.0.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 4s
27 actionable tasks: 2 executed, 25 up-to-date
info Connecting to the development server...
adb: error: closed
warn Failed to connect to development server using "adb reverse": Command failed: adb -s 192.168.56.103:5555 reverse tcp:8081 tcp:8081
info Starting the app on "192.168.56.103:5555"...
Starting: Intent { cmp=com.androiddemo/.MainActivity }

Another I found out is that this happened to genymotion simulator.

Whereas the simulator automatically run by react-native rund-android(Android Studio) works ok.

Found this issue is related to solution. I just got to make sure the version of my Android API is compatible. Hope this could help someone facing the same issue.

I solved it by configuring a local file, inside android /
Archive:
local.properties
Content:
sdk.dir = PATH_ANDROID_SDK
Content example:
sdk.dir = / home / my_user / Android / Sdk

Or in the same way, setting the environment variable $ ANDROID_HOME

Was this page helpful?
0 / 5 - 0 ratings