2

I am very new to react-native, and was trying to run my first app in react-native by reading the docs here. I named my app rdvTemp. When I run the command react-native run-android in watchman/rdvTemp, I get this error:

info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 855 file(s) to forward-jetify. Using 4 workers...
info Starting JS server...
info Installing the app...
debug Running command "cd android && ./gradlew app:installDebug -PreactNativeDevServerPort=8081"
Exception in thread "main" java.lang.RuntimeException: Timeout of 120000 reached waiting for exclusive access to file: /home/ankit/.gradle/wrapper/dists/gradle-5.4.1-all/3221gyojl5jsh0helicew7rwx/gradle-5.4.1-all.zip
    at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
    at org.gradle.wrapper.Install.createDist(Install.java:48)
    at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:107)
    at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:63)

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.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
Exception in thread "main" java.lang.RuntimeException: Timeout of 120000 reached waiting for exclusive access to file: /home/ankit/.gradle/wrapper/dists/gradle-5.4.1-all/3221gyojl5jsh0helicew7rwx/gradle-5.4.1-all.zip
    at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
    at org.gradle.wrapper.Install.createDist(Install.java:48)
    at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:107)
    at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:63)

    at checkExecSyncError (child_process.js:629:11)
    at execFileSync (child_process.js:647:13)
    at runOnAllDevices (/home/ankit/watchman/rdvTemp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:75:39)
    at buildAndRun (/home/ankit/watchman/rdvTemp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:169:41)
    at then.result (/home/ankit/watchman/rdvTemp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:135:12)
    at process._tickCallback (internal/process/next_tick.js:68:7)

I understood that it means there's something wrong with installation, but it shouldn't have been so because I followed everything. I installed Node, react native CLI and watchman while I already had Java and Android Studio. Both Java and Android Studio are upto date. Please tell me what am I doing wrong or what should I do. I was unable to get any help on this elsewhere. Thanks...

2 Answers 2

1

step 1 :

make sure you have correctly installed gradle by locating the zip file inside .grade/dist

step 2

in yourProjectAppDir/android/gradle/wrapper/gradle-wrapper.properties file change the distributionUrl to https\://services.gradle.org/distributions/gradle-YOUR_LOCAL_VERSION-all.zip

if you got Cannot lock task history cache (APP_NAME\android\.gradle\YOUR_LOCAL_VERSION\taskHistory) as it has already been locked by this process.

you may need to clear the cache by removing the .gradle\caches folder

Sign up to request clarification or add additional context in comments.

2 Comments

I'll test it out and let you know. Thanks!
hello does that fixed the issue ?
1

I had same issue on my MAC, you should give permissions to gradle :

sudo chown -R $USER ~/.gradle

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.