Android Studio - AppIndex URI
Android Studio - AppIndex URI
我最近将 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
我到处查看并尝试了很多东西,更新了目标版本、它所需的库,但到目前为止没有任何效果,有人可以帮助我吗?
我用于编译的 SDK 是版本 23,我使用的 Google 服务依赖是 8.4.0
我也被这个问题困扰了将近两天。
简而言之:在 Java 文件中搜索 "sabanaviveenti.unisabana.lux.unisabana.appsabana/http/host/path"。您可能会在初始 activity 的 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);
我遇到问题的原因是因为我正在重构应用程序的代码并同时更新 Android Studio 和 SDK。不知何故,这段代码是自动创建的。在我的例子中,activity 在一个库包中,但是应用程序中的主要 activity 是从这个 activity 派生的,所以我没有看到原始的 activity 代码直接。
我最近将 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
我到处查看并尝试了很多东西,更新了目标版本、它所需的库,但到目前为止没有任何效果,有人可以帮助我吗?
我用于编译的 SDK 是版本 23,我使用的 Google 服务依赖是 8.4.0
我也被这个问题困扰了将近两天。 简而言之:在 Java 文件中搜索 "sabanaviveenti.unisabana.lux.unisabana.appsabana/http/host/path"。您可能会在初始 activity 的 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);
我遇到问题的原因是因为我正在重构应用程序的代码并同时更新 Android Studio 和 SDK。不知何故,这段代码是自动创建的。在我的例子中,activity 在一个库包中,但是应用程序中的主要 activity 是从这个 activity 派生的,所以我没有看到原始的 activity 代码直接。