androidtitan
androidtitan

Reputation: 671

Error:Cause: buildToolsVersion is not specified in build.grade (Project:xxx)

Right now I am trying to integrate Fabric with Crashlytics (https://docs.fabric.io/android/fabric/integration.html) into an existing android application.

Following the integration instructions provided by Fabric I add apply plugin: 'com.android.application' to the root directory of my "build.grade (Project.NumenuApp)" file. I click to Sync Gradle, it fails, and I receive this error Error:Cause: buildToolsVersion is not specified. Android studio states that my plugins should be declared at the Module not Project level.

I already have the buildTools set in the "build.grade (Module:app)" file. My question is why is this happening and what can I do to remedy it? I have posted my code below. Thanks in advance. - Adrian

build.grade (Project:NumenuApp)

// Top-level build file where you can add configuration options common to all     sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

allprojects {
    repositories {
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

build.grade (Module:app)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

defaultConfig {
    applicationId "com.numenu.numenuapp"
    minSdkVersion 21
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
    compile 'com.android.support:support-v4:23.1.1'
    compile 'com.android.support:recyclerview-v7:23.1.1'
}

Upvotes: 2

Views: 24858

Answers (3)

Gowthaman M
Gowthaman M

Reputation: 8282

Please check this line in your app.gradle present or not

buildToolsVersion "25.0.3"

Example

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.3"
    defaultConfig {
        applicationId "kc.care.task"
        minSdkVersion 20
        targetSdkVersion 25
        versionCode 23
        versionName "3.7"
        multiDexEnabled = true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }

Upvotes: 0

Gabriele Mariotti
Gabriele Mariotti

Reputation: 364770

You have to remove these lines from your build.gradle (Project:NumenuApp). You are using the wrong file to apply the plugins.

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

Also move these lines in your build.gradle (Module:app)

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

Upvotes: 8

SSH
SSH

Reputation: 1627

this is my build.gradle(Module:app) file and I have a working CrashLytics, and I have nothing related to fabrics in my project.gradle

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}

//apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.ws.cs"
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"

        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
        packagingOptions {
            exclude "/lib/arm64-v8a/librealm-jni.so"
        }
    }


    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.google.code.gson:gson:2.2.2'
    compile 'io.realm:realm-android:0.82.1'
    compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
        transitive = true;
    }


}

Upvotes: 3

Related Questions