Android开发问题集锦1
一些显而易见的问题记录下
问题1:调用JNI本地方法的时候没权限崩溃
1
2
30-18 14:04:44.376 13889-13889/downjoy.com.h5game A/art: art/
runtime/check_jni.cc:65] JNI DETECTED ERROR IN APPLICATION: JNI
GetObjectClass called with pending exception 'java.lang.SecurityException' throw in unknown location出现这个问题是因为本地jni调用了一些方法需要一些权限,这些权限应该在manifest中声明
问题2:TextView即使使用了setText()方法的Html.fromHtml(string)也不会正常显示HTML效果
string中不能带div标签,如果要显示带div标签的字符,使用以下比较好:
1
2mWebView.loadDataWithBaseURL(null, mWebViewText, "text/html",
"utf-8", null);
问题3:小米5 6.0系统在调用系统安装方式的时候,闪退
下载安装的文件路径后缀名必须为.apk才能进行安装,不然则会闪退。
问题4:使用权限时在6.0以上机器崩溃
1
2
3java.lang.SecurityException: No permission to write to /storage/
emulated/0/Download/llnhvrrpg_1477646494236.apk: Neither user 10404
nor current process has简单的在build.gradle里面修改 targetSdkVersion 21
问题5:testin兼容测试报告安装失败“INSTALL_FAILED_OLDER_SDK“
简单的在build.gradle里面修改 minSdkVersion 为15合适的版本(4.0)?
问题6:WebView崩溃
1
java.lang.Throwable: Error: WebView.destroy() called while still attached!
修改如下:
1
2
3
4
5
6
7
8
9
10
11
protected void onDestroy() {
cleanCookie();
if (mWebView != null) {
mWebView.removeAllViews();
((ViewGroup) mWebView.getParent()).removeView(mWebView);
mWebView.destroy();
mWebView = null;
}
super.onDestroy();
}问题7 :DialogFragment异常崩溃
1
2java.lang.IllegalStateException: Can not perform this action after
onSaveInstanceState with DialogFragment1
2
3//第一个参数要使用activity.getFragmentManager().beginTransaction()
dialogFragment.show(activity.getFragmentManager().beginTransaction(),
dialogFragment.getClass().getName());