【发布时间】:2017-04-30 03:04:22
【问题描述】:
嘿嘿!
我正在尝试实现应用索引内容,并从app-indexing Google codelabs 示例开始。
运行此代码
Indexable recipeToIndex = new Indexable.Builder()
.setName(mRecipe.getTitle())
.setUrl(mRecipe.getRecipeUrl())
.setImage(mRecipe.getPhoto())
.setDescription(mRecipe.getDescription())
.build();
FirebaseAppIndex.getInstance().update(recipeToIndex);
总是导致update() 方法抛出FirebaseAppIndexingInvalidArgumentException。
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 有什么建议吗?
【问题讨论】:
-
你想将什么传递给 .setImage 函数?它必须是这样的照片 url:“example.com/salad.jpg”此外,提供的堆栈跟踪看起来很奇怪......该代码实验室没有索引任何形式为 example.com/123 的东西——这是你自己写的吗?
-
你能找到分辨率吗,我也遇到了同样的异常。我没有传递图片网址,这是强制性的吗?
标签: android firebase android-app-indexing firebase-app-indexing