React Native Task :app:installDebug FAILED [duplicate] - javascript

This question already has answers here:
react-native :app:installDebug FAILED
(35 answers)
Closed 8 days ago.
i'm trying to create a new app with react native. i was using android studio emulator and now i installed genymotion. whatever when i started the app i encounted an error. react native version is 0.69.4.
> Task :app:installDebug FAILED
Skipping device 'Custom - 4.4.4' for 'app:debug': minSdkVersion [21] > deviceApiLevel [19]
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.3.3/userguide/command_line_interface.html#sec:command_line_warnings
147 actionable tasks: 2 executed, 145 up-to-date
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:installDebug'.
> java.util.concurrent.ExecutionException: org.gradle.api.GradleException: Failed to install on any 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
BU?LD FAILED in 31s
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'.
> java.util.concurrent.ExecutionException: org.gradle.api.GradleException: Failed to install on any 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
BU?LD FAILED in 31s
at makeError (C:\Users\Egehan Berker\Desktop\poemtra\poemtra\node_modules\#react-native-community\cli-platform-android\node_modules\execa\index.js:174:9)
at C:\Users\Egehan Berker\Desktop\poemtra\poemtra\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 (C:\Users\Egehan Berker\Desktop\poemtra\poemtra\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (C:\Users\Egehan Berker\Desktop\poemtra\poemtra\node_modules\#react-native-community\cli\build\index.js:192:9)
min sdk version is 21 and compileSdkVersion is 31. what should i do?

The minSdkVersion of your app is API Level 21 ( Android 5.0 ). It caused an error because you are trying to install the app on a device with API Level 19 (Andriod 4.4.4)
You can try to lower your minSdkVersion to API Level 19 (Android 4.4.4) on android/build.gradle or install your app on the emulator Android > 5.0.

Related

Does react-native support jdk 17?

So I have been having some problems with launching the initial react-native template project on android. And after consulting someone I was told that jdk 17 is not supported. But I really don't want to downgrade as this could break other things that I already have and work with. To be specific this is the error I get:
> Task :app:processDebugMainManifest FAILED
11 actionable tasks: 2 executed, 9 up-to-date
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> Unable to make field private final java.lang.String java.io.File.path accessible: module java.base does not "opens java.io" to unnamed module #7ec6bc9b
* 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
* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> Unable to make field private final java.lang.String java.io.File.path accessible: module java.base does not "opens java.io" to unnamed module #7ec6bc9b
* 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 (C:\Users\karti\Desktop\ShoppingList\node_modules\execa\index.js:174:9)
at C:\Users\karti\Desktop\ShoppingList\node_modules\execa\index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (C:\Users\karti\Desktop\ShoppingList\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid at async Command.handleAction (C:\Users\karti\Desktop\ShoppingList\node_modules\#react-native-community\cli\build\index.js:192:9)
I have looked at this already and nothing worked.
Gradle: Execution failed for task ':processDebugManifest'
So I solved this issue by installing JDK 16 on my system and everything is solved and running fine. I don't know if the problem was with Gradle or JDK or react-native but hope that in the future jdk 17 is supported.
If you have the same issue then you can go to:
jdk 16
1)Download and Install the JDK 16.
2)Add the path to your jdk in the PATH in your system environment variable.
3)Open cmd and do java -version you should see something like
java version "16.0.2" 2021-07-20
Java(TM) SE Runtime Environment (build 16.0.2+7-67)
Java HotSpot(TM) 64-Bit Server VM (build 16.0.2+7-67, mixed mode, sharing)
To know if this is a java version-related issue, You need to check your Gradle version.
currently only Gradle version 7.3 support java 17.
You can check gradle compatibility matrix to check.
you can check your version with the command line by typing gradlew.bat -version
If your Gradle is version 7.3 then it has nothing to do with the JDK version.

React native Webview error, App not installing Help me to solve this

I am creating an app that uses webview. I installed and imported the webview and when using it, app was not installed in the android emulator. Without webview app installing correctly.
I tried by creating another project for example ,same error returns.
Here is the error by using webview:
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* Where:
Build file 'F:\FirstProject\node_modules\react-native-webview\android\build.gradle' line: 35
* What went wrong:
A problem occurred evaluating project ':react-native-webview'.
> org/jetbrains/kotlin/cli/common/PropertiesKt
* 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.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':react-native-webview'.
> compileSdkVersion is not specified. Please add it to build.gradle
* 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 15s
I am using java version: java 15.0.2
compileSdkVersion : 30

Problem with new version of react-native: FAILURE: Build failed with an exception

the new version of react-native (v 0.59) give me an error when trying to run that on a device or simulator:
C:\Pro\react-native jan\tictactoe>react-native run-android
info Starting JS server...
info Building and installing the app on the device (cd android && gradlew.bat app:installDebug)...
Downloading https://services.gradle.org/distributions/gradle-4.10.2-all.zip
...............................................................................................................
Unzipping C:\Users\MAN.gradle\wrapper\dists\gradle-4.10.2-all\9fahxiiecdb76a5g3aw9oi8rv\gradle-4.10.2-all.zip to C:\Users\MAN.gradle\wrapper\dists\gradle-4.10.2-all\9fahxiiecdb76a5g3aw9oi8rv
Welcome to Gradle 4.10.2!
Here are the highlights of this release:
- Incremental Java compilation by default
- Periodic Gradle caches cleanup
- Gradle Kotlin DSL 1.0-RC6
- Nested included builds
- SNAPSHOT plugin versions in the plugins {} block
For more details see https://docs.gradle.org/4.10.2/release-notes.html
Starting a Gradle Daemon (subsequent builds will be faster)
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project 'tictactoe'.
Could not resolve all artifacts for configuration ':classpath'.
Could not resolve com.android.tools.build:gradle:3.3.1.
Required by:
project :
Could not resolve com.android.tools.build:gradle:3.3.1.
Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.3.1/gradle-3.3.1.pom'.
Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.3.1/gradle-3.3.1.pom'.
Connect to 127.0.0.1:50002 [/127.0.0.1] failed: Connection refused: connect
Could not resolve com.android.tools.build:gradle:3.3.1.
Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.3.1/gradle-3.3.1.pom'.
Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.3.1/gradle-3.3.1.pom'.
Connect to 127.0.0.1:50002 [/127.0.0.1] failed: Connection refused: connect
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 4m 55s
error 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
error Command failed: gradlew.bat app:installDebug
what i have to do?

Android apk Can not build with react-native-image-picker

This is the error while building apk react native 0.51
:app:processDebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> Error: A library uses the same package as this project: com.imagepicker
* 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: 4 mins 51.11 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/android-setup.html
here image of error

Error in building android app using Phonegap

For some reason, my android phonegap build fails every time I try to run it.I can’t seem to figure out what the problem is.
I am using the latest version of Cordova (5.3.3) and downloaded the correct SDK for android using Android studio (I think).
Any ideas what I’m doing wrong?
Here are my CLI logs:
FAILURE:
Build failed with an exception.
* What went wrong:
Execution failed for task ':prepareDebugDependencies'.
>
javax.xml.xpath.XPathExpressionException: org.xml.sax.SAXParseException; lineNumber: 41; columnNumber: 94; The prefix "tools" for attribute "tools:overrideLibrary" associated with an element type "uses-sdk" is not bound.
* 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: 4.325 secs
/Users/macuser/Desktop/bacon copy/bacontest/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: /Users/macuser/Desktop/bacon copy/bacontest/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/macuser/Desktop/bacon copy/bacontest/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: /Users/macuser/Desktop/bacon copy/bacontest/platforms/android/cordova/build: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: /Users/macuser/Desktop/bacon copy/bacontest/platforms/android/cordova/build: Command failed with exit code 1
at ChildProcess.whenDone (/usr/local/lib/node_modules/phonegap/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:139:23)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:817:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:211:
5)

Categories