Code Monkey home page Code Monkey logo

flutter_live_icon's People

Contributors

divshekhar avatar skpraharaj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

flutter_live_icon's Issues

MainActivity can't be found

Description
The bug is an error that is triggered when trying to switch the App Icon. For some personal project reasons, we need to set the main activity name as "io.flutter.embedding.android.FlutterActivity" instead of ".MainActivity".

This makes the package code not recognize either the definitions of the "MainActivity" or "io.flutter.embedding.android.FlutterActivity" class names and throw an exception.

To Reproduce

  1. Upgrade a project using the reference: link
  2. Implement the flutter_live_icon package with an ExampleTheme using the described steps
  3. Initialize the theme
  4. Try to switch to the theme

Expected behavior
The icon switch should work properly.

Logs

Example of the error log when initializing and switching to the "MainActivity" class:

[ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: PlatformException(error, Component class com.mypackage.myproject.MainActivity does not exist in com.mypackage.myproject, null, java.lang.IllegalArgumentException: Component class com.mypackage.myproject.MainActivity does not exist in com.mypackage.myproject
E/flutter (21631): 	at android.os.Parcel.createExceptionOrNull(Parcel.java:2429)
E/flutter (21631): 	at android.os.Parcel.createException(Parcel.java:2409)
E/flutter (21631): 	at android.os.Parcel.readException(Parcel.java:2392)
E/flutter (21631): 	at android.os.Parcel.readException(Parcel.java:2334)
E/flutter (21631): 	at android.content.pm.IPackageManager$Stub$Proxy.setComponentEnabledSetting(IPackageManager.java:7173)
E/flutter (21631): 	at android.app.ApplicationPackageManager.setComponentEnabledSetting(ApplicationPackageManager.java:2793)
E/flutter (21631): 	at com.hackthedeveloper.live_icon.MethodCallImplementation.switchIconTo(MethodCallImplementation.java:79)
E/flutter (21631): 	at com.hackthedeveloper.live_icon.MethodCallImplementation.onMethodCall(MethodCallImplementation.java:51)
E/flutter (21631): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
E/flutter (21631): 	at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:296)
E/flutter (21631): 	at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$DartMessenger(DartMessenger.java:320)
E/flutter (21631): 	at io.flutter.embedding.engine.dart.-$$Lambda$DartMessenger$TsixYUB5E6FpKhMtCSQVHKE89gQ.run(Unknown Source:12)
E/flutter (21631): 	at android.os.Handler.handleCallback(Handler.java:938)
E/flutter (21631): 	at android.os.Handler.dispatchMessage(Handler.java:99)
E/flutter (21631): 	at android.os.Looper.loopOnce(Looper.java:201)
E/flutter (21631): 	at android.os.Looper.loop(Looper.java:288)
E/flutter (21631): 	at android.app.ActivityThread.main(ActivityThread.java:7839)
E/flutter (21631): 	at java.lang.reflect.Method.invoke(Native Method)
E/flutter (21631): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
E/flutter (21631): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
E/flutter (21631): Caused by: android.os.RemoteException: Remote stack trace:
E/flutter (21631): 	at com.android.server.pm.PackageManagerService.setEnabledSetting(PackageManagerService.java:24140)
E/flutter (21631): 	at com.android.server.pm.PackageManagerService.setComponentEnabledSetting(PackageManagerService.java:23984)
E/flutter (21631): 	at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:3291)
E/flutter (21631): 	at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:8840)
E/flutter (21631): 	at android.os.Binder.execTransactInternal(Binder.java:1179)
E/flutter (21631): 
E/flutter (21631): )
E/flutter (21631): #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:607:7)
E/flutter (21631): #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:177:18)
E/flutter (21631): <asynchronous suspension>
E/flutter (21631): #2      LiveIcon.switchIconTo (package:live_icon/live_icon.dart:18:5)
E/flutter (21631): <asynchronous suspension>
E/flutter (21631): 

Example of the error log when initializing and switching to the "MainActivity" class:

E/flutter (18259): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: PlatformException(error, Component class com.mypackage.myproject.io.flutter.embedding.android.FlutterActivity does not exist in com.mypackage.myproject, null, java.lang.IllegalArgumentException: Component class com.mypackage.myproject.io.flutter.embedding.android.FlutterActivity does not exist in com.mypackage.myproject
E/flutter (18259): 	at android.os.Parcel.createExceptionOrNull(Parcel.java:2429)
E/flutter (18259): 	at android.os.Parcel.createException(Parcel.java:2409)
E/flutter (18259): 	at android.os.Parcel.readException(Parcel.java:2392)
E/flutter (18259): 	at android.os.Parcel.readException(Parcel.java:2334)
E/flutter (18259): 	at android.content.pm.IPackageManager$Stub$Proxy.setComponentEnabledSetting(IPackageManager.java:7173)
E/flutter (18259): 	at android.app.ApplicationPackageManager.setComponentEnabledSetting(ApplicationPackageManager.java:2793)
E/flutter (18259): 	at com.hackthedeveloper.live_icon.MethodCallImplementation.switchIconTo(MethodCallImplementation.java:79)
E/flutter (18259): 	at com.hackthedeveloper.live_icon.MethodCallImplementation.onMethodCall(MethodCallImplementation.java:51)
E/flutter (18259): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
E/flutter (18259): 	at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:296)
E/flutter (18259): 	at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$DartMessenger(DartMessenger.java:320)
E/flutter (18259): 	at io.flutter.embedding.engine.dart.-$$Lambda$DartMessenger$TsixYUB5E6FpKhMtCSQVHKE89gQ.run(Unknown Source:12)
E/flutter (18259): 	at android.os.Handler.handleCallback(Handler.java:938)
E/flutter (18259): 	at android.os.Handler.dispatchMessage(Handler.java:99)
E/flutter (18259): 	at android.os.Looper.loopOnce(Looper.java:201)
E/flutter (18259): 	at android.os.Looper.loop(Looper.java:288)
E/flutter (18259): 	at android.app.ActivityThread.main(ActivityThread.java:7839)
E/flutter (18259): 	at java.lang.reflect.Method.invoke(Native Method)
E/flutter (18259): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
E/flutter (18259): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
E/flutter (18259): Caused by: android.os.RemoteException: Remote stack trace:
E/flutter (18259): 	at com.android.server.pm.PackageManagerService.setEnabledSetting(PackageManagerService.java:24140)
E/flutter (18259): 	at com.android.server.pm.PackageManagerService.setComponentEnabledSetting(PackageManagerService.java:23984)
E/flutter (18259): 	at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:3291)
E/flutter (18259): 	at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:8840)
E/flutter (18259): 	at android.os.Binder.execTransactInternal(Binder.java:1179)
E/flutter (18259): 
E/flutter (18259): )
E/flutter (18259): #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:607:7)
E/flutter (18259): #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:177:18)
E/flutter (18259): <asynchronous suspension>
E/flutter (18259): #2      LiveIcon.switchIconTo (package:live_icon/live_icon.dart:18:5)
E/flutter (18259): <asynchronous suspension>

Result of the Flutter doctor:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.10.2, on macOS 12.0.1 21A559 darwin-arm, locale en-BR)
[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.1)
[✓] VS Code (version 1.64.2)
[✓] Connected device (2 available)
[✓] HTTP Host Availability

Need iOS Support!

Description
The plugin only supports Android for now. Need iOS support!

[Android] Switch other icon will enabled other icon.

Hi Divshekhar

Describe the bug
After implementing the example, when you click to switch DarkTheme’s Icon,
The Icon of MainActivity will disappear, but the Icon of LightTheme and DarkTheme will exist together.

To Reproduce
Steps to reproduce the behavior:

  1. Follow the implementation steps
  2. Switch DarkTheme's Icon
  3. See error

Screenshots
1.This MainActivity Icon.

2.Click the DarkTheme's Button.

3.Switch Back to MainActivity.

Three Icon is enabled.😂😂

Solution

Search for keywords in the project: "DONT_KILL_APP"
Find the MethodCallImplementation.Java file

Find this line.
pm.setComponentEnabledSetting(cn, componentState, PackageManager.DONT_KILL_APP);

Add this code above it.

else{
     componentState = PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
}

It Work.

BR
Johnny

Update pub.dev package

Describe the bug
Could you please update the pub.dev package? The current version there creates two launcher icons not one. The current version in your repo is working but not published. Thank you :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.