Android Studio导入Eclipse项目出现乱码,真机运行汉字乱码。

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_27747197/article/details/72510270

今天导入了一个Eclipse项目之后代码中出现了乱码,我们根据logcat中的信息跳转到代码文件中,android   studio中代码文件上面会有一个提示


我们点击Reload in another encoding,然后选择GBK基本上就好了,不过有时候在真机运行的时候还有可能 出现乱码。这时候我们只要在项目的build.gradle文件中添加如下代码:

android{

...

compileOptions.encoding = "GBK"
...

}

这样就会完美解决啦~~

猜你喜欢

转载自blog.csdn.net/qq_27747197/article/details/72510270
今日推荐