Im trying to build an app but run into some problems so tried with a fresh projects that still fails to build. This is my steps:
1) Installing the app with
react-native init Myapp
after that Im running the emulator in android studio and launching the app with:
react-native run-android
and are getting the errormessage below. I have tried to reinstall the react-native cli
npm install -g react-native-cli
reset the cache in gradle with
cd android
gradlew cleanBuildCache
It used to work but since I have had some problems to build the apk I messed around a bit with the gradle. I might have updated something that causes the error. Any help is very welcomed!
here is the errormessage
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:preDebugBuild'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
> Could not resolve org.webkit:android-jsc:+.
Required by:
project :app
> Failed to list versions for org.webkit:android-jsc.
> Could not list versions using M2 pattern 'https://jitpack.io/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier])(.[ext])'.
> Could not get resource 'https://jitpack.io/org/webkit/android-jsc/'.
> Could not GET 'https://jitpack.io/org/webkit/android-jsc/'. Received status code 522 from server: Origin Connection Time-out
* 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 39s
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.
* What went wrong:
Could not determine the dependencies of task ':app:preDebugBuild'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
> Could not resolve org.webkit:android-jsc:+.
Required by:
project :app
> Failed to list versions for org.webkit:android-jsc.
> Could not list versions using M2 pattern 'https://jitpack.io/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier])(.[ext])'.
> Could not get resource 'https://jitpack.io/org/webkit/android-jsc/'.
> Could not GET 'https://jitpack.io/org/webkit/android-jsc/'. Received status code 522 from server: Origin Connection Time-out
* 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 39s
at checkExecSyncError (child_process.js:616:11)
at execFileSync (child_process.js:634:13)
at runOnAllDevices (D:\Myapp\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:74:39)
at buildAndRun (D:\Myapp\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\index.js:158:41)
at then.result (D:\Myapp\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\index.js:125:12)
at process._tickCallback (internal/process/next_tick.js:68:7)
Is Android SDK installed and are all the required variables set?
Try running in the command line:
adb
If the command is not recognized, then something is wrong with your Android SDK installation.
Follow the link provided in the error for detailed instructions on installing Android SDK.
I think, Developer options closed in your devices first open developer options,
then try this command
react-native init Test
npm i
react-native run-android or ios.
Turn off wifi
Build the app in offline mode
Turn on wifi
Your app should be builded
The reason behind this has been described here: https://github.com/react-native-camera/react-native-camera/issues/2490
Go to android folder and edit build.gradle
set buildToolsVersion to buildToolsVersion = "23.0.1" mine was 30.0.2 when i changed it to "23.0.1" it started working
In the android folder run
gradlew.bat installDebug
and make sure the Build is successful
That should do it go back to your project folder and run
npm run android
Related
I'm new to using React and have been following along in a tutorial for a project to learn. Occasionally, I encounter an error that stops my progress, then I search the error, and I generally find some solution. But in this case, I am having a hell of a time. Part of the issue is that I am so new to developing software that I sometimes am unsure of how to implement someone's solution. And, in particular, this issue seems like it is not simply contained to a single project, which means that new projects I create with React are now also experiencing similar issues.
Here's the issue. When I use npm run android, I get the following output:
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1940 file(s) to forward-jetify. Using 4 workers...
info JS server already running.
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-reanimated
> No AAR for react-native-reanimated found. Attempting to build from source.
> Native libs debug enabled: false
> Android gradle plugin: 4.2.2
> Gradle: 7.2
> building Reanimated2
> Task :app:generatePackageList FAILED
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.2/userguide/command_line_interface.html#sec:command_line_warnings
10 actionable tasks: 3 executed, 7 up-to-date
FAILURE: Build failed with an exception.
* Where:
Script 'C:\\Users\\Astuertz\\Dev\\Values2\\node_modules#react-native-community\\cli-platform-android\\native_modules.gradle' line: 122
* What went wrong:
Execution failed for task ':app:generatePackageList'.
> argument type mismatch
* 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 8s
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:\\Users\\Astuertz\\Dev\\Values2\\node_modules#react-native-community\\cli-platform-android\\native_modules.gradle' line: 122
* What went wrong:
Execution failed for task ':app:generatePackageList'.
> argument type mismatch
* 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 8s
at checkExecSyncError (node:child_process:828:11)
at execFileSync (node:child_process:866:15)
at runOnAllDevices (C:\Users\Astuertz\Dev\Values2\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:39)
at async Command.handleAction (C:\Users\Astuertz\Dev\Values2\node_modules\react-native\node_modules\#react-native-community\cli\build\index.js:182:9)
Someone had said that Gradle version 7 is incompatible with the current version of React and that it needs to be downgrade to version 7. I tried changing the version in the wrapper file for the Android folder, as well as taking someone's suggestion to change it in the Android Studio "Project Structure." In either case, the error either persisted or merely gave me a different error. What is going on here?
I've been trying to get my apps to run and compile but am in over my head.
I have implemented various methods but errors appear every time I run android.
If you delete the path_provier_macos folder, a linux error appears.
You are currently using path_provier: ^1.6.11. Lowering the path_provier version is the same.
Please tell me the solution.
Launching lib/main.dart on Android SDK built for x86 in debug mode...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':path_provider:compileDebugAidl'.
> Could not resolve all task dependencies for configuration
':path_provider:debugCompileClasspath'.
> Could not resolve project :path_provider_macos.
Required by:
project :path_provider
> Unable to find a matching configuration of project :path_provider_macos:
- None of the consumable configurations have attributes.
> Could not resolve project :path_provider_linux.
Required by:
project :path_provider
> Unable to find a matching configuration of project :path_provider_linux:
- None of the consumable configurations have attributes.
* 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 12s
Finished with error: Gradle task assembleDebug failed with exit code 1
Go to your Flutter sdk folder.
Go to [.pub-cache\hosted\pub.dartlang.org\ or .pub-cache\hosted\pub.flutter-io.cn\ ]
Remove all path_provider folders.
Pub get
Run your app.
I hope this fix your problem!
When I run react-native run-android on my project,I get an build error of gradle. I already uninstalled react-native-ftp with npm uninstall --save react-native-ftp, removed that dependency of node_modules, clear ./gradle cached files. But the error continuous..
In my environment windows this project works normally.
What's happing?
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
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:mergeDebugAssets'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
> Could not resolve project :react-native-ftp.
Required by:
project :app
> Unable to find a matching configuration of project :react-native-ftp:
- None of the consumable configurations have attributes.
* 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 (/home/leroto/leroto-workspace/svm/frontend/node_modules/execa/index.js:174:9)
at /home/leroto/leroto-workspace/svm/frontend/node_modules/execa/index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async runOnAllDevices (/home/leroto/leroto-workspace/svm/frontend/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:5)
at async Command.handleAction (/home/leroto/leroto-workspace/svm/frontend/node_modules/react-native/node_modules/#react-native-community/cli/build/index.js:186:9)
Go to your project level android directory and run ./gradlew clean
If the problem persists, delete node_modules folder and npm install
or you can do this manually:
npm list and then resolve all UNMET DEPENDENCY issues
Step1: Check whether all your "SDK Platforms" and "SDK Tools" is installed and Updated"
Step2: Create "local.properties" file in android folder and paste the following
sdk.dir = /Users/USERNAME/Library/Android/sdk
THIS SHOULD SOLVE YOUR PROBLEMS
I got this at react-native-udp
go into
nodemodules/react-native-udp/android/build.gradle
and replace
implementation 'com.facebook.react:react-native:0.11.+'
with
implementation 'com.facebook.react:react-native:0.70.4'
changing the module name to the module where this occurred and the version number to your current react version
first
click on android folder
click on settings.gradle file
remove this
include ':react-native-ftp'
project(':react-native-ftp').projectDir = new
File(rootProject.projectDir,
'../node_modules/react-native-ftp/android')
second
click on android folder
click on app folder
click on build.gradle file and remove
implementation project(':react-native-ftp')
I am new to react-native and trying to build an android app using react native in Android Studio for Windows. After I install react-navigation, follow all the steps in the react-navigation documentation, I run react-native run-android and I get this error in the command line:
PS C:\Users\comp\Desktop\work\reactnative\dansapp> react-native run-android
Starting JS server...
Building and installing the app on the device (cd android && gradlew.bat installDebug)...
FAILURE: Build failed with an exception.
* Where:
Settings file 'C:\Users\comp\Desktop\work\reactnative\dansapp\android\settings.gradle' line: 3
* What went wrong:
Could not compile settings file 'C:\Users\comp\Desktop\work\reactnative\dansapp\android\settings.gradle'.
> startup failed:
settings file 'C:\Users\comp\Desktop\work\reactnative\dansapp\android\settings.gradle': 3: unexpected char:
'\' # line 3, column 133.
s\react-native-gesture-handler\android')
^
1 error
* 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 1s
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
Command failed: gradlew.bat installDebug
Error: Command failed: gradlew.bat installDebug
at checkExecSyncError (child_process.js:602:13)
at Object.execFileSync (child_process.js:622:13)
at runOnAllDevices (C:\Users\comp\Desktop\work\reactnative\dansapp\node_modules\react-native\local-cli\runAndroid\runAndroid.js:299:19)
at buildAndRun (C:\Users\comp\Desktop\work\reactnative\dansapp\node_modules\react-native\local-cli\runAndroid\runAndroid.js:135:12)
at isPackagerRunning.then.result (C:\Users\comp\Desktop\work\reactnative\dansapp\node_modules\react-native\local-cli\runAndroid\runAndroid.js:65:12)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
PS C:\Users\comp\Desktop\work\reactnative\dansapp>
Does anyone know what this error is and how to resolve it? It seems to occur after I install react-navigation following these steps: https://reactnavigation.org/docs/en/getting-started.html
I have follwed the steps, including changing the mainActivity.java file. I also do not know what gradle is.
Any help would be greatly appreciated!
Known issue (see: bug with react-native link in android and windows), which will hopefully be fixed soon.
Jump into your settings.gradle file in /dansapp/android/ and replace...
project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '..\node_modules\react-native-gesture-handler\android')
...with...
project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-gesture-handler/android')
I was trying to compile location-saver that has a dependency react-native-vector-icons that I was not able to build.
The build was failing after a lot of attempts. Here is the log:
react-native run-android
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> A problem occurred configuring project ':react-native-vector-icons'.
> Could not resolve all dependencies for configuration ':react-native-vector-icons:_debugCompile'.
> Could not find com.android.support:appcompat-v7:27.1.1.
Searched in the following locations:
file:/Users/gureks/.m2/repository/com/android/support/appcompat-v7/27.1.1/appcompat-v7-27.1.1.pom
file:/Users/gureks/.m2/repository/com/android/support/appcompat-v7/27.1.1/appcompat-v7-27.1.1.jar
https://jcenter.bintray.com/com/android/support/appcompat-v7/27.1.1/appcompat-v7-27.1.1.pom
https://jcenter.bintray.com/com/android/support/appcompat-v7/27.1.1/appcompat-v7-27.1.1.jar
file:/Users/gureks/Desktop/Github/reacting/location-saver/node_modules/react-native/android/com/android/support/appcompat-v7/27.1.1/appcompat-v7-27.1.1.pom
file:/Users/gureks/Desktop/Github/reacting/location-saver/node_modules/react-native/android/com/android/support/appcompat-v7/27.1.1/appcompat-v7-27.1.1.jar
https://repo1.maven.org/maven2/com/android/support/appcompat-v7/27.1.1/appcompat-v7-27.1.1.pom
https://repo1.maven.org/maven2/com/android/support/appcompat-v7/27.1.1/appcompat-v7-27.1.1.jar
file:/Users/gureks/Library/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7/27.1.1/appcompat-v7-27.1.1.pom
file:/Users/gureks/Library/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7/27.1.1/appcompat-v7-27.1.1.jar
file:/Users/gureks/Library/Android/sdk/extras/google/m2repository/com/android/support/appcompat-v7/27.1.1/appcompat-v7-27.1.1.pom
file:/Users/gureks/Library/Android/sdk/extras/google/m2repository/com/android/support/appcompat-v7/27.1.1/appcompat-v7-27.1.1.jar
Required by:
LocationSaver:react-native-vector-icons:unspecified > com.facebook.react:react-native:0.57.8
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 16.274 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
I even changed the Support Library versions in the build.grade of the react-native-vector node_module.
Need help for a project, new to react-native.