Gradle build error using cordova - android

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

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.

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

error occurred configuring project react-native-photo-view

I have just started with ReactNative and created a project using this tutorial. The project got built and a android application got installed on my phone.
Then I used #shoutem/ui library for UI components. According to the documentation, I tried
npm install #shoutem/ui --save
react-native link
and then run the project using
react-native run-android
But then I got this error
PS D:\SK\Study\ReactNative\DemoRN> react-native run-android
Scanning folders for symlinks in D:\SK\Study\ReactNative\DemoRN\node_modules (38ms)
JS server already running.
Building and installing the app on the device (cd android && gradlew.bat installDebug)...
File C:\Users\sukumar\.android\repositories.cfg could not be loaded.
Failed to download any source lists!
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApk'.
> A problem occurred configuring project ':react-native-photo-view'.
> Failed to find Build Tools revision 25.0.0
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 11.028 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html
And then I unlinked the #shoutem/ui
react-native unlink #shoutem/ui
and tried to run the project, but still, I am facing the same issue?
Please ignore if it is too basic to ask, But I am not able to understand what is the issue?
Update
I am not using Android Studio, So I downloaded the build-tools 25.0.0 and placed in sdk/build-tools folder. But now I am facing
> A problem occurred configuring project ':react-native-photo-view'. > Failed to find Platform SDK with path: platforms;android-23
This seems to be an issue with the available SDK Tools in your installation of Android Studio:
> Failed to find Build Tools revision 25.0.0
Installing these should resolve the issue. To install this, start up Android studio, go to the SDK Manager and select the SDK Tools tab, check the Show Package Details option in the bottom right corner and then check the 25.0.0 SDK Tools and click Apply to download and install them.
Here's a screenshot of the SDK Tools I use for my local environment for reference:
Furthermore, I'd just like to elaborate on the react-native (un)link command. This is used to link native dependencies into your React Native project. Unlinking it is not the same as uninstalling it, you should still be able to use all non-native components of the Shoutem UI Toolkit after unlinking the package.
I am not using Android Studio, So I downloaded the build-tools 25.0.0 and placed in SDK/build-tools folder. This solved the build tools issue but then there was a new issue
A problem occurred configuring project ':react-native-photo-view'. > Failed to find Platform SDK with path: platforms;android-23
The network I was using has configured some firewalls rules that were not allowing the required dependencies get downloaded. When you run react-native run-android it downloads all the dependencies automatically to create the build.
So In my case, I changed my network settings and this worked.

Gradle build or clean not working just after installing Android Studio

I have just installed android studio on Ubuntu 14.04 and created a blank activity just for testing out. Now whenever i try to build the project the following error happens,
Error:Execution failed for task ':app:mergeDebugResources'.
> Error: java.lang.RuntimeException: Crunching Cruncher abc_switch_track_mtrl_alpha.9.png failed, see logs
Now somewhere i found out that cleaning the project or restarting android studio will solve this problem but whenever i try to clean project the gradle taking long time and got stuck. I used android studio before but never encountered this kind of problem.
please any kind of help would be appreciated!!
Delete the build folders from project root directory and the app directory. The project should build fine after that.

Android Studio not regenerating R.java; Gradle can't find assembleDebug task

I pulled some recent changes from my git repo, and suddenly, Android Studio was throwing up token not found errors for R.java. I hit "Make Project" in Android Studio, thinking a new build would fix these errors, when instead I got this:
Information:Compilation completed with 2 errors and 0 warnings in 5 sec
Information:2 errors
Information:0 warnings
Error:Gradle:
FAILURE: Could not determine which tasks to execute.
* What went wrong:
Task 'assembleDebug' not found in root project 'project'.
* Try:
Run gradle tasks to get a list of available tasks.
Error:Could not execute build using Gradle distribution 'http://services.gradle.org/distributions/gradle-1.6-bin.zip'.
The fact that it won't compile explains the problems with R.java, but I'm mystified about the problems Gradle is having. Any help?
[Edit:] I booted into Linux and noticed that it didn't have the same issue. I also noticed under Project Properties that, in Windows there are no linked Gradle projects but in Linux, the project is listed as a linked project. Unfortunately, this tool to help me fix my issues apparently doesn't exist in Android Studio, only in IntelliJ proper.
Just close everything and Restart the Android Studio and compile once again. I faced the same problem many times. It worked for me !
I had the same issue. I got it resolved my setting to the correct JDK folder path.
Also make sure you have "JAVA_HOME" environment variable.
Closing Android Studio and opening it again solved my problem.

Categories

Resources