Android 在Emulator上请求应用程序下载时ActivityNotFound异常

Android 在Emulator上请求应用程序下载时ActivityNotFound异常,android,android-emulator,Android,Android Emulator,我尝试使用intent下载apk文件 Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(uri,"application/vnd.android.package-archive"); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); 我有个例外 02-05 16:48:35

我尝试使用intent下载apk文件

 Intent intent = new Intent(Intent.ACTION_VIEW);           
 intent.setDataAndType(uri,"application/vnd.android.package-archive");
 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);     
 startActivity(intent);
我有个例外

 02-05 16:48:35.207: E/AndroidRuntime(2719): FATAL EXCEPTION: main
02-05 16:48:35.207: E/AndroidRuntime(2719): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=http://192.168.102.157:8080/ApkDownload/Download typ=application/vnd.android.package-archive }
02-05 16:48:35.207: E/AndroidRuntime(2719):     at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1545)
02-05 16:48:35.207: E/AndroidRuntime(2719):     at android.app.Instrumentation.execStartActivity(Instrumentation.java:1416)

系统安装程序只能打开本地文件系统上存在的APK文件。您可以自己下载APK,然后安装它,也可以使用相同的意图(不使用mime类型)使用默认浏览器下载它(然后用户必须单击下载的文件才能安装它)

好的,你得到的异常是因为你的android模拟器没有安装Google Play

在任何实际设备上测试它应该不会有任何问题


有关Google Play On Emulator的更多信息请访问此链接

请添加更多信息。。你从哪里下载的?您正在提取apk表单电话吗?或者你有自己的服务器?你在emulator上测试吗?@Mr.Me是的,在emulator操作系统版本4.1中,你可以检查这个,我不想安装应用程序。我只需要下载应用程序并将其存储在其他地方,或者将其存储在SDCard的下载文件夹中,然后使用以下行下载它:intent.setData(uri);