helloworld1 / AnyMemo

Advanced Spaced Repetition flashcard learning software for Android.
http://www.anymemo.org
GNU General Public License v2.0
151 stars 53 forks source link

Fatal crash when starting the fresh installed app #492

Open tingsu opened 4 years ago

tingsu commented 4 years ago

I searched the history issue list, and have not found similar issues.

The issue was found in the latest released version (v10.11.4) on a Android 6.0 device.

Reproducing viodeo

20200404_220724

Crash stack

 FATAL EXCEPTION: main
 Process: org.liberty.android.fantastischmemo, PID: 12581
 java.lang.RuntimeException: Failure delivering result ResultInfo{who=@android:requestPermissions:, request=1, result=-1, data=Intent { act=android.content.pm.action.REQUEST_PERMISSIONS (has extras) }} to activity {org.liberty.android.fantastischmemo/org.liberty.android.fantastischmemo.ui.AnyMemo}: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
    at android.app.ActivityThread.deliverResults(ActivityThread.java:3699)
    at android.app.ActivityThread.handleSendResult(ActivityThread.java:3742)
    at android.app.ActivityThread.-wrap16(ActivityThread.java)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1393)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5417)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
 Caused by: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
    at androidx.fragment.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:4)
    at androidx.fragment.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1)
    at androidx.fragment.app.BackStackRecord.commitInternal(BackStackRecord.java:12)
    at androidx.fragment.app.BackStackRecord.commit(BackStackRecord.java:1)
    at org.liberty.android.fantastischmemo.ui.AnyMemo$2.onNavigationItemSelected(AnyMemo.java:11)
    at com.google.android.material.bottomnavigation.BottomNavigationView$1.onMenuItemSelected(BottomNavigationView.java:3)
    at androidx.appcompat.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:1)
    at androidx.appcompat.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:2)
    at androidx.appcompat.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:4)
    at com.google.android.material.bottomnavigation.BottomNavigationView.setSelectedItemId(BottomNavigationView.java:2)
    at org.liberty.android.fantastischmemo.ui.AnyMemo.initDrawer(AnyMemo.java:5)
    at org.liberty.android.fantastischmemo.ui.AnyMemo.loadUiComponents(AnyMemo.java:2)
    at org.liberty.android.fantastischmemo.ui.AnyMemo.onRequestPermissionsResult(AnyMemo.java:2)
    at android.app.Activity.dispatchRequestPermissionsResult(Activity.java:6553)
    at android.app.Activity.dispatchActivityResult(Activity.java:6432)
    at android.app.ActivityThread.deliverResults(ActivityThread.java:3695)
    ... 9 more
tingsu commented 4 years ago

Any update on this issue?

helloworld1 commented 4 years ago

Thanks for detailed report. I tried on Android emulator 6.0, but I am not able to reproduce this issue. But I found 2 reports for the same issue on Google Play console The device is: Samsung Galaxy J7 Prime (on7xelte), 2816MB RAM, Android 6.0

Does the app crash after the first time launch?

tingsu commented 4 years ago

Hi, thanks for your reply.

I tried on Android emulator 6.0, but I am not able to reproduce this issue.

I also tried on Android 6.0 emulator. The crash happens after the first time launch. My emulator configuration is:

Device: Nexus 7 (Google)
Target: Google APIs (Google Inc.)
Based on: Android 6.0 (Marshmallow) Tag/ABI: google_apis/x86
Skin: 800x1280
Sdcard: 512 MB
Memory: 1536 MB
VM heapsize: 256 MB

I used this command line to create this avd:

avdmanager create avd --force --name testAVD_Android6.0 --package 'system-images;android-23;google_apis;x86' --abi google_apis/x86 --sdcard 512M --device 'Nexus 7'

Btw, the reproducing video was recorded on an Android 6.0 emulator with the above configuration.

Let me know if you need more info.

helloworld1 commented 4 years ago

I see, the issue is caused by default landscape mode. There are some lifecycle handling issue for screen rotation there.

tingsu commented 4 years ago

Okay, thanks for your explanation. I see. I guess it should be easily fixed :)