Android 常见问题解决

1.Android 启动Activity后阻止EditText自动获取焦点

在EditText中添加如下属性即可

<LinearLayout
        android:focusable="true" 
        android:focusableInTouchMode="true"/>

2.在服务中更新通知栏进度条没效果

每次更新进度后都需要再调用一次 startForeground(),即:

notificationBuilder.setProgress(100,progress,false);
startForeground(1,notificationBuilder.build());

3.Invalid length for a Base-64 char array or string

上传base64图片出错

解决:修改服务端:

base64str = base64str.Trim().Replace(" ", "+");

4.Android Studio 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.

解决方式:

buidl.gradle(Module:app)dependencies 节点中添加:

compile 'com.android.support:support-annotations:27.1.1'
posted @ 2017-08-24 20:55  -Tiger  阅读(190)  评论(0编辑  收藏