Android Application Indexing & # 8594; FirebaseAppIndexingInvalidArgumentException

Hey!

I am trying to inject application indexing content, and I started with an app-indexing sample of Google codelabs.

Running this code

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

always throws a FirebaseAppIndexingInvalidArgumentException by the update() method.

 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) 

Do you have any suggestions for adding an image to Indexable ?

+5
source share
4 answers

Delete the message with the image or edit the code as follows.

 if (friendlyMessage.getText() != null) { FirebaseAppIndex.getInstance().update(getMessageIndexable(friendlyMessage)); } FirebaseUserActions.getInstance().end(getMessageViewAction(friendlyMessage)); 

It seems that the textbook does not address a message without a message. All messages must be text or text with an image. To fix this, you must check. https://github.com/firebase/friendlychat/issues/160

+1
source

The reason I was getting this error was because the manifest for the application I tested did not have an intent filter.

Make sure that the URL you set on the indexed one contains the corresponding entry in the manifest

  <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> 
0
source

Make sure setUrl () gets the correct url, my http://app.com//path

// path to path caused a problem

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

This is not so important for setImage.

0
source

You must select the appropriate (or the one that works best) Builder from the Indexables class, as in the example.

-1
source

Source: https://habr.com/ru/post/1261280/


All Articles