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
- 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
:
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 a year ago
- Reactions: 7
- Comments: 28 (5 by maintainers)
Fix was merged and should be released in this week I hope 💪
Hi @raza-jamil-reckon we’ve switched from
variant
tomode
with CLI release. That being said, variant should still work, looking into fixing it right now!Please try this instead:
@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:
npx react-native init RN071
android/app/build.gradle
as follows: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 viaadb
.Folks on the CLI are looking into it.
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.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@cortinico Thanks, although I’m already using the recommended settings I think you’re right. I’ll do some digging on my end.
Correct, you can use
--verbose
and see how it goes?Same problem after the upgrade to 0.71