Android Studio - URI AppIndex

I recently upgraded my Android studio to version 2.1 and the project I was working on to version Gradle version 2.1.0. I commented out a line in my code that has nothing to do with the application indexing code that is automatically generated, and now when I try to run my application, it crashes and gives me the following error:

java.lang.RuntimeException: Unable to start activity ComponentInfo{lux.unisabana.sabanaviveenti/sabanaviveenti.unisabana.lux.unisabana.appsabana.MainActivity}: java.lang.IllegalArgumentException: AppIndex: The android-app URI host must match the package name and follow the format android-app://<package_name>/<scheme>/[host_path]. Provided URI: android-app://sabanaviveenti.unisabana.lux.unisabana.appsabana/http/host/path 

I searched everywhere and did a lot of things, updated the target versions, the libraries needed for this, and nothing worked so far, can anyone help me?

The SDK I use to compile is version 23 and the dependency on the Google services I use is 8.4.0

+5
source share
1 answer

I also struggled with this problem for almost two days. In short: search through your Java files for "sabanaviveenti.unisabana.lux.unisabana.appsabana / http / host / path". You will probably find them in the OnStart () method of your initial activity. You need to replace sabanaviveenti.unisabana.lux.unisabana.appsabana with the name of the package that contains your main application code. For instance. something like that:

  Action viewAction=Action.newAction( Action.TYPE_VIEW, // TODO: choose an action type. "LogTasks Page", // TODO: Define a title for the content shown. // TODO: If you have web page content that matches this app activity 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 URL is correct. // was: Uri.parse("android-app://sabanaviveenti.unisabana.lux.unisabana.appsabana/path"), Uri.parse("android-app://com.myserver.mypackage/http/host/path") ); AppIndex.AppIndexApi.start(client, viewAction); 

The reason I had a problem was because I restructured the application code while updating Android Studio and the SDK. Somehow this code was created automatically. In my case, the activity is in the library package, but the main activity in the application is derived from this action, so I did not see the source code of the operation directly.

+3
source

All Articles