React Native Build for android fails on windows machine - android

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.

Related

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

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?

Running flutter while offline - stuck on Resolving Dependencies

I'm trying to set up Flutter on a PC without internet connection.
I get stuck on "Resolving Dependencies" when trying to run an app (on a physical Nexus 5), and after some time I get a "Build failed with an exception" and a lot of failed download messages.
I installed the required software (inc. VSCode) as well as copied the flutter and gradle folders from my other PC where I normally use Flutter to develop.
Flutter doctor says I'm all good. I created the app offline using "flutter create --offline name_of_app".
This happens even if I try to run the app using Android Studio with gradle set to offline work and a path is directing to a full gradle distribution.
The error is:
* Error running Gradle:
ProcessException: Process "C:\name_of_app\android\gradlew.bat" exited abnormally:
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 gradle.jar (com.android.tools.build:gradle:3.2.1)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.jar'.
> Could not HEAD 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.jar'.
And it continues to mention other file names as well.
What am I missing? I can run the app on my other PC when I disconnect it from the internet.
Thanks in advance.
As a beginner both in programming and in flutter I commit this answer with caveats. It worked on my machine (a Lenovo laptop), on Manjaro Linux.
First problem I had encountered during the compilation phase was the -beta01 problem. The gradle offline plugin available for download from android studio site has currently version number 3.5.0-beta01. By some automatism 'flutter create --offline' sets the dependency to gradle:3.5.0 in the global build.gradle file. I solved that part of the problem by replacing 3.5.0 with 3.5.0-beta01.
Second problem was a number of missing dependencies compiler complained about. I downloaded them all and put them in the gradle plugin folder (in Linux it's /home/username/.android/manual-offline-m2/android-gradle-plugin-3.5.0-beta01/ - the recommended path from the Android studio configuration walk-through). They were mostly gradle and kotlin related.
When I resolved the second order dependencies the work was done. The base flutter app compiled with no errors , with all the offline settings (online repositories' paths in global build.gradle commented out, internet disconnected).
For offline use, which is solely for learning purposes, I plan not to update flutter channels, nor the maven and gradle plugin, being that the only reason one would use a computer with no internet access for flutter is for learning in the beginner's phase ... Up in the mountains of Croatia... At least that's where I plan to use it :D

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

Android Studio failed to build App Engine module

I tried to generate app engine backend for android app module in Android Studio. First I had encountered the Maven nonexistence problem, which was solved later on. Then another problem appeared.
Below is the error log generated:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project AndroidBackend-AppEngine: Compilation failure
[ERROR] error: error reading C:\Users\arifsamin.m2\repository\com\google\appengine\orm\datanucleus-appengine\2.1.2\datanucleus-appengine-2.1.2.jar; error in opening zip file
Do I have to download a new repo due to this? If I have to how to do so? Android Studio is very alien to me.
Make sure you have fresh install of Android Studio 0.2.+. Upgrade from pre 0.2 doesn't work as google included extra maven repo to serve support libraries.
Edit:
path in the log is correct, just stackoverflow plays silly and hides \ before .

Categories

Resources