Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add Module from GIT to Android Studio throws "buildToolsVersion is not specified" error

I want to include this Color Picker into my Android Studio project.

So I checked it out into a local folder, added it to my project with the "New->Import Module Dialog in Android Studio.

Then I added those 2 lines to my app.gradle file

apply plugin: 'com.android.application'
...
compile project(':colorpicker')

Here is the complete gradle file

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion '24.0.2'

    defaultConfig {
        applicationId "com.mydomain.myapp"
        minSdkVersion 17
        targetSdkVersion 24
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

repositories {
    maven { url "https://jitpack.io" }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile fileTree(include: ['dtp_library'], dir: 'libs')
    compile project(':libs:dtp_library')
    compile 'com.android.support:design:24.2.1'        
    compile project(':colorpicker')
}

But I keep getting the error

Error:Cause: buildToolsVersion is not specified.

If I do not add the first line to the gradle file (do it exactly like the color picker description said) then I get

Error:(3, 0) Could not find method android() for arguments [build_xxxxx] on project ':app' of type org.gradle.api.Project.

How to fix it?

like image 788
juergen d Avatar asked Feb 07 '23 00:02

juergen d


1 Answers

Follow the steps :

Open the build.gradle file of color picker module

enter image description here

so in your case add these lines to build.gradle file of colorpicker module

compileSdkVersion 24
buildToolsVersion '24.0.2'
like image 84
Pavneet_Singh Avatar answered Feb 08 '23 15:02

Pavneet_Singh