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://

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

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

最佳答案
我也一直在与这个问题作斗争近两天.
简而言之:在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);

我遇到问题的原因是因为我正在重组应用程序的代码并同时更新Android Studio和SDK.不知何故,这段代码自动创建的.在我的例子中,活动是在一个库包中,但是应用程序中的主要活动是从这个活动派生的,所以我没有直接看到原始的活动代码.

相关文章

Android性能优化——之控件的优化 前面讲了图像的优化,接下...
前言 上一篇已经讲了如何实现textView中粗字体效果,里面主要...
最近项目重构,涉及到了数据库和文件下载,发现GreenDao这个...
WebView加载页面的两种方式 一、加载网络页面 加载网络页面,...
给APP全局设置字体主要分为两个方面来介绍 一、给原生界面设...
前言 最近UI大牛出了一版新的效果图,按照IOS的效果做的,页...