Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deeplink empty path error: "android:path cannot be empty"

Tags:

android

I'm trying to configure deeplinks for my app. I configured several options like:

https://myapp.com/news       --->     NewsActivity
https://myapp.com/history    --->     HistoryActivity

with intent filters like:

<intent-filter android:label="MyApp">
 <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="myapp.com"
       android:pathPrefix="/news" />
</intent-filter>

and

<intent-filter android:label="MyApp">
 <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="myapp.com"
       android:pathPrefix="/history" />
</intent-filter>

I also want a link pointing from the base domain to my main activity

https://myapp.com   --->      MainActivity

I want the link to respond to the base domain but no to other links like: https://myapp.com/playlists since the playlist features is not currently implemented in the app and is better to redirect to the web.

But when I set the intent filter:

<intent-filter android:label="MyApp">
 <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="myapp.com"
       android:path="" />
</intent-filter>

I receive the following lint warning:

android:path cannot be empty

Ensure the URL is supported by your app, to get installs and traffic to your app from GoogleSearch.

More info: https://g.co/AppIndexing/AndroidStudio

Despite this warning, the behavior it is correct. How can I fix this warning?

like image 295
Addev Avatar asked Jul 20 '26 02:07

Addev


1 Answers

Had the same issue, you can just ignore the warning with tools:ignore="AppLinkUrlError"

So your intent would be:

<intent-filter android:label="MyApp">
 <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="myapp.com"
       android:path=""
       tools:ignore="AppLinkUrlError" />
</intent-filter>

Add xmlns:tools="http://schemas.android.com/tools" to your initial manifest tag if it's not already there.

like image 117
Tunca Ulubilge Avatar answered Jul 23 '26 01:07

Tunca Ulubilge