Android App Indexing - > FirebaseAppIndexingInvalidArgumentException

sbo*_*000 5 android firebase android-app-indexing firebase-app-indexing

HEJ!

我正在尝试实现应用程序索引内容,并且我已经开始使用应用程序索引的 Google codelabs示例.

运行此代码

 Indexable recipeToIndex = new Indexable.Builder()
           .setName(mRecipe.getTitle())
           .setUrl(mRecipe.getRecipeUrl())
           .setImage(mRecipe.getPhoto())
           .setDescription(mRecipe.getDescription())
           .build();

 FirebaseAppIndex.getInstance().update(recipeToIndex); 
Run Code Online (Sandbox Code Playgroud)

总是导致方法FirebaseAppIndexingInvalidArgumentException抛出update().

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

您有建议如何添加图片Indexable吗?

x90*_*x90 -1

您应该从Indexables类中选择适当的(或者更适合的)构建器,如示例中所示。