Ho riscontrato delle difficoltà nel build della web app con ionic + gradle, sopratutto dopo aver aggiornato cordova all'ultima version che non usa più ant
con gradle invece è sufficiente dare ionic build
Prima con ant era facile
ionic build -- --ant con gradle invece è sufficiente dare ionic build
peccato che nel tentativo di deploy mi sia imbattuto in questo errore:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> A problem occurred configuring project ':CordovaLib'.
> Could not resolve all dependencies for configuration ':CordovaLib:classpath'.
> Could not resolve com.android.tools.build:gradle:1.0.0+.
Required by:
android:CordovaLib:unspecified
> Could not resolve com.android.tools.build:gradle:1.0.0+.
> Failed to list versions for com.android.tools.build:gradle.
> Unable to load Maven meta-data from https://jcenter.bintray.com/com/android/tools/build/gradle/maven-metadata.xml.
> Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/maven-metadata.xml'.
> peer not authenticated
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> A problem occurred configuring project ':CordovaLib'.
> Could not resolve all dependencies for configuration ':CordovaLib:classpath'.
> Could not resolve com.android.tools.build:gradle:1.0.0+.
Required by:
android:CordovaLib:unspecified
> Could not resolve com.android.tools.build:gradle:1.0.0+.
> Failed to list versions for com.android.tools.build:gradle.
> Unable to load Maven meta-data from https://jcenter.bintray.com/com/android/tools/build/gradle/maven-metadata.xml.
> Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/maven-metadata.xml'.
> peer not authenticated
le righe importanti sono quelle in grassetto
che ci sia maven o bintray, dopo una mia modifica, non importa. 
se notate all'inizio dell'indirizzo c'è https 
praticamente gradle non riesce a scaricare le info per scaricare i pacchetti perchè è peer not authenticate, ossia manca il certificato su java
cos' dopo un po' di analisi e ricerche questa è stata la soluzione: impostare lindirizzo da https a http
come fare?
in tutti i files build.gradle del progetto cercate: 
 repositories {
      centralMaven()
 }
oppure
 repositories {
      jcenter()
 }
e sostituite con
repositories {
    maven{
           url 'http://repo1.maven.org/maven2'
        }
}
oppure
repositories {
    jcenter{
           url 'http://jcenter.bintray.com'
        }
}
ricordate che gradle è legato alla versione dell'sdk android che si usa
quindi gradle-2.2.1 con android 22 (cercare file con stringa distributionUrl)
Commenti
Posta un commento