Skip to content
This repository has been archived by the owner on Oct 14, 2021. It is now read-only.

Overwritten app icon (Android) #10

Closed
wreppun opened this issue Feb 21, 2019 · 5 comments
Closed

Overwritten app icon (Android) #10

wreppun opened this issue Feb 21, 2019 · 5 comments
Assignees
Labels
duplicate This issue or pull request already exists

Comments

@wreppun
Copy link
Contributor

wreppun commented Feb 21, 2019

TL;DR; one of the underlying libraries seems to be overwriting the launcher icon

To reproduce:

run flutter create ffmpeg_test
in build.gradle change minSdkVersion to 21
in android/app/src/main/AndroidManifest.xml:

  • add xmlns:tools="http://schemas.android.com/tools" to the <manifest> tag
  • add tools:replace="android:icon,android:label" to the <application> tag

run flutter run -d and (or whatever android device/emulator you'd like)

Expected result:

The app should install and the launcher should be the default flutter icon

Actual result:

The app installs and the launcher is the colorful version of this project's icon (I think it might be from https://github.com/tanersener/mobile-ffmpeg).

Notes:

  1. Thanks for this plugin!
  2. I haven't really done much android development. I did some reading on merging manifests, and I think I got it right, but there's a strong chance I don't really understand how it works. I've pasted the merged_manifest below, from /build/app/intermediates/merged_manifests/debug/processDebugManifest/merged/AndroidManifest.xml.
    I also looked at both Launcher icon Urgent #4 and package sets application@label value #3.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.ffmpeg_test"
    android:versionCode="1"
    android:versionName="1.0.0" >

    <uses-sdk
        android:minSdkVersion="21"
        android:targetSdkVersion="28" />
    <!--
         Flutter needs it to communicate with the running application
         to allow setting breakpoints, to provide hot reload, etc.
    -->
    <uses-permission android:name="android.permission.INTERNET" />
    <!--
     io.flutter.app.FlutterApplication is an android.app.Application that
         calls FlutterMain.startInitialization(this); in its onCreate method.
         In most cases you can leave this as-is, but you if you want to provide
         additional functionality it is fine to subclass or reimplement
         FlutterApplication and put your custom class here.
    -->
    <application
        android:name="io.flutter.app.FlutterApplication"
        android:allowBackup="true"
        android:debuggable="true"
        android:icon="@mipmap/ic_launcher"
        android:label="ffmpeg_test"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.ffmpeg_test.MainActivity"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:windowSoftInputMode="adjustResize" >

            <!--
                 This keeps the window background of the activity showing
                 until Flutter renders its first frame. It can be removed if
                 there is no splash screen (such as the default splash screen
                 defined in @style/LaunchTheme).
            -->
            <meta-data
                android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
                android:value="true" />

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

Again, really appreciate the plugin!

@wreppun wreppun changed the title Overwritten app icon Overwritten app icon (Android) Feb 21, 2019
@tanersener
Copy link
Owner

As you've seen in issues #3 and #4, adding tools:replace="android:icon,android:roundIcon,android:label,android:theme" in AndroidManifest.xml fixes the issue. I can't see that line in your xml file. Can you try it?

@tanersener tanersener self-assigned this Feb 21, 2019
@tanersener tanersener added the duplicate This issue or pull request already exists label Feb 21, 2019
@wreppun
Copy link
Contributor Author

wreppun commented Feb 21, 2019

Hey, sorry, the manifest I posted above is the merged manifest (that is, after combining the library manifests using the tools:replace). The android/src/main/AndroidManifest.xml (which includes the tools:replace) is:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.example.ffmpeg_test">

    <!-- io.flutter.app.FlutterApplication is an android.app.Application that
         calls FlutterMain.startInitialization(this); in its onCreate method.
         In most cases you can leave this as-is, but you if you want to provide
         additional functionality it is fine to subclass or reimplement
         FlutterApplication and put your custom class here. -->
    <application
        android:name="io.flutter.app.FlutterApplication"
        android:label="ffmpeg_test"
        android:icon="@mipmap/ic_launcher"
        tools:replace="android:icon,android:label">
        <activity
            android:name=".MainActivity"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <!-- This keeps the window background of the activity showing
                 until Flutter renders its first frame. It can be removed if
                 there is no splash screen (such as the default splash screen
                 defined in @style/LaunchTheme). -->
            <meta-data
                android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
                android:value="true" />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
    </application>
</manifest>

@tanersener
Copy link
Owner

Your merged_manifest includes android:roundIcon which indicates that your device build configuration supports roundIcon but your AndroidManifest.xml includes only android:icon. Which icon does your test device support?

@wreppun
Copy link
Contributor Author

wreppun commented Feb 23, 2019

Ok, I think I got a handle on this. Thanks for pointing out the missing roundIcon.

I don't have an android:roundIcon attribute in my project (and neither does the base project created via flutter create). So it wouldn't compile with tools:replace="android:roundIcon" (because I didn't have an attribute to use with the replace command). But because that attribute exists somewhere upstream in ffmpeg, it gets merged into AndroidManifest.xml.

I ended up adding a tools:remove attribute for both attributes which weren't in my project. My final <application> tag ended up looking like:

    <application
        android:name="io.flutter.app.FlutterApplication"
        android:label="ffmpeg_test"
        android:icon="@mipmap/ic_launcher"
        tools:replace="android:icon,android:label"
        tools:remove="android:roundIcon,android:theme">

I'm going to close this issue, but might be worth surfacing some info on the Readme about this, as the issue is fairly opaque?

@wreppun wreppun closed this as completed Feb 23, 2019
@tanersener
Copy link
Owner

Thanks, I think including app icons in mobile-ffmpeg is causing all these issues. I'll remove them in the next release, I have a new issue about it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants