微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

java – 从GIT添加模块到Android Studio会抛出“未指定buildToolsVersion”错误

我想在我的Android Studio项目中加入this Color Picker.

所以我把它检查到一个本地文件夹,用Android Studio中的“New-> Import Module Dialog”将它添加到我的项目中.

然后我将这两行添加到我的app.gradle文件

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

这是完整的gradle文件

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')
}

但我一直在收到错误

Error:Cause: buildToolsversion is not specified.

如果我没有将第一行添加到gradle文件(完全像颜色选择器描述所说的那样),那么我得到了

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

怎么解决

解决方法:

按照步骤 :

打开颜色选择器模块的build.gradle文件

enter image description here

所以在你的情况下,将这些行添加到colorpicker模块的build.gradle文件

compileSdkVersion 24
buildToolsversion '24.0.2'

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐