Android Studio - AppIndex URI

Jpf*_*can 5 android google-play-services android-studio

我最近将我的Android Studio更新到2.1版本,以及我正在使用Gradle版本2.1.0的项目.我在代码中注释了一行与自动生成的App Indexing代码无关,现在,每当我尝试运行我的应用程序时,它崩溃并给我以下错误:

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
Run Code Online (Sandbox Code Playgroud)

我到处寻找并尝试了很多东西,更新目标版本,它所需的库,到目前为止没有任何工作,有人可以帮助我吗?

我用于编译的SDK是版本23,我使用的Google服务依赖是8.4.0

Ein*_* H. 3

我也被这个问题困扰了近两天。简而言之:在 Java 文件中搜索“sabanaviveenti.unisabana.lux.unisabana.appsabana/http/host/path”。您可能会在初始活动的 OnStart() 方法中找到它们。您需要将 sabanaviveenti.unisabana.lux.unisabana.appsabana 替换为包含主应用程序代码的包名称。例如这样的事情:

    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'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 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);
Run Code Online (Sandbox Code Playgroud)

我遇到这个问题的原因是因为我正在重构应用程序的代码并同时更新Android Studio和SDK。不知何故,这段代码是自动创建的。就我而言,该活动位于库包中,但应用程序中的主要活动是从该活动派生的,因此我没有直接看到原始活动代码。