2

I converted a legacy Android app to library and placed it into my current flutter project to call it using Method Channel. It's working fine, but the problem is that flutter is installing those two apps at the same time and showing two icons on device screen! Even using this second app as library and dependency. Flutter is installing both as regular apps.

I am using flutter 1.7.8.

I tried to follow this answer -> How to use a library project in android studio

I would like to install only my flutter app and using the second one as library/dependency inside of it.

Tiago Davi
  • 21
  • 7

2 Answers2

3

You have to changes the types of your second module as library, change

apply plugin: 'com.android.application'

into

apply plugin: 'com.android.library'

on the build.gradle of your module.

and also remove any intent filter main and launcher on these module.

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

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

Remove these part.

Hayi Nukman
  • 1,191
  • 12
  • 29
2

You might have two activities with below code.

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

Use above code with only one activity, otherwise android launch two application at the same time.

For example, Use this in your code.

      <activity
            android:name=".MainActivity"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale"
            android:hardwareAccelerated="true"
            android:theme="@style/LaunchTheme"
            android:windowSoftInputMode="adjustResize">
            <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>
apurv thakkar
  • 8,608
  • 3
  • 14
  • 19