react native new project cant run android from vs code terminal - react-native

i created a new project and run
npx react-native run-android
command in visual studio code terminal. but i got an error
What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin 'com.android.internal.application'.
> Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
You can try some of the following options:
- changing the IDE settings.
- changing the JAVA_HOME environment variable.
- changing `org.gradle.java.home` in `gradle.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 21s
but i can build the app with the same command in using iterm
what is difference? cause idk what changed and. i didnt changed anything

Related

I want to start Making mods in minecraft and I have a problem when i am trying to run Gradlew setupDecompWorkspace it gives me a error

When I open powershell I typed ./gradlew setupDecompWorkspace it gives me that
* What went wrong:
Task 'setupDecompWorkspace' not found in root project 'forge-1.12.2-14.23.5.2859-mdk'.
* Try:
Run gradlew tasks to get a list of available tasks. 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
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.9/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 8s
PS C:\Users\Ostrov\Desktop\Minecraft Mod Creation\forge-1.12.2-14.23.5.2859-mdk>```
It says BUILD FAILED in 8s because I tried to install it and it installed it for a few minutes but then it says there is an error and build failed
Are you using the mdk from Forge's website?
If you're on IntelliJ, you don't have to run this command. It automatically sets up the Gradle project. You should get a UI that looks like this:
Now, instead of typing the command, you can just click genIntellijRuns under the fg_runs section of the Gradle menu.

A problem occurred configuring project ':flutter_plugin_android_lifecycle'

I added "image_picker: ^0.8.4+11" package to my project.
After adding it was returning this error.
What went wrong:
A problem occurred configuring project ':flutter_plugin_android_lifecycle'.
Could not resolve all artifacts for configuration ':flutter_plugin_android_lifecycle:classpath'.
Could not find gradle-3.5.0.jar (com.android.tools.build:gradle:3.5.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.jar
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
Exception: Gradle task assembleDebug failed with exit code 1
I have similar problem , on windows and Gradle:3.5.0 .
any package using this Gradle Version has Error .
I Solved problem by clean cache of Gradle in this address:
C:\Users\<MY_ACCOUNT>\.gradle\caches
and then , resync project an android module.
I updated the gradle to latest version and the problem was solved.
Go to android\gradle\gradle-wrapper.properties and change the gradle version to the last one.

How do i build react-native application

i just created a new react-native app using npx create-react-native-app myapp which was successfully created. but when i try to build it using gradlew assembleRelease, i get this error
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileReleaseJavaWithJavac'.
> Failed to find Platform SDK with path: platforms;android-30
* 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
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.8/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 43s
it appears like teres a gradle problem. how do i fix it?

react-native run-android doesn't build

I'm totally new in react-native and have an Android emulator running but it doesn't build react-native & shows this error...
what should i do?
FAILURE: Build failed with an exception.
What went wrong:
Could not resolve all files for configuration ':app:debugCompileClasspath'.
Could not download appcompat-v7.aar (com.android.support:appcompat-v7:28.0.0)
Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/support/appcompat-v7/28.0.0/appcompat-v7-28.0.0.aar'.
Connection reset
Could not download support-fragment.aar (com.android.support:support-fragment:28.0.0)
Could not get resource
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 8m 56s
1 actionable task: 1 executed
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. Run CLI with --verbose flag for more details.
First of all you should update your node.js
Then run the installation's cammands and for Iranian it's better to use shecan.ir before running build run-android command instead of unworking vpn.
I did these steps and the problem solved.

Error in configuring root project while installing app on Android emulator

While trying to run the react-native application on android emulator, getting the following error. Please note the android emulator is already running.
A problem occurred configuring root project 'MyReactNativeApp'.
> Could not resolve all files for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:3.0.1.
Required by:
project :
> Could not resolve com.android.tools.build:gradle:3.0.1.
> Could not get resource 'https://jcenter.bintray.com/com/android/tools
/build/gradle/3.0.1/gradle-3.0.1.pom'.
> Could not GET 'https://jcenter.bintray.com/com/android/tools/build
/gradle/3.0.1/gradle-3.0.1.pom'.
> jcenter.bintray.com
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
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
Any help will be much appreciated.
The solution was simple. All I did was upgraded react-native and it solved the problem.
react-native upgrade