Skip to content
This repository has been archived by the owner on Mar 29, 2022. It is now read-only.

run example error #1

Open
chentianxin opened this issue Jan 28, 2021 · 17 comments
Open

run example error #1

chentianxin opened this issue Jan 28, 2021 · 17 comments
Labels
bug Something isn't working

Comments

@chentianxin
Copy link

Launching lib/main.dart on GM1910 in debug mode...
lib/main.dart:1
package identifier or launch activity not found.
Please check /Users/mac/Desktop/flutter_icon_switcher/example/android/app/src/main/AndroidManifest.xml for errors.
No application found for TargetPlatform.android_arm64.
Is your project missing an android/app/src/main/AndroidManifest.xml?
Consider running "flutter create ." to create one.
Exited (sigterm)

@chentianxin chentianxin added the bug Something isn't working label Jan 28, 2021
@GioPan04
Copy link
Owner

Can you send your AndroidManifest.xml ? And check the path and name of your AndroidManifest.xml

@chentianxin
Copy link
Author

Can you send your AndroidManifest.xml ? And check the path and name of your AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.dynamic_icon">
    <!-- 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="dynamic_icon"
        android:icon="@mipmap/ic_launcher">

        <activity
            android:enabled="true"
            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">
        </activity>

        <activity-alias
            android:label="Default"
            android:icon="@mipmap/ic_launcher"
            android:name=".DEFAULT"
            android:enabled="true"
            android:targetActivity=".MainActivity">

            <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>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

        </activity-alias>

        <activity-alias
            android:label="Blue"
            android:icon="@mipmap/ic_launcher1"
            android:name=".BLUE"
            android:enabled="false"
            android:targetActivity=".MainActivity">

            <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>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

        </activity-alias>

        <activity-alias
            android:label="Yellow"
            android:icon="@mipmap/ic_launcher2"
            android:name=".YELLOW"
            android:enabled="false"
            android:targetActivity=".MainActivity">

            <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>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

        </activity-alias>
        <!-- Don't delete the meta-data below.
             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
    </application>
</manifest>

@chentianxin
Copy link
Author

I try to run
https://github.com/GioPan04/flutter_icon_switcher/tree/main/example
But as is reported wrong in xml

@GioPan04
Copy link
Owner

When I get back home, I'll check.

@chentianxin
Copy link
Author

When I get back home, I'll check.

Thanks!

Android Studio 4.1
内部版本号 #AI-201.8743.12.41.6858069, 构建于 September 23, 2020
运行时版本: 1.8.0_242-release-1644-b3-6222593 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.15.7
GC: ParNew, ConcurrentMarkSweep
Memory: 1246M
Cores: 4
Registry: ide.new.welcome.screen.force=true
Non-Bundled Plugins: com.intellij.zh, Dart, io.flutter
mac@macdeMac ~ % flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 1.22.6, on Mac OS X 10.15.7 19H2 darwin-x64, locale
    zh-Hans-CN)
 
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 12.0.1)
[✓] Chrome - develop for the web
[!] Android Studio (version 4.1)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] VS Code (version 1.52.1)
[✓] Connected device (5 available)

! Doctor found issues in 1 category.

@chentianxin
Copy link
Author

This is my project, you can try to run it
dynamic_icon.zip

@GioPan04
Copy link
Owner

GioPan04 commented Jan 28, 2021

Ok so, it's strange.
It doesn't work for me either, but the example worked, until I ran flutter clean... In the next days I'll investigate more.

-- edit
jk, I found a quick fix, i'll make a pull

GioPan04 added a commit that referenced this issue Jan 28, 2021
@GioPan04
Copy link
Owner

I published a new update. But you can only use one other icon. In the next days I'll fix this

@chentianxin
Copy link
Author

I published a new update. But you can only use one other icon. In the next days I'll fix this

The new version can be used, but it has defects. We look forward to the next version to fix it. thank

@chentianxin
Copy link
Author

Hello there. How is the progress of adapting to Android, because I can't wait to use it. Thanks 😜

@GioPan04
Copy link
Owner

Hi, I'm the only one that is working on this project, and I have to work on other projects too. I don't know when I'll have the time to work on this. Today I have a little bit of time to work on this.
Btw you can use the plugin now, the difference from the next releases will be the possibility to use multiple alternative icons.

@chentianxin
Copy link
Author

chentianxin commented Feb 1, 2021

Hi, I'm the only one that is working on this project, and I have to work on other projects too. I don't know when I'll have the time to work on this. Today I have a little bit of time to work on this.
Btw you can use the plugin now, the difference from the next releases will be the possibility to use multiple alternative icons.

This version(^0.0.2) can already switch multiple icons, but there is a problem with returning to the default icon api

AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.dynamic_icon">
    <!-- 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="dynamic_icon"
        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>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

        </activity>

        <activity-alias
            android:label="dynamic_icon"
            android:icon="@mipmap/ic_launcher"
            android:name=".DEFAULT"
            android:enabled="true"
            android:targetActivity=".MainActivity">

            <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>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

        </activity-alias>

        <!-- FOR NOW USE "ALT" AS ALTERNATIVE ICON NAME, FOLLOW https://github.com/GioPan04/flutter_icon_switcher/issues/1 FOR MORE INFO -->
        <activity-alias
            android:label="Blue"
            android:icon="@mipmap/ic_launcher1"
            android:name=".BLUE"
            android:enabled="false"
            android:targetActivity=".MainActivity">

            <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>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

        </activity-alias>

        <!-- FOR NOW USE "ALT" AS ALTERNATIVE ICON NAME, FOLLOW https://github.com/GioPan04/flutter_icon_switcher/issues/1 FOR MORE INFO -->
        <activity-alias
            android:label="Yellow"
            android:icon="@mipmap/ic_launcher2"
            android:name=".YELLOW"
            android:enabled="false"
            android:targetActivity=".MainActivity">

            <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>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

        </activity-alias>
        <!-- Don't delete the meta-data below.
             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
    </application>
</manifest>

main.dart

ListTile(
  leading: Image.asset('assets/ic_launcher.png'),
  title: Text('Default'),
  onTap: () async {
    // success
    await FlutterIconSwitcher.updateIcon('DEFAULT');

    // error
    try {
      await FlutterIconSwitcher.resetIcon();
    } catch (e) {
      print(e);
    }
  },
),
ListTile(
  leading: Image.asset('assets/ic_launcher1.png'),
  title: Text('Blue'),
  onTap: () async {
    // success
    await FlutterIconSwitcher.updateIcon('BLUE');
  },
),
ListTile(
  leading: Image.asset('assets/ic_launcher2.png'),
  title: Text('Yellow'),
  onTap: () async {
    // success
    await FlutterIconSwitcher.updateIcon('YELLOW');
  },
),

@GioPan04
Copy link
Owner

GioPan04 commented Feb 1, 2021

Well yes that it can. I said that you can use only one alternative icon because in 0.0.2 I hard coded that it disable the alias-activity named "ALT". This because, for some reason, when I check what alias-activity is enabled it returns always "MainActivity"

@chentianxin
Copy link
Author

Hope the next version can add the following functions by the way, thank you

/// Fetches the current iconName
/// Returns null if the current icon is the default icon
Future<String> getIconName()

@robman70
Copy link

I see that there have been no more commits ... has the project been abandoned?

@GioPan04
Copy link
Owner

@robman70 I'm making a pr into flutter_dynamic_icon. I'm busy right now, so it's not finished yet.

@kamranbekirovyz
Copy link

Hi, @GioPan04! Thanks for the package. What do you think about adding functionality to set more than 1 one icon as an alternative?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants