Execution failed for task ':app:installDebug'. > com.android.builder.testing.api.DeviceException: No online devices found - android-studio

When I normally running my react-native from visual code in Android Virtual Device (Emulator) via terminal with npx react-native run android, suddenly I'm facing this error
1. info Running jetifier to migrate libraries to AndroidX. You can
disable it using "--no-jetifier" flag. Jetifier found 954 file(s) to
forward-jetify. Using 8 workers... info Starting JS server... info
Launching emulator... error Failed to launch emulator. Reason: Could
not start emulator within 30 seconds.. warn Please launch an
emulator manually or connect a device. Otherwise app may fail to
launch. info Installing the app...
> Configure project :react-native-firebase_app :react-native-firebase_app package.json found at
C:\Users\admin\Desktop\TheOriginalsAgency\Stage-pre-emcauche\MilinusApp\node_modules\#react-native-firebase\app\package.json
:react-native-firebase_app:firebase.bom using default value: 28.1.0
:react-native-firebase_app:play.play-services-auth using default
value: 19.0.0 :react-native-firebase_app package.json found at
C:\Users\admin\Desktop\TheOriginalsAgency\Stage-pre-emcauche\MilinusApp\node_modules\#react-native-firebase\app\package.json
:react-native-firebase_app:version set from package.json: 12.1.0
(12,1,0 - 12001000) :react-native-firebase_app:android.compileSdk
using custom value: 29 :react-native-firebase_app:android.targetSdk
using custom value: 29 :react-native-firebase_app:android.minSdk
using custom value: 21
:react-native-firebase_app:reactNativeAndroidDir
C:\Users\admin\Desktop\TheOriginalsAgency\Stage-pre-emcauche\MilinusApp\node_modules\react-native\android
> Task :app:installDebug FAILED Skipping device 'emulator-5554' (emulator-5554): Device is OFFLINE. 64 actionable tasks: 2 executed,
62 up-to-date
FAILURE: Build failed with an exception.
* What went wrong: Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: No online devices found.
* 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 16s
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.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong: Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: No online devices found.
* 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 16s
at makeError (C:\Users\admin\Desktop\TheOriginalsAgency\Stage-pre-emcauche\MilinusApp\node_modules\execa\index.js:174:9)
at C:\Users\admin\Desktop\TheOriginalsAgency\Stage-pre-emcauche\MilinusApp\node_modules\execa\index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:94:5)
at async runOnAllDevices (C:\Users\admin\Desktop\TheOriginalsAgency\Stage-pre-emcauche\MilinusApp\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:5)
at async Command.handleAction (C:\Users\admin\Desktop\TheOriginalsAgency\Stage-pre-emcauche\MilinusApp\node_modules\react-native\node_modules\#react-native-community\cli\build\index.js:186:9)
info Run CLI with --verbose flag for more details.

I don't know if you already fixed this but I just solved it!
I added more space to the Android Virtual Device.
You have to:
Edit the device or create a new one
On the ¨Verify Configuration¨ page, click on ¨Show Advanced Settings¨
Scroll down to ¨Memory and Storage¨
Change the Internal Storage MB amount
Initially the device that I've created had 2048MB and so I changed it to 6000MB but that wasn't enough so I finally put 10000MB of Internal Storage and with that amount I didn't get this error anymore.
Hope it works, good luck!

Related

Running flutter app in vscode and get this error Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'

i'm currently facing the problem in running my flutter app in physical device(phone). i'm using android studio 4 and vscode. The error message is below.
Launching lib\main.dart on TECNO B1f in debug mode...
lib\main.dart:1
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Failed to find target with hash string 'android-29' in: C:\Users\Kitsson\AppData\Local\Android\sdk
* 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 7m 8s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
I would suggest 4 methods to solve this issue , try one after another until it works for you :
Open terminal - run flutter doctor --android-licenses. Just accept all and it should work, if it dosen't then skip to next step.
adding buildToolsVersion in android => app => build.gradle
android { compileSdkVersion 29 buildToolsVersion "29.0.0" ... ... }
This often happens when you have something in your dependency that require internet like firebase. Just turn on your internet or wifi .
If none of them works then turn off developer option and turn it on again by pressing build number 7 times, this will revoke all usb debugging autherisation and ask whether to trust your developing machine , press yes and you will be good to go

Error when passing an app to my Huawei - Android-studio - Flutter

hello I’m trying to pass by my first made an application(flutter) to my phone(Huawei) but gives me a strange error someone has already gone through the same, can anyone help me? Thank you very much!
ERROR:
Launching lib/main.dart on ALE L21 in debug mode...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugGoogleServices'.
> File google-services.json is missing. The Google Services Plugin cannot function without it.
Searched Location:
/Users/indumonta/AndroidStudioProjects/smarthouse/android/app/src/nullnull/google-services.json
/Users/indumonta/AndroidStudioProjects/smarthouse/android/app/src/debug/google-services.json
/Users/indumonta/AndroidStudioProjects/smarthouse/android/app/src/nullnullDebug/google-services.json
/Users/indumonta/AndroidStudioProjects/smarthouse/android/app/src/nullnull/debug/google-services.json
/Users/indumonta/AndroidStudioProjects/smarthouse/android/app/src/debug/nullnull/google-services.json
/Users/indumonta/AndroidStudioProjects/smarthouse/android/app/google-services.json
* 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 9s
Exception: Gradle task assembleDebug failed with exit code 1

error Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`. in Mac

I am setting up an Android development environment. However, there is a problem in the execution environment. I've already finished the configuration, but I keep saying I can't find the device. However, if you run the server and then run it in the Android studio, it will work normally. What's the problem?
bash_profile
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/Contents/Home
export PATH=${PATH}:$JAVA_HOME/bin
export ANDROID_PATH=/Users/myname/Library/Android
export PATH=$PATH:$ANDROID_PATH/sdk/platform-tools
export PATH=$PATH:$ANDROID_PATH/sdk/emulator
export PATH=$PATH:$ANDROID_PATH/sdk/tools
export PATH=$PATH:$ANDROID_PATH/sdk/tools/bin
But Error
$ npx react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 864 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, 5 stopped Daemons could not be reused, use --status for details
> Task :app:stripDebugDebugSymbols UP-TO-DATE
Compatible side by side NDK version was not found.
> Task :app:installDebug
> Task :app:installDebug FAILED
27 actionable tasks: 9 executed, 18 up-to-date
[adb]: * daemon not running; starting now at tcp:5037
[adb]: * daemon started successfully
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 22s
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
[adb]: * daemon not running; starting now at tcp:5037
[adb]: * daemon started successfully
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 22s
at checkExecSyncError (child_process.js:611:11)
at execFileSync (child_process.js:629:15)
at runOnAllDevices (/Users/myname/AwesomeProject/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:39)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
Is there anyone who has the same problem as me?
Try the following:
> vim ~/.bash_profile
Add the following lines:
export ANDROID_HOME=/Users/myname/Library/Android/sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
export PATH=$PATH:$ANDROID_PATH/emulator
export PATH=$PATH:$ANDROID_PATH/tools/bin
Save changes and restart terminal.
Run ADB and if you got following it will work.
> adb devices
List of devices attached
emulator-5554 device
If you already configured the .bash_profile check the ANDROID_HOME using echo and then you simply need to run your app with this command :
source ~/.bash_profile && npx react-native run-android
UPDATE
Pay attention to this : You should run bash shell NOT zsh shell to be able to run emulator.

React Native app can't be started after upgrading to nodejs 12.13 from 10.13

My React Native used to run fine with 0.61.2 with Nodej 10.13. There is an error after upgrading to nodejs 12.13.0 when react-native run-android. Here is the error:
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1461 file(s) to forward-jetify. Using 4 workers...
info Starting JS server...
info Installing the app...
FAILURE: Build failed with an exception.
* Where:
Script 'C:\D\code\js\emps_fe6\node_modules\#react-native-community\cli-platform-android\native_modules.gradle' line: 182
* What went wrong:
A problem occurred evaluating script.
> Text must not be null or empty
* 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 3s
error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* Where:
Script 'C:\D\code\js\emps_fe6\node_modules\#react-native-community\cli-platform-android\native_modules.gradle' line: 182
* What went wrong:
A problem occurred evaluating script.
> Text must not be null or empty
* 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 3s
at checkExecSyncError (child_process.js:621:11)
at execFileSync (child_process.js:639:15)
at runOnAllDevices (C:\d\code\js\emps_fe6\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:39)
at buildAndRun (C:\d\code\js\emps_fe6\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\index.js:158:41)
at C:\d\code\js\emps_fe6\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\index.js:125:12
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Command.handleAction (C:\d\code\js\emps_fe6\node_modules\#react-native-community\cli\build\index.js:164:9)
./gradlew clean failed as well. What is wrong with the upgrade? Shall I roll back to nodejs 10.13?

Unable to start daemon process in android studio 1.0.1

I am getting following error message while trying to create a new Android project. Can anybody help?
Gradle 'GPSTrack' project refresh failed
Error:Error:Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon at http://gradle.org/docs/2.2.1/userguide/gradle_daemon.html
Please read the following process output to find out more:
-----------------------
22:38:35.626 [main] DEBUG o.g.l.daemon.bootstrap.DaemonMain - Assuming the daemon was started with following jvm opts: [-XX:MaxPermSize=256m, -XX:+HeapDumpOnOutOfMemoryError, -Xmx1024m, -Dfile.encoding=windows-1252, -Duser.country=US, -Duser.language=en, -Duser.variant]
FAILURE: Build failed with an exception.
* What went wrong:
Could not create service of type DaemonContext using DaemonServices.createDaemonContext().
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

Resources