react-native: Task 'installDebug' not found in project ':app' after upgrading to 0.71

Description

Upgraded from 0.70.6 to 0.71 to fix this release issue but now I can’t even run the app in debug on Android (iOS is all good).

Version

0.71

Output of npx react-native info

System: OS: macOS 12.5 CPU: (10) x64 Apple M1 Pro Memory: 39.25 MB / 32.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 16.17.0 - /var/folders/ln/nzcf4q192bs4zlkb4z874c7mfpqxjr/T/yarn–1673846933120-0.6159910237355888/node Yarn: 1.22.10 - /var/folders/ln/nzcf4q192bs4zlkb4z874c7mfpqxjr/T/yarn–1673846933120-0.6159910237355888/yarn npm: 8.15.0 - ~/.asdf/plugins/nodejs/shims/npm Watchman: 2023.01.09.00 - /usr/local/bin/watchman Managers: CocoaPods: Not Found SDKs: iOS SDK: Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1 Android SDK: Not Found IDEs: Android Studio: 2021.3 AI-213.7172.25.2113.9123335 Xcode: 14.2/14C18 - /usr/bin/xcodebuild Languages: Java: 11.0.16.1 - /Users/raza.jamil/.asdf/shims/javac npmPackages: @react-native-community/cli: Not Found react: 18.2.0 => 18.2.0 react-native: 0.71.0 => 0.71.0 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Steps to reproduce

  1. Run app with yarn react-native run-android --variant=DevelopmentDebug --no-packager

Get the following error:

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

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

My Android env is setup correctly as everything was working pre-upgrade. Here’s just to make sure my paths are all correct:

echo $ANDROID_HOME                                                                                              1 ↵
/Users/raza.jamil/Library/Android/sdk

I know the build command is correct, here’s the output of ./gradlew tasks: Screen Shot 2023-01-16 at 4 34 48 pm

If I run ./gradlew installDevelopmentDebug manually it all works well but then the app doesn’t work on startup. I’m not sure of that’s because run-anrdoid does some extra stuff or I’ve made a mistake. In any case, I’d like to run the app through run-android locally.

I’ve tried different combinations of gradle wrappers and com.android.tools.build:gradle but no luck. Any help would is appreciated.

Snack, code example, screenshot, or link to a repository

It’s just the run-android command.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 8
  • Comments: 29 (7 by maintainers)

Most upvoted comments

Does 0.71.1 fix this?

yes, 0.71.1 fixes this. Please update to it and let us know if it works fine now

I created a patch to fix it until @adamTrz 's fix is merged: @react-native-community+cli-platform-android+10.0.0.patch

Simply include it in patches/@react-native-community+cli-platform-android+10.0.0.patch and run patch-package.

Fix was merged and should be released in this week I hope 💪

Hi @raza-jamil-reckon we’ve switched from variant to mode with CLI release. That being said, variant should still work, looking into fixing it right now!

Please try this instead:

❯ yarn react-native run-android --mode=DevelopmentDebug --no-packager

Could not determine the dependencies of task ‘:app:generateBundledResourcesHashDebug’.

Task with path ‘bundleDebugJsAndAssets’ not found in project ‘:app’.

@quocluong2001 @RalissonMattias your issue seems slightly different. Are you using Microsoft’s Codepush? If so this could be the issue (cc @kelset).

Thanks for reporting this. This seems like a bug in the CLI not properly handling the --variant=DevelopmentDebug parameter.

The reproducer is:

  1. Create a project with npx react-native init RN071
  2. Edit android/app/build.gradle as follows:
android {
    // ...
+   flavorDimensions "version"
+   productFlavors {
+       demo {
+           dimension "version"
+           applicationIdSuffix ".demo"
+       }
+       full {
+           dimension "version"
+           applicationIdSuffix ".full"
+       }
+   }
}
  1. Run the following cd RN071 && yarn && yarn react-native run-android --variant FullDebug

Workaround

For the time being you should be able to do the following: cd android && ./gradlew :app:installFullDebug and then launch the app manually or via adb.

Folks on the CLI are looking into it.

I created a patch to fix it until @adamTrz 's fix is merged: @react-native-community+cli-platform-android+10.0.0.patch

Simply include it in patches/@react-native-community+cli-platform-android+10.0.0.patch and run patch-package.

I’m also facing th same issue after upgrading to 0.71.0. I also tried to run ./gradlew installDevelopmentDebug and I got this issue Screenshot 2023-01-16 at 5 36 18 PM

Same problem after the upgrade to 0.71

Previous Daemon (70811) stopped at Mon Jan 30 11:34:48 AEDT 2023 after running out of JVM memory

It’s definitely something related to your local machine. Specifically your daemon are running out of memory. The --stop execution kills all of them so that’s probably why it’s green afterwards.

I would suggest you increase the memory used by Gradle using the gradle.properties file in your android folder:

https://github.com/facebook/react-native/blob/e91e468edc925ae7f3a44b041b616fde08ee957f/template/android/gradle.properties#L13

You can use the configuration as suggested here: https://docs.gradle.org/current/userguide/build_environment.html#sec:configuring_jvm_memory

@cortinico Thanks, although I’m already using the recommended settings I think you’re right. I’ll do some digging on my end.

@adamTrz Hi, thanks for the fix. I just tried on 0.71.1 and now running with --variant is doing the same thing as --mode which is it hangs on app:createBundleDevelopmentDebugJsAndAssets task and never fails/completes.

How can I get some info out of it? Is there some verbose flag I can provide? Should I log this as a separate issue?

Correct, you can use --verbose and see how it goes?