ITeye博客

AndroidStudio用gradle编译中文乱码

jackeysion · 2015-06-12 21:51 · 移动开发 · Markdown

在Gradle Scripts下的 build.gradle(Module:app)文件中,增加一行代码:


    android { compileOptions.encoding = "GBK" }

该文件全文如下:(加粗部分是关键)

apply plugin: 'com.android.application'

android { compileSdkVersion 22 buildToolsVersion "22.0.1"

**android { compileOptions.encoding = "GBK" }**

defaultConfig {
    applicationId "com.jksoft.ebooks"
    minSdkVersion 15
    targetSdkVersion 22
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

}

dependencies { compile fileTree(dir: 'libs', include: ) compile 'com.android.support:appcompat-v7:22.1.1' }

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。