Android 报错

版权声明:没事随便转 https://blog.csdn.net/qq_41816123/article/details/84973225

1.进入activity防止自动弹出输入法和顶上底部导航栏

在清单文件Androidmainfest.xml文件中activity增加属性android:windowSoftInputMode=“adjustPan”,就可以了

<activity   android:name=".MainActivity"
            android:windowSoftInputMode="adjustPan"
            />

2.Error:Execution failed for task ‘:app:compileDebugJavaWithJavac’ 解决方案

在这里插入图片描述
gradlew compileDebugJavaWithJavac 然后点击enter 会提示你错误

3.Error:Execution failed for task ‘:app:preDebugAndroidTestBuild’.

Conflict with dependency ‘com.android.support:support-annotations’ in project ‘:app’. Resolved versions for app (26.1.0) and test app (27.1.1) differ. See https://d.android.com/r/tools/test-apk-dependency-conflicts.html for details.

这个错误大概的意思是sdk的问题,具体我也没深究。网上说的加
在app下的build.gradle文件中的dependences {}中添加如下代码:

androidTestCompile('com.android.support:support-annotations:26.1.0') {
    force = true
}

并没有解决我的问题,
真正解决的办法是
在module配置下
把下面的3行干掉
在这里插入图片描述
ok成功了,如果你用ConstraintLayout进行拖拽布局的话,就不能这样。

再说一下ConstraintLayout的优点

1.在开发层级较少的功能型app时用传统的五大布局应该就可以了。这样控件的属性也是简洁明了
2.在开发层级较多的娱乐型app时可以用ConstraintLayout进行布局,这样可以减少布局层级,提高性能。它更多的类似于相对布局。

4.Service not registered

直接加

private boolean isBind = false;
isBind = bindService(svcMgrIntent, this, Context.BIND_AUTO_CREATE);
if (isBind) {
           unbindService(this);
            isBind =false;
        }

5.Warning:Ignoring InnerClasses attribute for an anonymous inner class

在工程的混淆配置文件 proguard-rules.pro 中加入下面这句代码即可:

-keepattributes EnclosingMethod

这个会持续更的

猜你喜欢

转载自blog.csdn.net/qq_41816123/article/details/84973225