问题一:版本问题:项目中的版本和IDE的版本不一样
解决方案:
File->Project Structure->app->Properties
修改sdk版本和build tools版本,为编译器现有的版本
问题一、解决Could not find method android() for arguments问题
在导入新项目的时候,发现一直有个bug存在,编译出现如下错误:
Error:(23, 0) Could not find method android() for arguments [****] on root project '****' of type org.gradle.api.Project.
最终解决方案:打开项目gradle目录如下:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.novoda:bintray-release:0.3.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
android {
compileSdkVersion 23
buildToolsVersion '23.0.3'
}
dependencies {
}
将其中的
android {
compileSdkVersion 23
buildToolsVersion '23.0.3'
}
删除或注释掉后重新编译通过。
问题二、android studio中文乱码各种情况的解决办法
Android Studio导入Eclipse的android项目java文件出现中文乱码,比如中文注释,中文提示等乱码,这一般是Eclipse中是gbk,到了Android Studio后默认utf-8格式打开的缘故。
1、注释中文出现乱码
解决方法:在 Android Studio 的设置菜单中找到修改编码的地方。如下:
File > Settings > Editor > File Encodings 里 Project Encoding 改为 GBK,为了统一规范,我也将其它 Encoding 项也设置为 GBK了。
2、用虚拟机运行应用时APP界面文字乱码。
解决办法:在Gradle Scripts -> build.gradle中的如下下图位置添加:
android{compileOptions.encoding=”GBK”}
即
注意,别加到project的bulid.gradle里去。
3、前两项做完之后关闭Android Studio重启运行乱码就会变成中文