Adding modules from GIT to Android Studio throws a “buildToolsVersion is not specified” error… here is a solution to the problem.
Adding modules from GIT to Android Studio throws a “buildToolsVersion is not specified” error
I want to include this Color Picker into my Android Studio project.
So I checked it out to a local folder and added it to my project using the “New-> Import Module Dialog in Android Studio”.
Then I add these two 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 reporting errors
Error:Cause: buildToolsVersion is not specified.
If I don’t add the first line to the gradle file (exactly as described by the color picker) then I’ll get
Error:(3, 0) Could not find method android() for arguments [build_xxxxx] on project ‘:app’ of type org.gradle.api.Project.
How to solve it?