1:Session 'example': Error Installing APKs

1.重新编译

2.重新插拔数据线

3.更改Studio的设置,将下方的第一个复选框的勾去掉

file-Setting-Instant Run

AS3.0报错

2:Error:Execution failed for task ':example:preDebugBuild'.
> Android dependency 'com.android.support:support-v4' has different version for the compile (22.2.1) and runtime (26.0.2) classpath. You should manually set the same version via DependencyResolution

解决办法:

项目中Project build.gradle(不是model),添加
 subprojects {
        project.configurations.all {
            resolutionStrategy.eachDependency { details ->
                if (details.requested.group == 'com.android.support'
                        && !details.requested.name.contains('multidex') ) {
                    details.useVersion "26.0.2"
                }
            }
        }

    }

3:activity界面一片空白的现象。

    老版本的adnroid sdk中对activity进行初始化,一般都是在oncreate(Bundle saveInstanceState)中进行,

5.0之后,多出来一个oncreate(Bundle saveInstanceState,PersisitanbleBundle persistentState);函数。

如果我们对布局的初始化放在了第二个中,则会显示一片空白。

     解决方法:将对布局的初始化等操作放在oncreate(Bundle saveInstanceState)函数中进行


相关文章: