Home > Net >  I tried everything but it's show this error in React-Native
I tried everything but it's show this error in React-Native

Time:02-10

I Just Started Learning React Native after I completed my react js and this error show every time I create new React-Native Project and I loose hope to learn React-Native

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
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01

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 @36838899       

  * 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

at makeError (D:\React-Native\React Native Cli\AwesomeProject\node_modules\execa\index.js:174:9)
at D:\React-Native\React Native Cli\AwesomeProject\node_modules\execa\index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)       
at async runOnAllDevices (D:\React-Native\React Native Cli\AwesomeProject\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (D:\React-Native\React Native Cli\AwesomeProject\node_modules\@react-native-community\cli\build\index.js:192:9)## Heading ##

CodePudding user response:

If you get the error message while running react-native run-android, try to go to android folder and clean gradlew cd android && ./gradlew clean Also you can trying run chmod x gradlew

Your project should be successfully started

Or visit here

CodePudding user response:

First make sure your environment is setup correctly as the documentation says.

If so, try these things:

  1. cd android then ./gradlew clean
  2. or else try to do delete node modules and run npm install

CodePudding user response:

Check you need to edit the uses-sdk in the AndroidManifest.xml like your build.gradle

<uses-sdk android:minSdkVersion="11" android:targetSdkVersion="14" />

and the android section, particularly minSdkVersion and targetSdkVersion in the build.gradle file

android {
    compileSdkVersion 17
    buildToolsVersion "17.0.0"

    defaultConfig {
        minSdkVersion 11
        targetSdkVersion 14
    }
}
  • Related