java.lang.IllegalArgumentException: AppIndex: The URI host must match the package name and follow th
2016-03-30 19:21
706 查看
最近开始使用android studio进行开发,开发过程中突然出现一个很奇怪的问题,编译总是失败,后来发现工程引用的一个包里面的Androidmanifest.xml里多了几行这样的代码:
<!-- ATTENTION: This was auto-generated to add Google Play services to your project for App Indexing. See https://g.co/AppIndexing/AndroidStudio for more information. --> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
另外,该包里面的某个Activity也多了些代码:
<pre name="code" class="java"><pre name="code" class="javascript"><pre name="code" class="java">@Overridepublic void onStart() {super.onStart();// ATTENTION: This was auto-generated to implement the App Indexing API.// See https://g.co/AppIndexing/AndroidStudio for more information.client.connect();Action viewAction = Action.newAction(Action.TYPE_VIEW, // TODO: choose an action type."McldActivityBoxVideo Page", // TODO: Define a title for the content shown.// TODO: If you have web page content that matches this app activity's content,// make sure this auto-generated web page URL is correct.// Otherwise, set the URL to null.Uri.parse("http://host/path"),// TODO: Make sure this auto-generated app deep link URI is correct.Uri.parse("android-app://com.mining.cloud/http/host/path"));AppIndex.AppIndexApi.start(client, viewAction);}
<pre name="code" class="java"> @Overridepublic void onStop() {super.onStop();// ATTENTION: This was auto-generated to implement the App Indexing API.// See https://g.co/AppIndexing/AndroidStudio for more information.Action viewAction = Action.newAction(Action.TYPE_VIEW, // TODO: choose an action type."McldActivityBoxVideo Page", // TODO: Define a title for the content shown.// TODO: If you have web page content that matches this app activity's content,// make sure this auto-generated web page URL is correct.// Otherwise, set the URL to null.Uri.parse("http://host/path"),// TODO: Make sure this auto-generated app deep link URI is correct.Uri.parse("android-app://com.mining.cloud/http/host/path"));AppIndex.AppIndexApi.end(client, viewAction);client.disconnect();}删掉Androidmanifest.xml中的自动生成的代码,工程可以跑起来,但是进入上面那个Activity时出现异常退出程序:
<pre name="code" class="java">java.lang.IllegalArgumentException: AppIndex: The URI host must match the package name and follow the format (android-app://<package_name>/<scheme>/[host_path]). Provided URI: android-app://com.mining.cloud/http/host/patjava.lang.RuntimeException: Unable to start activity ComponentInfo{com.vimtag.vimtaga/com.mining.cloud.McldActivityTabVideo}: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.vimtag.vimtaga/com.mining.cloud.McldActivityBoxVideo}: java.lang.IllegalArgumentException: AppIndex: The URI host must match the package name and follow the format (android-app://<package_name>/<scheme>/[host_path]). Provided URI: android-app://com.mining.cloud/http/host/pathat android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2201)at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2255)at android.app.ActivityThread.access$800(ActivityThread.java:142)at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1213)at android.os.Handler.dispatchMessage(Handler.java:102)at android.os.Looper.loop(Looper.java:136)at android.app.ActivityThread.main(ActivityThread.java:5217)at java.lang.reflect.Method.invokeNative(Native Method)at java.lang.reflect.Method.invoke(Method.java:515)at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:818)at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:634)at dalvik.system.NativeStart.main(Native Method)Caused by: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.vimtag.vimtaga/com.mining.cloud.McldActivityBoxVideo}: java.lang.IllegalArgumentException: AppIndex: The URI host must match the package name and follow the format (android-app://<package_name>/<scheme>/[host_path]). Provided URI: android-app://com.mining.cloud/http/host/pathat android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2201)at android.app.ActivityThread.startActivityNow(ActivityThread.java:2041)at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:135)at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:347)at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:749)at android.widget.TabHost.setCurrentTab(TabHost.java:413)at android.widget.TabHost.addTab(TabHost.java:240)at com.mining.cloud.McldActivityTabVideo.init(McldActivityTabVideo.java:223)at com.mining.cloud.McldActivityTabVideo.onCreate(McldActivityTabVideo.java:61)at android.app.Activity.performCreate(Activity.java:5303)at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1091)at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2165)at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2255) at android.app.ActivityThread.access$800(ActivityThread.java:142) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1213) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5217) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:818) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:634) at dalvik.system.NativeStart.main(Native Method)
然后,把这个Activity中系统自动生成的代码删除,恢复正常!
相关文章推荐
- 微信Token验证代码的实现
- Android小项目:记事本
- Android 5.0 MTK平台下Contacts的Android.mk文件分析
- Android 嵌套ViewPager实现连贯双滑动
- iOS storyboard中设置TableView的headerview 和 footerview
- IOS学习之——背景平铺
- android 屏幕旋转180度
- Android_ondraw()和dispatchdraw()的区别
- 如何让android的service一直在后台运行
- Android4.4隐藏状态栏
- IOS学习之——位图上下文 -- 水印图片
- IOS学习之—— 定时器 NSTimer 和 CADisplayLink 类的使用
- IOS学习之——图形上下文
- IOS学习之——Modal( 登陆,注册)
- Android跨进程通讯的四种方式
- 微信支付v3开发(5) 扫码并输入金额支付
- 微信支付v3开发(5) 扫码并输入金额支付
- Unity3D热更新<三> Me-slua 框架
- IOS-推送通知
- 微信支付v3开发(6) 收货地址共享接口