android.content.ActivityNotFoundException: No Activity found to handle Intent

今天看友盟统计的一个bug

android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=www.storage.aliyun.com/doujiao/download/jinye.apk }
	at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1409)
	at android.app.Instrumentation.execStartActivity(Instrumentation.java:1379)
	at android.app.Activity.startActivityForResult(Activity.java:2827)
	at android.app.Activity.startActivity(Activity.java:2933)
	at com.doujiao.hotel.activity.Browsers$3.onDownloadStart(Browsers.java:100)
	at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:402)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loop(Looper.java:130)
	at android.app.ActivityThread.main(ActivityThread.java:3688)
	at java.lang.reflect.Method.invokeNative(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:507)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:875)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:633)
	at dalvik.system.NativeStart.main(Native Method)

异常出现在下面的代码里面,主要是url格式不对
        webview.setDownloadListener(new DownloadListener() {
            public void onDownloadStart(String url, String userAgent,
                    String contentDisposition, String mimetype,
                    long contentLength) {
                Uri uri = Uri.parse(url);
                Intent intent = new Intent(Intent.ACTION_VIEW, uri);
                startActivity(intent);

            }
        });
出现错误的原因是url不是以http开头的
下面的代码是会抛上面的异常的

Uri uri = Uri.parse("www.baidu.com");

Intent intent = new Intent(Intent.ACTION_VIEW,uri);

startActivity(intent);



你可能感兴趣的:(android.content.ActivityNotFoundException: No Activity found to handle Intent)