Build failed when attempting to launch react native project via Android Studio - android

I am trying to run my react native project in Android Studio via the Emulator but the following error appears when attempting to run the project:
FAILURE: Build failed with an exception
What went wrong:
Execution failed for task ':app:mergeDebugNativeLibs'.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
More than one file was found with OS independent path 'lib/x86/libc++_shared.so'
I followed the steps for setting up the development environment, https://reactnative.dev/docs/environment-setup.
I added org.gradle.jvmargs=-Xmx4608m to the gradle.properties as advised from another fix but it is still not running.
The project runs perfectly on iOS, Xcode but not for Android.
I am using 'compileSdkVersion = 31` in the /android/build.gradle file.
Can someone please help here?

Related

Ionic cordova build error Could not resolve all artifacts for configuration ':classpath' Could not download com.android.tools.build:builder:3.3.0

I have an Ionic cordova android project that was working perfectly until last friday when I started having problems with the vpn I used, and now I can only connect using windscribe in stealth mode. This connection is really bad and because of it every time I run
$ ionic cordova build android
I get this error
BUILD FAILED in 1m 45s /project/platforms/android/gradlew: Command
failed with exit code 1 Error output: FAILURE: Build failed with an
exception.
What went wrong: A problem occurred configuring root project 'android'.
Could not resolve all artifacts for configuration ':classpath'.
Could not download builder-3.3.0.jar (com.android.tools.build:builder:3.3.0)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/3.3.0/builder-3.3.0.jar'.
> Connection reset
What I need to know is if there a way to solve this? Perhaps download manually this android builder and put it in some folder?
You got the point! It is really related to your internet connection, VPN or some FireWall on your network. So it can't download the dependencies to generate a build... it gets blocked because the restrictions.

React Native Build for android fails on windows machine

I am unable to run any react native app for android on my windows machine, I followed all steps stated on the official documentation but still doest work. I keep getting this error
* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> 1 exception was raised by workers:
java.util.zip.ZipException
I'm using the latest version of NPM and React Native as of this time.
I need to know how to fix this so the app builds successfully and runs on my virtual or real device, thanks.
The stacktrace of error can be summarized to java.util.zip.ZipException: Error opening zip file.
This can happen when exposing a corrupted jar file.
Checkout the libraries you are adding to the project. The JAR files should be intact and not corrupted.

Can't run cordova run android in Ionic project

I'm having an issue running cordova run android in my Ionic project. I've uninstalled and reinstalled Cordova, Ionic, Gradle, and Android Studio, yet I still get this following error.
FAILURE: Build failed with an exception.
Where:
Script 'path/platforms/android/cordova-android-play-services-gradle-release/app-cordova-android-play-services-gradle-release.gradle' line: 11
What went wrong:
A problem occurred evaluating script.
Could not read script 'path/platforms/android/app/cordova-android-play-services-gradle-release/properties.gradle' as it does not exist.
Question: How can I get this error to go away and my project to run successfully?

Gradle build error using cordova

After I created new project using cordova and added android platform, I got this error while building the project for first time
Download https://repo1.maven.org/maven2/com/android/tools/build/gradle-core/1.5.0/gradle-core-1.5.0.jar
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':classpath'.
> Could not download artifact 'gradle-core.jar (com.android.tools.build:gradle-core:1.5.0)'
> Failed to move file 'C:\Users\nienb\AppData\Local\Temp\gradle_download4337332192574000593bin' into filestore at 'C:\Users\nienb\.gradle\caches\modules-2\files-2.1\com.android.tools.build\gradle-core\1.5.0\70915a3f0ef4243d4630ea23219f5445fac82700\gradle-core-1.5.0.jar'
any one could help ?
I had the same issue developing on Windows after upgrading to Cordova 6. Run cmd as administrator and it resolved my issues.
Had the same problem. I noticed that when re-running the build, the file that the build got stuck on before would suddenly transfer just fine, but then the build failed on a different file.
I re-ran the build 4 or 5 times, and eventually it worked. I was running this in an administrator command prompt; not sure if that was important.
I solve my problem by downgrade gradle version from 1.5 to 1.3, both on main app and cordova plugin, but still looking for some official solutions

Fresh Install of Android Studio Gradle Error

Get the following Error when running android studio for the first time.
This is a blank project with no code whatsoever, so I suspect its something I need to configure or install. Any ideas or help? Thanks!
Gradle Build Error:
Execution failed for task ':app:compileDebugAidl'.
aidl is missing

Categories

Resources