首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >安卓应用索引-> FirebaseAppIndexingInvalidArgumentException

安卓应用索引-> FirebaseAppIndexingInvalidArgumentException
EN

Stack Overflow用户
提问于 2016-12-15 01:15:49
回答 4查看 1.2K关注 0票数 5

嘿!

我正在尝试实现应用程序索引内容,我已经从app-indexing Google codelabs示例开始。

运行此代码

代码语言:javascript
复制
 Indexable recipeToIndex = new Indexable.Builder()
           .setName(mRecipe.getTitle())
           .setUrl(mRecipe.getRecipeUrl())
           .setImage(mRecipe.getPhoto())
           .setDescription(mRecipe.getDescription())
           .build();

 FirebaseAppIndex.getInstance().update(recipeToIndex); 

始终导致update()方法引发FirebaseAppIndexingInvalidArgumentException

代码语言:javascript
复制
com.google.firebase.appindexing.FirebaseAppIndexingInvalidArgumentException: Intent 'Intent { act=android.intent.action.VIEW dat=http://example.com pkg=com.example }' cannot be resolved. The invalid indexable is: Indexable { { id: 'http://example.com/123' } Properties { { key: 'name' value: [ 'test_name' ] } } Metadata { worksOffline: false, score: 0 } }
                          at com.google.firebase.appindexing.internal.zzn.zzb(Unknown Source)
                          at com.google.firebase.appindexing.internal.zzd$zzc$1.onComplete(Unknown Source)
                          at com.google.android.gms.tasks.zzc$1.run(Unknown Source)
                          at android.os.Handler.handleCallback(Handler.java:739)
                          at android.os.Handler.dispatchMessage(Handler.java:95)
                          at android.os.Looper.loop(Looper.java:145)
                          at android.app.ActivityThread.main(ActivityThread.java:5951)
                          at java.lang.reflect.Method.invoke(Native Method)
                          at java.lang.reflect.Method.invoke(Method.java:372)
                          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)
                          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)

您对如何将镜像添加到Indexable有什么建议吗

EN

回答 4

Stack Overflow用户

发布于 2017-07-21 14:00:09

我得到这个错误的原因是因为我正在测试的应用程序的清单中没有意图过滤器。

确保您在可索引对象上设置的url在清单中有匹配的条目。

代码语言:javascript
复制
    <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

            <intent-filter android:label="@string/app_name" android:autoVerify="true">
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data android:scheme="http"
                    android:host="century.com"
                    android:pathPrefix="/recipe" />
            </intent-filter>
        </activity>

票数 2
EN

Stack Overflow用户

发布于 2017-03-30 01:38:30

删除图像消息或像这样编辑代码。

代码语言:javascript
复制
if (friendlyMessage.getText() != null) {
   FirebaseAppIndex.getInstance().update(getMessageIndexable(friendlyMessage));
}
FirebaseUserActions.getInstance().end(getMessageViewAction(friendlyMessage));

似乎本教程没有考虑没有消息的消息。所有的消息应该是文字或文字与图像。要修复它,您应该检查。https://github.com/firebase/friendlychat/issues/160

票数 1
EN

Stack Overflow用户

发布于 2018-01-02 06:16:17

确保setUrl()收到格式正确的URL,我的是http://app.com//path

//之前的路径导致了问题

代码语言:javascript
复制
  Indexable recipeToIndex = new Indexable.Builder()
           .setName(mRecipe.getTitle())
           .setUrl(Uri.parse(mRecipe.getRecipeUrl()).toString())
           .setImage(Uri.parse(mRecipe.getPhoto()).toString())
           .setDescription(mRecipe.getDescription())
           .build();

这对于setImage来说并不是那么重要

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41148442

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档