roughike / flutter_facebook_login

A Flutter plugin for allowing users to authenticate with native Android & iOS Facebook login SDKs.
BSD 2-Clause "Simplified" License
405 stars 331 forks source link

Android - App crashes on second startup. Clearing app data on device lets it run again. #167

Closed Justin-Randall closed 4 years ago

Justin-Randall commented 5 years ago

Integrating flutter_facebook_login worked fine as per the instructions. The first time I debug the application, it starts and I can login via facebook with no problems. I see a user in Firebase and all works as expected.

I am targeting Android. This has been tested on multiple devices with the same behavior. One Samsung tablet, another Pixel 2.

When I attempt to start the application again, adb logs show the following exception (note [MY PROJECT] replaces the typical com.example.typical_flutter_project):

 FATAL EXCEPTION: main
 Process: [MY PROJECT], PID: 3098
 java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{[MY PROJECT]/[MY PROJECT].MainActivity}: java.lang.ClassNotFoundException: Didn't find class "[MY PROJECT].MainActivity" on path: DexPathList[[zip file "/data/app/[MY PROJECT]-JObNIJAMpmDPRJzmeAKfnw==/base.apk"],nativeLibraryDirectories=[/data/app/[MY PROJECT]-JObNIJAMpmDPRJzmeAKfnw==/lib/arm64, /data/app/[MY PROJECT]-JObNIJAMpmDPRJzmeAKfnw==/base.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64]]
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2846)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3037)
    at android.app.ActivityThread.-wrap11(Unknown Source:0)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1701)
    at android.os.Handler.dispatchMessage(Handler.java:105)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6949)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
 Caused by: java.lang.ClassNotFoundException: Didn't find class "[MY PROJECT].MainActivity" on path: DexPathList[[zip file "/data/app/[MY PROJECT]-JObNIJAMpmDPRJzmeAKfnw==/base.apk"],nativeLibraryDirectories=[/data/app/[MY PROJECT]-JObNIJAMpmDPRJzmeAKfnw==/lib/arm64, /data/app/[MY PROJECT]-JObNIJAMpmDPRJzmeAKfnw==/base.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
    at android.app.Instrumentation.newActivity(Instrumentation.java:1180)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2836)

Removing the build directory and running flutter clean has no effect. The second startup will always fail with this error until I go into the device settings, find the application, then delete application data. Just deleting the cache will not work. I have to nuke the data.

There is something saved after the application is first run that prevents it starting properly the next time. I have scoured the project and tried to ensure the project name was the same everywhere. Is there some way to determine what is being saved on the device that could be causing this problem? It seems odd that it would run the first time with no problems, then completely face-plant at any attempt to start the application afterward.

roughike commented 4 years ago

Is this still a problem with version 3.0.0?

DesortsSolution commented 4 years ago

Same problem

Justin-Randall commented 4 years ago

Is this still a problem with version 3.0.0?

Seems to be working with the latest version.