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

348

Solution 1

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

Solution 2

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.

Share:
348
Rasto
Author by

Rasto

Entrepreneur, UX consultant, full-stack developer with strongest competency in Swift &amp; iOS. Can get die-hard about top-notch UX and code quality. Diving deeper into React and getting excited about GraphQL. My pro history chapters are written in C#, Objective-C, Java, JS, TS, Flow, even Haskel, Prolog &amp; Pascal. Sports and outdoor enthusiast. Love exploring cultures around the world. Found in mountains in the winter and at seaside during summer. Amater photographer. Always happy to learn and share what I learned e.g. externally giving lectures at my alma mater.

Updated on December 01, 2022

Comments

  • Rasto
    Rasto over 1 year

    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>
    
    • Alexander Hoffmann
      Alexander Hoffmann over 2 years
      Signing shouldn't be the problem as long as it can be installed. Does your app module's manifest.xml file have a launcher activity specified like this? XML <activity android:name=".MainActivity" android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>
    • Rasto
      Rasto over 2 years
      @AlexanderHoffmann Not exactly. I there is not exported="true" and also more properties under the <intent-filter> tag. However, it is similar. I have added the full /app/main/AndroidManifest.xml file to the question for you to review.
    • Rasto
      Rasto over 2 years
      @AlexanderHoffmann I tried to add android:exported="true" but there is no change.
    • atarasenko
      atarasenko over 2 years
      Try to replace the intent filter by several intent filters, similar to what is done here: stackoverflow.com/a/59688892/5312102
    • Rasto
      Rasto over 2 years
      @atarasenko Yes this worked (solved the issue of the app not being able to open) but it also caused the Firebase Dynamic Links to not to be opened by the app (not even when installed directly via the Android Studio).
    • atarasenko
      atarasenko over 2 years
      @Rasto: there should be 2 intent filters: the first one is for launching (with <action android:name="android.intent.action.MAIN"/> and <category android:name="android.intent.category.LAUNCHER"/>), and the second one for firebase dynamic links, as shown here: firebase.google.com/docs/dynamic-links/android/…
    • Rasto
      Rasto over 2 years
      @atarasenko Thanks that led somewhere. I followed your advice and the app can now be installed but the Dynamic Links are not working. Please see the latest edit to the question for the details.
    • ch271828n
      ch271828n over 2 years
      @Rasto Hello? Does the answer work for you?
  • Rasto
    Rasto over 2 years
    Ok, but I need those there - for firebase Dynamic Links to work...
  • Rasto
    Rasto over 2 years
    The last paragraph is apparently the closest to the actual issue: After replacing my custom intent filter with the default one and releasing again the app can be opened. However, I need that intent filter to be able to open Firebase dynamic links which are not working now (strangely, they are working when the app is installed via Android Studio but not when installed via Play Store). Please see the latest edit to my question for details.
  • Rasto
    Rasto over 2 years
    And of course I cannot upload the apk file. This is work for a client
  • ch271828n
    ch271828n over 2 years
    @Rasto All right, I originally thought if you publish to google play then it is ready for download and decompile for each and every person. Never mind.
  • ch271828n
    ch271828n over 2 years
    @Rasto I have made edit to answer. could you plz try the new intent-filter combinations
  • ch271828n
    ch271828n over 2 years
    @Rasto I guess my edited answer should solve the problem.
  • Sajjad
    Sajjad over 2 years
    @Rasto Honestly I am not sure... but please try this answer stackoverflow.com/a/42377778/6813907
  • i336_
    i336_ over 2 years
    How large is the project? How viable would it be to copy the whole thing and strip out all the content? I can potentially see something like this taking a good couple+ hours, but at the end of that you'd have a consolidated reproduction case that you could (even temporarily) drop on GitHub or potentially even include here.
  • ch271828n
    ch271828n over 2 years
    @Rasto Hello, my updated answer should work theoretically. Does it work?
  • ch271828n
    ch271828n over 2 years
    @Rasto The bounty is not refundable. Maybe award it to an answer that you find it helpful.