Tried so many things to get this to work, downloaded Android Studio and one of its emulators, downloaded brew and even ran: brew install android-platform-tools
I'm wondering if it's because I have to download these tools:
Android tools that are recommended for download
But I only have these tools available for download:
Some tools are missing for me
I want to try this solution but I'm having difficulties with it because control-o does not save: https://stackoverflow.com/a/68110432/19083668
This is the output of the terminal in VS Code when I run the app with ' npx react-native run-android '
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> 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/charbelmansour/nativetest/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 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 app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> 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/charbelmansour/nativetest/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 16s
at makeError (/Users/charbelmansour/nativetest/node_modules/execa/index.js:174:9)
at /Users/charbelmansour/nativetest/node_modules/execa/index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (/Users/charbelmansour/nativetest/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:109:5)
at async Command.handleAction (/Users/charbelmansour/nativetest/node_modules/#react-native-community/cli/build/index.js:192:9)
info Run CLI with --verbose flag for more details.
Related
Starting a Gradle Daemon, 1 stopped Daemon could not be reused, use --status for details
FAILURE: Build failed with an exception.
* What went wrong:
Could not open settings generic class cache for settings file '/home/dharmendra/Documents/gitlab/rnative/AwesomeProject/android/settings.gradle' (/home/dharmendra/.gradle/caches/7.5.1/scripts/6hrksilieebwgbc2tk6l5h8hd).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 63
* 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 30s
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:
Could not open settings generic class cache for settings file '/home/dharmendra/Documents/gitlab/rnative/AwesomeProject/android/settings.gradle' (/home/dharmendra/.gradle/caches/7.5.1/scripts/6hrksilieebwgbc2tk6l5h8hd).
I resolved this problem final only change JAVA Version 18 Use in java of version
Check java -version :- if showing 19.x.x then change java version 18.x.x install.
follow the step :
sudo apt update
sudo apt install -y openjdk-18-jdk
sudo apt install -y openjdk-18-jre
then run your project
npx react-native start && npx react-native run-android
.............................
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings
5 actionable tasks: 5 up-to-date
FAILURE: Build failed with an exception.
Where:
Build file 'D:\React Native Applications\FirstProject\android\app\build.gradle' line: 240
What went wrong:
A problem occurred configuring project ':app'.
groovy.lang.MissingPropertyException: No such property: ABI for class: org.gradle.api.tasks.OutputFile
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 17s
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.
Where:
Build file 'D:\React Native Applications\FirstProject\android\app\build.gradle' line: 240
What went wrong:
A problem occurred configuring project ':app'.
groovy.lang.MissingPropertyException: No such property: ABI for class: org.gradle.api.tasks.OutputFile
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 17s
at makeError (D:\React Native Applications\FirstProject\node_modules\#react-native-community\cli-platform-android\node_modules\execa\index.js:174:9)
at D:\React Native Applications\FirstProject\node_modules\#react-native-community\cli-platform-android\node_modules\execa\index.js:278:16
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async runOnAllDevices (D:\React Native Applications\FirstProject\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (D:\React Native Applications\FirstProject\node_modules\#react-native-community\cli\build\index.js:142:9)
info Run CLI with --verbose flag for more details.
Please Give Solution About This Error
So, if your project arises this type of error in the React-Native application, just open android/app/build.gradle Line: 240, remove this line
def abi = output.getFilter(OutputFile.ABI)
And paste the below code.
def abi = output.getFilter(com.android.build.OutputFile.ABI)
enter image description here
I'm unable to solve this problem can some one help me
I'am unable to solve this problem in Ubuntu
=>list of error that I have faced
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings
5 actionable tasks: 5 up-to-date
FAILURE: Build failed with an exception.
What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
SDK location not found. Define a valid SDK location with an ANDROID_HOME environment variable or by setting the sdk.dir path in your project's local properties file at '/home/hassnain/Desktop/native_app/practice_app/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 6s
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:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
SDK location not found. Define a valid SDK location with an ANDROID_HOME environment variable or by setting the sdk.dir path in your project's local properties file at '/home/hassnain/Desktop/native_app/practice_app/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
I'm new to react-native and i went trough making my first app, and all good until i got to run it because i get this error, i would ¡be thankful if someone could help me, i did all the tutorial that react-native provide in it's page so i think i installed it correctly.
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 870 file(s) to forward-jetify. Using 12 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...
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> 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/fovu/Documents/AwesomeProject/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 2s
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:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> 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/fovu/Documents/AwesomeProject/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 2s
at makeError (/Users/fovu/Documents/AwesomeProject/node_modules/execa/index.js:174:9)
at /Users/fovu/Documents/AwesomeProject/node_modules/execa/index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (/Users/fovu/Documents/AwesomeProject/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:109:5)
at async Command.handleAction (/Users/fovu/Documents/AwesomeProject/node_modules/#react-native-community/cli/build/index.js:192:9)
info Run CLI with --verbose flag for more details.
Hello and welcome to StackOverflow!
As the logs mention, it cannot compile you app since the location of your android SDK cannot be found.
> 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/fovu/Documents/AwesomeProject/android/local.properties'.
It seems that your properties file points to a wrong SDK directory, your ANDROID_SDK_ROOT path points to a wrong directory or the ANDROID_SDK_ROOT path doesn't exist at all.
I'd recommend you to read through the official setup documentation and following each step: https://reactnative.dev/docs/environment-setup
Appendix
I have seen in your logs that react-native doesn't even see an emulator, hence this line:
error Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`.
So you need to either manually launch an emulator or if you don't have an android emulator, install one. Or if you want: You can try to install the app on your phone by plugging it into your computer and enable USB debugging on your phone.
Cheers.
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:mergeDebugAssets'.
Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not find com.yqritc:android-scalablevideoview:1.0.4.
Searched in the following locations:
- https://repo.maven.apache.org/maven2/com/yqritc/android-scalablevideoview/1.0.4/android-scalablevideoview-1.0.4.pom
- file:/C:/Users/Ritik/.m2/repository/com/yqritc/android-scalablevideoview/1.0.4/android-scalablevideoview-1.0.4.pom
- file:/E:/react native/Imusic/node_modules/react-native/android/com/yqritc/android-scalablevideoview/1.0.4/android-scalablevideoview-1.0.4.pom
- file:/E:/react native/Imusic/node_modules/jsc-android/dist/com/yqritc/android-scalablevideoview/1.0.4/android-scalablevideoview-1.0.4.pom
- https://dl.google.com/dl/android/maven2/com/yqritc/android-scalablevideoview/1.0.4/android-scalablevideoview-1.0.4.pom
- https://www.jitpack.io/com/yqritc/android-scalablevideoview/1.0.4/android-scalablevideoview-1.0.4.pom
Required by:
project :app > project :react-native-video
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 20s
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:mergeDebugAssets'.
Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not find com.yqritc:android-scalablevideoview:1.0.4.
Searched in the following locations:
- https://repo.maven.apache.org/maven2/com/yqritc/android-scalablevideoview/1.0.4/android-scalablevideoview-1.0.4.pom
- file:/C:/Users/Ritik/.m2/repository/com/yqritc/android-scalablevideoview/1.0.4/android-scalablevideoview-1.0.4.pom
- file:/E:/react native/Imusic/node_modules/react-native/android/com/yqritc/android-scalablevideoview/1.0.4/android-scalablevideoview-1.0.4.pom
- file:/E:/react native/Imusic/node_modules/jsc-android/dist/com/yqritc/android-scalablevideoview/1.0.4/android-scalablevideoview-1.0.4.pom
- https://dl.google.com/dl/android/maven2/com/yqritc/android-scalablevideoview/1.0.4/android-scalablevideoview-1.0.4.pom
- https://www.jitpack.io/com/yqritc/android-scalablevideoview/1.0.4/android-scalablevideoview-1.0.4.pom
Required by:
project :app > project :react-native-video
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 20s
at makeError (E:\react native\Imusic\node_modules\#react-native-community\cli-platform-android\node_modules\execa\index.js:174:9)
at E:\react native\Imusic\node_modules\#react-native-community\cli-platform-android\node_modules\execa\index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (E:\react native\Imusic\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:106:5)
at async Command.handleAction (E:\react native\Imusic\node_modules\#react-native-community\cli\build\index.js:192:9)
In your build.gradle in your Android folder you need to change allprojects (not in build dependencies) like this:
allprojects {
repositories {
// ...
mavenCentral()
mavenLocal()
jcenter()
maven { url 'https://www.jitpack.io' }
// ...
}
}
Then, Clean cache and build again.