java.lang.IllegalArgumentException: AppIndex: The URI host must match the package name and follow th

最近开始使用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">@Override
	 public 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"> @Override
	 public 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/pat

java.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/path
                                                                at 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/path
                                                                at 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中系统自动生成的代码删除,恢复正常!

 
 
 
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

oyezitan

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值