Ionic android build issue in linux - android

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.

Related

React Native suddenly throwing May 09 2022

I am currently working on a React Native project that has been previously worked on by other devs. it was compiling fine as before May 09 2022 then I tried to compile it now and it's now throwing
BUILD FAILED in 41s
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:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not resolve com.facebook.android:facebook-android-sdk:9.0.+.
Required by:
project :app > project :react-native-fbsdk-next
> Failed to list versions for com.facebook.android:facebook-android-sdk.
> Unable to load Maven meta-data from https://jcenter.bintray.com/com/facebook/android/facebook-android-sdk/maven-metadata.xml.
> Could not HEAD 'https://jcenter.bintray.com/com/facebook/android/facebook-android-sdk/maven-metadata.xml'.
> org.apache.http.client.ClientProtocolException (no error message)
No new packages were added, I even tried to revert to old commits just to confirm if it's package related and it still threw this error. Was there any changes or update with Maven recently? I have other devs that are on Mac and theirs seem to be compiling just fine
I am not an expert in react native, I only started using it and I also have the same issue from 9th may 2022. But I am able to fixed it.
You can follow the below steps and may be it will work for you too.
Open this file node_modules/react-native-fbsdk-next/android/build.gradle and change Line no 48 with below line
def FACEBOOK_SDK_VERSION = safeExtGet('facebookSdkVersion', '9.0.0')

Instruct gradle to use local files

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

"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 build android throws `Could not resolve com.android.tools.build:gradle:2.1.0` on Ubuntu

This is my stacktrace after ionic build android, after the simple three steps to begin working with ionic:
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'.
> Could not GET 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.1.0/gradle-2.1.0.pom'.
> sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
> 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'.
> Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/2.1.0/gradle-2.1.0.pom'.
> sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
All the code is the default code coming with $ ionic start myApp tabs
I tried to change gradle version, update cordova.
I've also tried to add this lines in build.gradle:
repositories {
maven { url 'http://repo1.maven.org/maven2' }
}
I also did that, just in case:
When running the "Cordova build android" I'm getting the below exception
I had the same problem and I resolve it installing manually gradle.
https://gradle.org/gradle-download/
I made these commands:
curl -s https://get.sdkman.io | bash
sdk install gradle 2.1 # Changing 3.1 version to 2.1
I had to restart my computer to get the paths configured correctly.
Previously I checked that it was configured correctly java and his paths but I don't think it has been important to solve it.

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

Categories

Resources