开发中遇到的Bug和解决方法

android.view.WindowManager$BadTokenException: Unable to add window --token nullis not valid; is your activity running?

最后终于发现是PopupWindow组件的使用问题,如果你直接在Activity创建的方法中初始化,则会有此错误

因此总结:PopupWindow必须在某个事件中显示或者是开启一个新线程去调用,不能直在oncreate方法中显示一个PopupWindow,否则永远会有以上错误


EventBusException:its super classes have no public methods with the @Subscribe annotation

EventBus.getDefault().register(this);报错了。

这里的解决办法是:这里只要在 onEventMainThread 这个回调 方法上加上 @Subscribe 注解就可以了。


Gradle DSL method not found: 'runProguard()'

old:

buildTypes{release{runProguardfalse// 已经被废弃并且停止使用了......}}

new:

buildTypes{release{minifyEnabledfalse// 替代的方式......}}


Gradle DSL method not found: ‘android()’

解决方法: 删掉最外层的build.gradle中的 

android { 

    compileSdkVersion 19 

    buildToolsVersion '21.1.1' 

然后重新刷新就ok了

你可能感兴趣的:(开发中遇到的Bug和解决方法)