Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49186

Failed to start empty project on Android Studio

$
0
0

@shoustin wrote:

Hello,

I installed new project from CLI:

 npm install -g cordova ionic
 ionic start AfCordovaDemo tabs
 ionic platform add android
 ionic build android

Everything is passed.
Now I open project in Android Studio and it asks me to update to last version Gradle from 1.13 to 1.14.1. I click ok and it installs me 1.14.1.

So my gradle-wrapper.properties looks like:

distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip

Now I can start project on Android.

But when I update root www and run:

ionic build android

I get error:

add to body class: platform-android

ANDROID_HOME=/Users/maxim/Library/Android/sdk

JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home

FAILURE: Build failed with an exception.

  • Where:
    Build file '/Users/maxim/Appsflyer/projects/DEMOS/AfCordovaDemo2/platforms/android/build.gradle' line: 20

  • What went wrong:
    A problem occurred evaluating root project 'android'.

    Failed to apply plugin [id 'com.android.application']
    Minimum supported Gradle version is 2.14.1. Current version is 2.13. If using the gradle wrapper, try editing the distributionUrl in /Users/maxim/Appsflyer/projects/DEMOS/AfCordovaDemo2/gradle/wrapper/gradle-wrapper.properties to gradle-2.14.1-all.zip

  • 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.534 secs

Error: /Users/maxim/Appsflyer/projects/DEMOS/AfCordovaDemo2/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

  • Where:
    Build file '/Users/maxim/Appsflyer/projects/DEMOS/AfCordovaDemo2/platforms/android/build.gradle' line: 20

  • What went wrong:
    A problem occurred evaluating root project 'android'.

    Failed to apply plugin [id 'com.android.application']
    Minimum supported Gradle version is 2.14.1. Current version is 2.13. If using the gradle wrapper, try editing the distributionUrl in /Users/maxim/Appsflyer/projects/DEMOS/AfCordovaDemo2/gradle/wrapper/gradle-wrapper.properties to gradle-2.14.1-all.zip

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

and version goes back to: gradle-2.13-all.zip in my my gradle-wrapper.properties

Looks like something has hardcoded version 2.13 and reset my new setttings,

[EDIT]

I entered to /android/cordova/lib/builders/GradleBuilder.js and changed:

 var distributionUrl = process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] || 'http\\://services.gradle.org/distributions/gradle-2.13-all.zip';

to:

var distributionUrl = 'http\\://services.gradle.org/distributions/gradle-3.1-all.zip';

From Android Studio runs -OK,

from ionic build android:

add to body class: platform-android

ANDROID_HOME=/Users/maxim/Library/Android/sdk

JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home



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 find com.android.tools.build:gradle:2.2.0.
        Searched in the following locations:
            https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.0/gradle-2.2.0.pom
            https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.0/gradle-2.2.0.jar
        Required by:
            project :CordovaLib

Any ideas?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49186

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>