Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.45k stars 2.81k forks source link

Unable to build Android app Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081 #183

Closed tgolen closed 4 years ago

tgolen commented 4 years ago

Full logs:

^CTims-MacBook-Pro:ReactNativeChat tim$ npm run android

> react-native-chat@1.0.1-2 android /Users/tim/code/Expensidev/ReactNativeChat
> react-native run-android

info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1011 file(s) to forward-jetify. Using 8 workers...
info Starting JS server...
/bin/sh: adb: command not found
info Launching emulator...
error Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`.
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
info Installing the app...
Starting a Gradle Daemon (subsequent builds will be faster)

> Configure project :app
Reading env from: .env

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

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:installDebug'.
> SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at '/Users/tim/code/Expensidev/ReactNativeChat/android/local.properties'.

* 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 10s

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

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react-native-chat@1.0.1-2 android: `react-native run-android`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-native-chat@1.0.1-2 android script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/tim/.npm/_logs/2020-08-15T15_35_47_294Z-debug.log

cc @AndrewGable I'm going to be digging into this to get it working today.

tgolen commented 4 years ago

I ran through the instructions for seeing up android environment here: https://reactnative.dev/docs/environment-setup#docsNav

It got further, but I'm still hitting an error.

Tims-MacBook-Pro:ReactNativeChat tim$ npm run android

> react-native-chat@1.0.1-2 android /Users/tim/code/Expensidev/ReactNativeChat
> react-native run-android

info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1011 file(s) to forward-jetify. Using 8 workers...
info Starting JS server...
info Launching emulator...
error Failed to launch emulator. Reason: Emulator exited before boot..
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
info Installing the app...

> Configure project :app
Reading env from: .env

> Task :app:generateDebugBuildConfig
Reading env from: .env

> Task :react-native-community_netinfo:compileDebugJavaWithJavac

> Task :react-native-community_async-storage:compileDebugJavaWithJavac

> Task :app:compileDebugJavaWithJavac

> Task :app:installDebug FAILED

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.2/userguide/command_line_interface.html#sec:command_line_warnings
103 actionable tasks: 103 executed
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/tim/code/Expensidev/ReactNativeChat/node_modules/@react-native-community/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStorageModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/tim/code/Expensidev/ReactNativeChat/android/app/src/debug/java/com/reactnativechat/ReactNativeFlipper.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: No connected devices!

* 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 38s

error Failed to install the app. Make sure you have an Android emulator running or a device connected. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
Note: Some input files use or override a deprecated API.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react-native-chat@1.0.1-2 android: `react-native run-android`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-native-chat@1.0.1-2 android script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/tim/.npm/_logs/2020-08-15T15_50_56_768Z-debug.log
Tims-MacBook-Pro:ReactNativeChat tim$
quinthar commented 4 years ago

Demoting this to LOW because it doesn't affect the first-time user experience

tgolen commented 4 years ago

I solved the final error by having a running emulator 👍 Just making a record of this for others.