Could not execute build using Gradle with Crashlyt

2019-07-22 01:34发布

问题:

I'm trying to integrate my current projects with crashlytics, i'm following this step.

my build gradle is :

buildscript {
    repositories {
        mavenCentral()
        maven { url 'http://download.crashlytics.com/maven' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.8.+'
        classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.1'
    }
}

apply plugin: 'android'
apply plugin: 'crashlytics'
apply plugin: 'android-apt'

repositories {
    mavenCentral()
    maven { url 'http://download.crashlytics.com/maven' }
}

apt {
    arguments {
        androidManifestFile variant.processResources.manifestFile
        resourcePackageName "com.sample.app"
    }
}

android {
    compileSdkVersion 19
    buildToolsVersion "19.0.3"

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile 'com.crashlytics.android:crashlytics:1.+'
    apt "org.androidannotations:androidannotations:3.0+"
    compile "org.androidannotations:androidannotations-api:3.0+"
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:support-v4:19.0.+'
    compile 'com.viewpagerindicator:library:2.4.1@aar'
}

After gradle sync and build, i always get

Error:org.gradle.tooling.GradleConnectionException: Could not execute build using Gradle installation.

If i remove crashlytics,it works. Is there any configuration that i'm missing ?

回答1:

I had the same problem and after contacting Crashlytics support they asked to send them my crashlytics log file, which can be found at:

On Linux / Windows: ~/.crashlytics/com.crashlytics.tools/crashlytics.log

On Mac: ~/Library/Caches/com.crashlytics/com.crashlytics.tools/crashlytics.log

And there I found the source of MY problem: value of my API key in manifest was android:value="@string/app_crashlytics_apiKey", instead of directly defining it value like android:value="123...."

I suppose, log should help you to find out source of your problem.



回答2:

This might be a bit old but helped me out.

The below is from https://stackoverflow.com/a/27387994/2754838

There is an update with Android Studio, you need to migrate your Gradle configurations : http://tools.android.com/tech-docs/new-build-system/migrating-to-1-0-0

Replace runProguard with minifyEnabled Replace zipAlign with zipAlignEnabled etc...

Shout outs to https://stackoverflow.com/users/4295766/gautier-drusch