簡體   English   中英

buildTypes不起作用build.gradle Android Studio

[英]buildTypes not working build.gradle Android Studio

我是Android Studio的新手,我需要添加:

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

在我的build.gradle Android Studio中,但出現錯誤:

找不到Gradle DSL方法:“ buildTypes()”

嘗試從“文件->項目結構”中配置buildTypes並選擇您的模塊,您可以在右側面板上輕松配置所有內容。

您確定構建文件設置正確嗎?

buildTypes必須在android閉包中。 它應該看起來像這樣

注意:這只是一個示例,您不能僅復制並粘貼此示例

android {
compileSdkVersion "Google Inc.:Glass Development Kit Preview:19"
buildToolsVersion "21.1.2"

defaultConfig {
    applicationId "com.your.package"
    minSdkVersion 19
    targetSdkVersion 21
    versionCode 1
    versionName "1.0"
}

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_7
    targetCompatibility JavaVersion.VERSION_1_7
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

希望這對您有用

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM