1

I am facing build issue while running "npx react-native run-android" on my windows.

I am stuck with this. Please guide me what I need to do.

I tried following options

  • deleting .gradle and rebuilding
  • deleting node-modules and do npm i
  • deleting androidResources
w: Detected multiple Kotlin daemon sessions at build\kotlin\sessions

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.5.1/userguide/command_line_interface.html#sec:command_line_warnings
74 actionable tasks: 45 executed, 29 up-to-date
                                                                                                                                                    
FAILURE: Build failed with an exception.                                                                                                            
                                                                                                                                                    
* What went wrong:                                                                                                                                  
Execution failed for task ':app:packageDebug'.                                                                                                      
> A failure occurred while executing com.android.build.gradle.tasks.PackageAndroidArtifact$IncrementalSplitterRunnable                              
   > java.io.FileNotFoundException: C:\Users\HP\Desktop\projects\MyEventors\android\app\build\intermediates\incremental\packageDebug\tmp\debug\zip-cache\androidResources (Access is denied)

* 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 55s

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:packageDebug'.
> A failure occurred while executing com.android.build.gradle.tasks.PackageAndroidArtifact$IncrementalSplitterRunnable
   > java.io.FileNotFoundException: C:\Users\HP\Desktop\projects\MyEventors\android\app\build\intermediates\incremental\packageDebug\tmp\debug\zip-cache\androidResources (Access is denied)

* 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 55s

    at makeError (C:\Users\HP\Desktop\projects\MyEventors\node_modules\@react-native-community\cli-platform-android\node_modules\execa\index.js:174:9)
    at C:\Users\HP\Desktop\projects\MyEventors\node_modules\@react-native-community\cli-platform-android\node_modules\execa\index.js:278:16
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async runOnAllDevices (C:\Users\HP\Desktop\projects\MyEventors\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
    at async Command.handleAction (C:\Users\HP\Desktop\projects\MyEventors\node_modules\@react-native-community\cli\build\index.js:142:9)
info Run CLI with --verbose flag for more details.```




Nagaraj
  • 67
  • 1
  • 8

1 Answers1

0

Try following step

  1. Delete android build folders (both android/build & android/app/build)
  2. Add org.gradle.jvmargs=-Xmx4608m in android/gradle.properties
  3. Delete node_modules
  4. Clean npm / yarn (whichever you are using to install packages) cache by running npm cache clean --force / yarn cache clean
  5. run npm install / yarn to install packages
  6. Android studio -> File -> Invalidate Cache -> Invalidate and Restart
  7. Rebuild the project
Thanhal P A
  • 4,097
  • 3
  • 18
  • 38