1.
AndroidStudio3.1对应的gradle版本为4.4 使用compile依赖包都要替换为api或implementation,否则会一直gradle失败 compileSdkVersion 27 buildToolsVersion '27.0.3' api 'com.android.support:appcompat-v7:26.1.0' api 'com.android.support:recyclerview-v7:26.1.0' api 'com.android.support:design:26.1.0'
2.
升上3.1之后,gradle build总是出现“The option 'android.enableAapt2' is deprecated and should not be used anymore. Use 'android.enableAapt2=true' to remove this warning. 打开gradle.properties添加下面代码即可解决: android.enableAapt2=false
3.
The SourceSet 'instrumentTest' is not recognized by the Android Gradle Plugin. Perhaps you misspelled something? 旧版本 - > 新版本 instrumentTestCompile - > androidTestCompile instrumentTest - > androidTest
4.
Cannot resolve symbol KeyEventCompat(android.support.v4.view.KeyEventCompat找不到) 解决方案 KeyEventCompat类(我项目中用它的hasNoModifiers方法)最后查看源码 才知道这个hasNoModifiers方法已经被KeyEvent实现了。 贴出源码: //报错地方 // The focus finder had a bug handling FOCUS_FORWARD and FOCUS_BACKWARD // before Android 3.0. Ignore the tab key on those devices. // if (KeyEventCompat.hasNoModifiers(event)) { // handled = arrowScroll(FOCUS_FORWARD); // } else if (KeyEventCompat.hasModifiers(event, KeyEvent.META_SHIFT_ON)) { // handled = arrowScroll(FOCUS_BACKWARD); // } // http://blog.csdn.net/lrpshuai/article/details/78392872 //正确代码 if (event.hasNoModifiers()) { handled = arrowScroll(FOCUS_FORWARD); } else if (event.hasModifiers(KeyEvent.META_SHIFT_ON)) { handled = arrowScroll(FOCUS_BACKWARD); }
5.
创建项目后报错 com.android.ide.common.process.ProcessException:Failed to execute aapt 原因:在build.gradle文件中, compileSdkVersion 和buildToolsVersion 不匹配, 改成1中的 27和 27.0.3
最后,项目只能buildapk 不能发布到手机,然后将回3.0了,死到了gradle升级3.0以后的问题
error: style attribute '@android:attr/attr/windowBackground' not found.
网上搜的 都不行,appt false之后又给我报了一个
java.util.NoSuchElementException
定位不到错误位置,so放弃了
评论中大佬回复解决,请看评论