Error after ionic build

System - Ubuntu

I have done the following:

.bashrc

export ANDROID_HOME=/root/Android/Sdk

export PATH=$PATH:/root/Android/Sdk/tools

After I try the do the above I try to run sudo ionic build android in my console.

Console output:

sudo ionic build android

Running command: /home/aiduryagin/Desktop/androidDev/test/hooks/after_prepare/010_add_platform_class.js /home/aiduryagin/Desktop/androidDev/test
add to body class: platform-android
ANDROID_HOME=/root/Android/Sdk
JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64

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:1.5.0.
     Required by:
         :android:unspecified
      > Could not GET 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/1.5.0/gradle-1.5.0.pom'.
         > peer not authenticated

* 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: 1.615 secs
ERROR building one of the platforms: Error code 1 for command: /home/aiduryagin/Desktop/androidDev/test/platforms/android/gradlew with args: cdvBuildDebug,-b,/home/aiduryagin/Desktop/androidDev/test/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true
You may not have the required environment or OS to build this project
Error: Error code 1 for command: /home/aiduryagin/Desktop/androidDev/test/platforms/android/gradlew with args: cdvBuildDebug,-b,/home/aiduryagin/Desktop/androidDev/test/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true

Upvotes: 1

Views: 925

Answers (1)

QuickFix
QuickFix

Reputation: 11721

first,you should not run cordova CLI commands with sudo, this causes errors because the user used to run sudo commands is not the same your user, so if you configure path for your user, it's not changed for the sudo user.

you just need sudo to run npm install -g ... command, but not for cordova or ionic commands.

That said, it does not seem to be the cause of your issue.

Could not GET 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/1.5.0/gradle-1.5.0.pom'. peer not authenticated

This message seems to indicate you have a SSL issue when trying to download dependencies. Are you behind a proxy or something?

Upvotes: 1

Related Questions