Rasto
Rasto

Reputation: 17834

An Android app works when installed via Android Studio but shows some settings page when installed and opened via Google Play

I have an Android app that is not been publicly released yet. I want to distribute it to the client using the Play Store's "Internal testing" channel.

I created the release in that channel, copied the install link, install the app via the link, so far so good. The first suspicious thing is that the app's Play Store page after installation does not have the open button, only the uninstall button:

enter image description here And then the big issue is that when I try to open the app by clicking its icon, instead of actually opening the app (seeing the app's UI) this screen is displayed:

enter image description here

Have you ever encountered something like this? Where is the problem?

EDIT:

I tried to distribute the app as an .apk file but after installing from such file the exact same thing happens: Tapping the app's icon opens the settings page below instead of the app itself.

I suspect this might have something to do with app signing...

EDIT 2:

Adding my app's Android Manifest (/app/main/AndroidManifest.xml):

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.ariva">
   <application
        android:label="ARIVA dev"
        android:icon="@mipmap/ic_launcher">
        <activity
            android:name=".MainActivity"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <meta-data
              android:name="io.flutter.embedding.android.NormalTheme"
              android:resource="@style/NormalTheme"
              />
            <meta-data
              android:name="io.flutter.embedding.android.SplashScreenDrawable"
              android:resource="@drawable/launch_background"
              />
            <intent-filter android:autoVerify="true">
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
                <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="arivadev.page.link" />
                <data android:scheme="https" android:host="arivadev.page.link" />
            </intent-filter>
        </activity>
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
    </application>
</manifest>

EDIT 3

Based on some comments and answers, replaced the single intent-filter by 2 separate filters. Now the app is installed via Play Store just fine. However, as a side effect Firebase Dynamic Links that are used to authenticate the users stopped working. More specifically, clicking the emailed link opens the app when installed directly from Android Studio but it does not open the app when the app is installed via Play Store (backup website is opened instead).

Therefore, this is not a viable solution, unless the Dynamic Links are working, too. This is the new version of intent-filters:

<intent-filter>
    <action android:name="android.intent.action.MAIN"/>
    <category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter 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:host="arivadev.page.link" android:scheme="http"/>
    <data android:host="arivadev.page.link" android:scheme="https"/>
</intent-filter>

Upvotes: 3

Views: 1080

Answers (3)

ch271828n
ch271828n

Reputation: 17617

Edit: See the last section of this answer. It should solve the problem.

I suspect it is a Android-specific problem and your Flutter code is ok. The biggest reason may be, Android does not think you have an Activity.

Android app works when installed via Android Studio

IMHO it may because android studio uses special commands to launch an activity that it likes, which is not the same as what android do when a user taps the app.

I tried to distribute the app as an .apk file but after installing from such file the exact same thing happens: Tapping the app's icon opens the settings page below instead of the app itself.

Then this is also not a Google Play problem.

Could you please upload your apk file? Then we can have a look (e.g. simply use Android Studio to partially decompile it to see result AndroidManifests.xml. The result AndroidManifest.xml is indeed not the same as what you have shown above, since android build system will auto add some other things to that xml, and your bug can be caused by that.)

In addition, could you please (temporarily) replace your AndroidManifests.xml with one that is generated by Flutter using flutter create mynewproject? This will help to determine whether that file is ok or not.

Last but not least, your intent filter does not seem to be correct. You have filtered out too many things inside one filter, so the launch does not match this filter. Instead, you may need to learn the definition of intent filters, and create several separate filters. Or, please provide link to packages that require you to add those filters (it can be a mistake).

EDIT

Could you plz try:

<intent-filter>
    <action android:name="android.intent.action.MAIN"/>
    <category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter android:autoVerify="true">
    <action android:name="android.intent.action.MAIN"/>
    <category android:name="android.intent.category.LAUNCHER"/>
    <action android:name="android.intent.action.VIEW"/>
    <category android:name="android.intent.category.DEFAULT"/>
    <category android:name="android.intent.category.BROWSABLE"/>
    <data android:host="arivadev.page.link" android:scheme="http"/>
    <data android:host="arivadev.page.link" android:scheme="https"/>
</intent-filter>

Notice how firebase mentions the integration in its doc:

Add an intent filter for deep links

As with plain deep links, you must add a new intent filter to the activity that handles deep links for your app. The intent filter should catch deep links of your domain, since the Dynamic Link will redirect to your domain if your app is installed. This is required for your app to receive the Dynamic Link data after it is installed/updated from the Play Store and one taps on Continue button. In AndroidManifest.xml:

Hey, it asks to add a new intent filter! Therefore, imho you should (1) keep the plain old intent filter that is generated by flutter, and (2) add a new intent filter without modifying the old. My latest sample code above demonstrates what to do.

Upvotes: 1

Kaushik Chandru
Kaushik Chandru

Reputation: 17792

If you have opted in for Google singning then the sha1 would be different when you install the app from Google Play. Make sure to copy the sha1 from Google Play console and add it in firebase. Download the Googleservices.json and update the apk again.

Upvotes: 0

Sajjad
Sajjad

Reputation: 3228

I think the Problem is below lines.

<data android:scheme="http" android:host="arivadev.page.link" />
<data android:scheme="https" android:host="arivadev.page.link" />

when I add this lines to my Android Manifest. I get same problem. so please comment this lines and test again.


also you can follow below answer for adding data tag.(with separate intent filter)

https://stackoverflow.com/a/40543872/6813907

Upvotes: 1

Related Questions