1.cannot resolve symbol xxx;
出错原因:没有导入相应的包。
解决方法:file-settings-auto import-all可导入全部包。ctrl+enter导入单个包。
2.只是创建了一个空项目,但是却编译出错。
解决方法:在gradle.properties文件中加入这样一句话 android.enableAapt2=false
3.真机调试时,no target device found,识别不了手机
解决方法:手机,设置-开发者选项-USB调试
4.点击调试时出现问题
Installation failed with message INSTALL_FAILED_USER_RESTRICTED: Install canceled by user. It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing.
解决方法:在手机上允许通过USB安装应用即可
5.尝试显示对话框时运行出现错误 You need to use a Theme.AppCompat theme(or descendent) with this activity
解决方法:网上有让活动继承Activity而不是AppCompatActivity,试了不行,还有一种方式是改style样式,原链接
http://blog.csdn.net/zxm317122667/article/details/50984644
试了,还是不行,最后发现需要改注册文件,原代码为:android:theme="@android:style/Theme.Dialog"
正确代码为:android:theme="@style/Theme.AppCompat.Dialog"