最近接触到一些项目是GBK,之后导入到Android Studio中,打出的包乱码。主要原因是因为我的AS是设置了默认编码方式为UTF-8的。但是导入的项目编码是GBK。就导致了乱码。
具体解决方式,就是在gradle中添加如下红色部分:
android { compileSdkVersion 19 buildToolsVersion "24.0.1" defaultConfig { applicationId "com.hehe.hehe" minSdkVersion 18 targetSdkVersion 21 } buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt' } } compileOptions { encoding "GBK" } }