问题描述
软件部署到手机上时中文显示全是乱码,问题排查后,原因是需要设置编码格式。
解决办法
在build.grandle文件中加入红色横线标注的代码。
android {
compileSdkVersion 19
buildToolsVersion '25.0.2'
android {compileOptions.encoding = "GBK"} /////////增加的内容,可以解决部署到设备上汉字显示乱码的问题 ---- 牛逼
defaultConfig {
applicationId "com.cmw.android.widgets"
minSdkVersion 8
targetSdkVersion 8
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
}
修改后的测试结果: