Instruct gradle to use local files - android

I am trying to build an ionic 4 project for android with this command:
ionic cordova build android --verbose
The bulid fails with the following error:
Running command: /path/gradlew cdvBuildDebug -b /path/build.gradle
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 find com.android.tools.build:gradle:3.3.0.
Searched in the following locations:
- https://dl.google.com/path/gradle-3.3.0.pom
- https://dl.google.com/path/gradle-3.3.0.jar
...
When I do wget https://dl.google.com/path/gradle-3.3.0.pom I get 404.
When I paste the url into the addressbar of my browser however the file does get downloaded. So, I have been able to download the files gradle is having trouble downloading.
Is there a way I instruct gradle to use the local files instead of trying to download them?

i think this is for sanctions and if we can use vpn thats resolved

Related

Unable to create build ionic3 using command ionic build android

I set an environment path for JAVA_HOME and followed
android studio Error:Unable to start the daemon process.
I'm still getting an error, not able to create build. I am using latest version of node, npm, ionic.
Error:
JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_11
studio
Subproject Path: CordovaLib
Subproject Path: app
[12:02:18] lint finished in 9.73 s
[Fatal Error] gradle-bintray-plugin-1.7.3.pom:2:1: Content is not allowed
log.
[Fatal Error] android-maven-gradle-plugin-1.5.pom:2:1: Content is not all
prolog.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':CordovaLib'.
> Could not resolve all files for configuration ':CordovaLib:classpath'.
Did you upgrade your cordova? After updating it might be run. Or you can remove nodemodule folder and then do npm install and then try to build your app.

"ionic cordova build" fails to build apk

I cannot build an apk in cordova. Build always fails.
Set my android SDK home
export ANDROID_HOME/home/felipe/Android/Sdk/
First, build cannot find gradle, so i put gradle in path. I have tried this with downloaded gradle or the gradle that i have in android studio.
export PATH=$PATH:/home/felipe/gradle-4.1/bin
For make sure that i have updated versions of cordova and ionic
npm install -g cordova#latest
npm install -g ionic#latest
simple sample app
ionic start sidemenu sidemenu --type ionic1
cd sidemenu
ionic cordova platform add android
ionic cordova build android
And then i got:
> ionic cordova prepare
> cordova prepare
✔ Running command - done!
Running command: /home/felipe/ionic-testes/sidemenu/hooks/after_prepare/010_add_platform_class.js /home/felipe/ionic-testes/sidemenu
add to body class: platform-android
> cordova build android
✖ Running command - failed!
[ERROR] Cordova encountered an error.
You may get more insight by running the Cordova command above directly.
[ERROR] An error occurred while running cordova build android (exit code 1):
Running command: /home/felipe/ionic-testes/sidemenu/hooks/after_prepare/010_add_platform_class.js
/home/felipe/ionic-testes/sidemenu
add to body class: platform-android
ANDROID_HOME=/home/felipe/Android/Sdk/
JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
Subproject Path: CordovaLib
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 resolve com.android.tools.build:gradle:2.2.3.
Required by:
project :
> Could not resolve com.android.tools.build:gradle:2.2.3.
> Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.pom'.
> Could not HEAD 'https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.pom'.
> sun.security.validator.ValidatorException: PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested
target
* 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: 2.176 secs
Error: /home/felipe/ionic-testes/sidemenu/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 dependencies for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:2.2.3.
Required by:
project :
> Could not resolve com.android.tools.build:gradle:2.2.3.
> Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.pom'.
> Could not HEAD 'https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.pom'.
> sun.security.validator.ValidatorException: PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested
target
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Please. Could somebody help me? Thank you for attention
Solved. I've Just opened in Android Studio.
I don't know why, but the user whose answar was correct has deleted his post. I had installed sdk with sdk manager in Android Studio, and i had installed other updates suggested by Android Studio, but only when i open the project in android studio it did the updates required.
From error message, i guess i have some Certification Authority missing in my open jdk installation (i am using openjdk from ubuntu repositories and have installed ca-certificates-java package). But, for now, it works.
Please create project with this commands
Ionic start sidemenu sidemenu --blank
Cd sidemenu
Add required platform Android, iOS
4.Cordova build android
Cordova run android

Ionic android build issue in linux

I have successfully installed cordova v6.3.1, ionic v2.0.0 and Android Studio
OS: Virtualbox (Xubuntu)
when i run ionic build android
I get below error:
BUILD FAILED
Total time: 7.749 secs
Error: /var/lib/mymachine/ionic-01/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 dependencies for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:2.1.0.
Required by:
:android:unspecified
> Could not resolve com.android.tools.build:gradle:2.1.0.
> Could not get resource 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.1.0/gradle-2.1.0.pom'.
> org.apache.http.ssl.SSLInitializationException: /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/security/cacerts (No such file or directory)
> Could not resolve com.android.tools.build:gradle:2.1.0.
> Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/2.1.0/gradle-2.1.0.pom'.
> org.apache.http.ssl.SSLInitializationException: /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/security/cacerts (No such file or directory)
Few post suggested to install Android support repository and Google Repository. I installed it. But still i face the face problem.
I had the similar problem. In my case it was simple java webapp which was using gradle. This project used java 6. My java 6 was not installed properly. Thats why I had the below issue.
gradle was not able to find the /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/security/cacerts
This is a symlink to another file which was not present.
So I removed my jdk and re-installed it. That solved the problem.

Ionic build apk android

I'm trying to build an apk from my ionic project.
When I launch ionic build android, i get this error
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project 'android'.
Could not resolve all dependencies for configuration ':_debugCompile'.
Could not find any version that matches com.android.support:support-v13:23+
.
Searched in the following locations:
https://repo1.maven.org/maven2/com/android/support/support-v13/maven-me
tadata.xml
https://repo1.maven.org/maven2/com/android/support/support-v13/
Required by:
:android:unspecified
Could not find any version that matches com.google.android.gms:play-service
s-gcm:+.
Searched in the following locations:
//repo1.maven.org/maven2/com/google/android/gms/play-services-gcm
/maven-metadata.xml
BUILD FAILED
What is it?
This is an error related to android tools version.By executing the following commands will resolve your issue.
android list sdk
and
android update sdk --no-ui --filter extra

Android Studio multi-dex gradle doesn't recognize java on mac

I'm trying to compile a gradle project (plugin 0.14.0) with multi-dex on my Mac, and getting this error:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':ApplicationContainer:createDebugMainDexClassList'.
> java.io.IOException: Cannot run program "java": error=2, No such file or directory
Any suggestions?
When I execute ./gradlew from terminal, it works.
Found a solution.
Seems like Android Studio didn't inherit environment path or something.
I ran it from the terminal:
open /Applications/Android\ Studio.app
And it solved it.
More elegant solutions will be happily accepted :D

Categories

Resources