Android Channel is unrecoverably broken and will be disposed!问题解决
来源:互联网 发布:竞价调价软件 编辑:程序博客网 时间:2024/06/16 10:57
大概问题来源:
程序需要webview加载h5界面,但有一个H5界面非常怪,进入界面什么问题也没有,从桌面回来,分享回来也没有问题,但中跳转Activity或者关闭当前webivew的Activity时,就闪退重启了!!!
log:
E/ANDR-PERF-OPTSHANDLER: perf_lock_rel: updated /sys/class/scsi_host/host0/../../../clkscale_enable with 1 return value 2E/cnss-daemon: Stale or unreachable neighbors, ndm state: 4E/ConnectivityService: RemoteException caught trying to send a callback msg for NetworkRequest [ id=421, legacyType=-1, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED] ]E/ConnectivityService: RemoteException caught trying to send a callback msg for NetworkRequest [ id=422, legacyType=-1, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED] ]E/cnss-daemon: Stale or unreachable neighbors, ndm state: 4E/InputDispatcher: channel '694a7a5 com.cyy.demo/com.cyy.demo.client.main.activity.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!E/InputDispatcher: channel '4ccdb88 com.cyy.demo/com.cyy.demo.client.main.activity.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!E/InputDispatcher: channel 'a704bbf com.cyy.demo/com.cyy.demo.client.quickorder.activity.QuickHandleOrderActivity (server)' ~ Channel is unrecoverably broken and will be disposed!E/InputDispatcher: channel '25d6073 com.cyy.demo/com.cyy.demo.framework.base.CommWebActivity (server)' ~ Channel is unrecoverably broken and will be disposed!E/ANDR-PERF-OPTSHANDLER: perf_lock_rel: updated /sys/class/scsi_host/host0/../../../clkscale_enable with 1 return value 2
然后就考虑换第三方webview了,最终选择了TBS(腾讯浏览服务)
sdk下载:https://x5.tencent.com/tbs/sdk.html#选择他是因为是中文,不用在github找到还要翻译,其二是因为有jar接入,方便:
最后上代码:
import java.net.MalformedURLException;import java.net.URL;import java.net.URLDecoder;import java.util.List;public class CommWebActivity extends BaseActivity {private WebView mWebView;public static final String KEY_URL = "key_url";public static final String KEY_TITLE = "key_title";public static void openWeb(Context c, String url) {openWeb(c, url, null);}/** * * @param c * Context * @param url * url * @param title * 显示title,当title为""时,自动获取url的title */public static void openWeb(Context c, String url, String title) {if (StringUtil.isEmpty(url)) {return;}Intent intent = new Intent(c, CommWebActivity.class);intent.putExtra(KEY_URL, url);intent.putExtra(KEY_TITLE, title);c.startActivity(intent);}@Overrideprotected void onCreate(Bundle bundle) {super.onCreate(bundle);setContentView(R.layout.activity_web);setLeftText("返回");initView();initData();}public void initView() {mWebView = (WebView) findViewById(R.id.webview);}@SuppressLint("SetJavaScriptEnabled")public void initData() {String url = getIntent().getStringExtra(KEY_URL);if (StringUtil.isEmpty(url)) {finish();return;}String title = getIntent().getStringExtra(KEY_TITLE);if (null == title) {hideTitle(true);} else {setTitleText(title);}com.tencent.smtt.sdk.WebSettings settings = mWebView.getSettings();settings.setJavaScriptEnabled(true);settings.setCacheMode(WebSettings.LOAD_NO_CACHE);mWebView.setWebChromeClient(new WebChromeClient() {public boolean onJsAlert(WebView view, String url, String message, final JsResult result) {AlertDialog.Builder builder = new AlertDialog.Builder(CommWebActivity.this);builder.setCancelable(false).setTitle("温馨提示").setMessage(message).setNeutralButton("确定", new DialogInterface.OnClickListener() {@Overridepublic void onClick(DialogInterface arg0, int arg1) {finish();}}).show();result.cancel();return true;}});mWebView.setWebViewClient(new WebViewClient() {@Overridepublic boolean shouldOverrideUrlLoading(WebView view, String url) {if (url.startsWith("tel:")) {Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));startActivity(intent);return true;}return super.shouldOverrideUrlLoading(view, url);}@Overridepublic void onPageStarted(WebView view, String url, Bitmap favicon) {// showLoadDialog();showProgressDialog();super.onPageStarted(view, url, favicon);}@Overridepublic void onPageFinished(WebView view, String url) {super.onPageFinished(view, url);dismissProgressDialog();if (TextUtils.isEmpty(getTitleText())) {setTitleText(mWebView.getTitle());}}});mWebView.loadUrl(url);}@Overridepublic boolean onKeyDown(int keyCode, KeyEvent event) {if (keyCode == KeyEvent.KEYCODE_BACK) {if (mWebView.canGoBack()) {mWebView.goBack();return true;}}return super.onKeyDown(keyCode, event);}@Overrideprotected void onDestroy() {super.onDestroy();if (mWebView != null) {mWebView.destroy();}}}
最后在Application要加上:
super.onCreate();//搜集本地tbs内核信息并上报服务器,服务器返回结果决定使用哪个内核。QbSdk.PreInitCallback cb = new QbSdk.PreInitCallback() {@Overridepublic void onViewInitFinished(boolean arg0) {// TODO Auto-generated method stub//x5內核初始化完成的回调,为true表示x5内核加载成功,否则表示x5内核加载失败,会自动切换到系统内核。Log.d("app", " onViewInitFinished is " + arg0);}@Overridepublic void onCoreInitFinished() {// TODO Auto-generated method stub}};//x5内核初始化接口QbSdk.initX5Environment(getApplicationContext(), cb);
阅读全文
0 0
- Android Channel is unrecoverably broken and will be disposed!问题解决
- Android错误:Channel is unrecoverably broken and will be disposed!
- channel ~ Channel is unrecoverably broken and will be disposed!
- Channel is unrecoverably broken and will be disposed!
- Channel is unrecoverably broken and will be disposed!
- Channel is unrecoverably broken and will be disposed!
- Channel is unrecoverably broken and will be disposed!
- Channel is unrecoverably broken and will be disposed!
- Channel is unrecoverably broken and will be disposed
- Channel is unrecoverably broken and will be disposed!
- Android 程序报错:Channel is unrecoverably broken and will be disposed!
- Android Exception 10((server)' ~ Channel is unrecoverably broken and will be disposed!)
- Android开发错误记录:MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
- InputDispatcher: MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
- 开发错误记录2 .MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
- Consumer closed input channel or an error occurred/Channel is unrecoverably broken and will be dispo
- E/InputDispatcher: channel '32d434a4 Toast (server)' ~ Channel is unrecoverably broken and will be d
- WARNING:XXX is deprecated and will be removed...
- Spring源码分析3 — spring XML配置文件的解析流程
- AndroidStudio中内置的Git可视化工具 Git integration
- [POJ]1673 混合欧拉图判定
- Day26-Filter
- 邮票分你一半 时间限制:1000 ms | 内存限制:65535 KB 难度:3 描述 小珂最近收集了些邮票,他想把其中的一些给他的好朋友小明。每张邮票上都有分值,他们想把这些邮票分成两
- Android Channel is unrecoverably broken and will be disposed!问题解决
- RabbitMQ 学习笔记(三):Publish/Subscribe
- Java内部类的简单记忆
- 行为识别特征提取综述 ————2014年6月
- 五、Linux——结构体
- html 如何引入一个公共的头部和底部(不使用模版引擎如jsp、freemarker、velocity的方式)
- ZCMU-1898 Trainsorting
- 《菜鸟反攻战》第一章----java注解
- 1073 约瑟夫环(递推)