emansih / FireflyMobile

Mobile Application for Firefly III written in Kotlin
GNU General Public License v3.0
321 stars 46 forks source link

App crashes after setup #14

Closed Findus23 closed 5 years ago

Findus23 commented 5 years ago

Firefly III Server Version: 4.7.8

Firefly III Mobile Version:: 0.1.4 from f-droid

Device Information: Oneplus 3T using LineageOS 15.1 (Android 8.1.0) microG without Google Play Services


After successfully setting up, the app crashes on every start

Steps to Reproduce

When setting up via oauth key I was at first confused because it opened http://empty/?somestring in Firefox until I noticed that you are using this to get the oauth key. Firefox has a button to open the current URL in the correct app and this opens FireflyMobile and I again see the start screen. When I click on oauth a loading screen comes and a "welcome" toast appears. And in this moment the app crashes. On every restart the app immediatly crashes with the following error:

11-28 20:59:46.971  1032  8783 I ActivityManager: Start proc 1472:xyz.hisname.fireflyiii/u0a111 for activity xyz.hisname.fireflyiii/.ui.onboarding.OnboardingActivity
11-28 20:59:47.069  1032  6710 W ActivityManager: Slow operation: 64ms so far, now at attachApplicationLocked: after mServices.attachApplicationLocked
11-28 20:59:47.105  1032  1068 E NotificationService: Suppressing notification from package by user request.
11-28 20:59:47.241  1472  1472 D AndroidRuntime: Shutting down VM
11-28 20:59:47.242  1472  1472 E AndroidRuntime: FATAL EXCEPTION: main
11-28 20:59:47.242  1472  1472 E AndroidRuntime: Process: xyz.hisname.fireflyiii, PID: 1472
11-28 20:59:47.242  1472  1472 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{xyz.hisname.fireflyiii/xyz.hisname.fireflyiii.ui.onboarding.OnboardingActivity}: java.lang.IllegalStateException: Module with the Main dispatcher is missing. Add dependency providing the Main dispatcher, e.g. 'kotlinx-coroutines-android'
11-28 20:59:47.242  1472  1472 E AndroidRuntime:        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
11-28 20:59:47.242  1472  1472 E AndroidRuntime:        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
11-28 20:59:47.242  1472  1472 E AndroidRuntime:        at android.app.ActivityThread.-wrap11(Unknown Source:0)
11-28 20:59:47.242  1472  1472 E AndroidRuntime:        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
11-28 20:59:47.242  1472  1472 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:106)
11-28 20:59:47.242  1472  1472 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:164)
11-28 20:59:47.242  1472  1472 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:6494)
11-28 20:59:47.242  1472  1472 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
11-28 20:59:47.242  1472  1472 E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:440)
11-28 20:59:47.242  1472  1472 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
11-28 20:59:47.242  1472  1472 E AndroidRuntime: Caused by: java.lang.IllegalStateException: Module with the Main dispatcher is missing. Add dependency providing the Main dispatcher, e.g. 'kotlinx-coroutines-android'
11-28 20:59:47.242  1472  1472 E AndroidRuntime:        at kotlinx.coroutines.bt.a(Unknown Source:8)
11-28 20:59:47.242  1472  1472 E AndroidRuntime:        at kotlinx.coroutines.bt.a(Unknown Source:10)
11-28 20:59:47.242  1472  1472 E AndroidRuntime:        at kotlinx.coroutines.aq.a(Unknown Source:37)
11-28 20:59:47.242  1472  1472 E AndroidRuntime:        at kotlinx.coroutines.c.a.a(Unknown Source:20)
11-28 20:59:47.242  1472  1472 E AndroidRuntime:        at kotlinx.coroutines.ae.a(Unknown Source:35)
11-28 20:59:47.242  1472  1472 E AndroidRuntime:        at kotlinx.coroutines.c.a(Unknown Source:16)
11-28 20:59:47.242  1472  1472 E AndroidRuntime:        at kotlinx.coroutines.f.a(Unknown Source:44)
11-28 20:59:47.242  1472  1472 E AndroidRuntime:        at kotlinx.coroutines.e.b(Unknown Source:0)
11-28 20:59:47.242  1472  1472 E AndroidRuntime:        at xyz.hisname.fireflyiii.ui.onboarding.OnboardingActivity.onCreate(Unknown Source:292)
11-28 20:59:47.242  1472  1472 E AndroidRuntime:        at android.app.Activity.performCreate(Activity.java:7009)
11-28 20:59:47.242  1472  1472 E AndroidRuntime:        at android.app.Activity.performCreate(Activity.java:7000)
11-28 20:59:47.242  1472  1472 E AndroidRuntime:        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
11-28 20:59:47.242  1472  1472 E AndroidRuntime:        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
11-28 20:59:47.242  1472  1472 E AndroidRuntime:        ... 9 more
11-28 20:59:47.246  1032  1724 W ActivityManager:   Force finishing activity xyz.hisname.fireflyiii/.ui.onboarding.OnboardingActivity
11-28 20:59:47.269  1032  1069 I ActivityManager: Showing crash dialog for package xyz.hisname.fireflyiii u0
11-28 20:59:47.314  1032  3898 I OpenGLRenderer: Initialized EGL, version 1.4
11-28 20:59:47.314  1032  3898 D OpenGLRenderer: Swap behavior 2
11-28 20:59:47.759  1032  1068 W ActivityManager: Activity pause timeout for ActivityRecord{140a41f u0 xyz.hisname.fireflyiii/.ui.onboarding.OnboardingActivity t3941 f}
11-28 20:59:48.091  1032  1068 E NotificationService: Suppressing notification from package by user request.
11-28 20:59:48.345  2877  2988 W OpenGLRenderer: Incorrectly called buildLayer on View: ShortcutAndWidgetContainer, destroying layer...

When you need more information, just mention it.

emansih commented 5 years ago

hmm.. this is strange. I am unable to replicate this bug on my Galaxy S8(Android 8.0.0 September 1,2018).

TobiasDev commented 5 years ago

I also just tried the f-droid version and have the same crash. OnePlus 3 as well, however, if I grab the apk from github it works without any issues.

So I wonder what the difference is when f-droid builds it.

emansih commented 5 years ago

Well I'm using the build from GitHub,maybe that's the issue.

Currently v0.1.4 binary on GitHub release page is different from Fdroid since a different build chain is being used. https://gitlab.com/fdroid/fdroiddata/merge_requests/3910#note_119822494 (see point 3)

Fdroid uses Android Gradle plugin 3.2.1 whereas I'm using Android Gradle plugin 3.3.0-alpha12. I will attempt to replicate the issue but I have a feeling it has to do with my proguard config from what I can tell from the logcat and the bug reports from Kotlin coroutines GitHub issues page.

Findus23 commented 5 years ago

I have now updated to 1.0.2 from fdroid, deleted all data, but the exact same issue as described in the first post still happens. I can't provide a logcat as I am on my phone, but I will append it later.

I'll now try the version from github, maybe the error is something else.

emansih commented 5 years ago

Steps to replicate?

Findus23 commented 5 years ago

The exact same as in the first comment: When I open the empty URL with the app I just land in the first welcome screen. When I select oauth the app crashes.

And the same happens with the apk from github. Maybe it has something to do how firefox opens the app.
Update: The lineageos browser (which is basically a webview) doesn't recognise the empty URL at all, firefox klar/focus creates the same crash as normal firefox.

Findus23 commented 5 years ago

Update: I'm back at a computer and made a logcat and indeed it is a different error this time:

12-16 15:05:41.452  1045  3283 W AccountManagerService: insertAccountIntoDatabase: Account {name=Firefly III Mobile, type=OAUTH}, skipping since the account already exists
12-16 15:05:41.492  9158  9158 D AndroidRuntime: Shutting down VM
12-16 15:05:41.493  9158  9158 E AndroidRuntime: FATAL EXCEPTION: main
12-16 15:05:41.493  9158  9158 E AndroidRuntime: Process: xyz.hisname.fireflyiii, PID: 9158
12-16 15:05:41.493  9158  9158 E AndroidRuntime: java.lang.IllegalArgumentException: Invalid URL host: ""
12-16 15:05:41.493  9158  9158 E AndroidRuntime:        at okhttp3.t$a.a(Unknown Source:529)
12-16 15:05:41.493  9158  9158 E AndroidRuntime:        at okhttp3.t.e(Unknown Source:6)
12-16 15:05:41.493  9158  9158 E AndroidRuntime:        at d.s$a.a(Unknown Source:5)
12-16 15:05:41.493  9158  9158 E AndroidRuntime:        at xyz.hisname.fireflyiii.data.a.a$a.a(Unknown Source:20)
12-16 15:05:41.493  9158  9158 E AndroidRuntime:        at xyz.hisname.fireflyiii.repository.b.a.a(Unknown Source:37)
12-16 15:05:41.493  9158  9158 E AndroidRuntime:        at xyz.hisname.fireflyiii.ui.onboarding.b.A(Unknown Source:151)
12-16 15:05:41.493  9158  9158 E AndroidRuntime:        at androidx.fragment.app.d.R(Unknown Source:20)
12-16 15:05:41.493  9158  9158 E AndroidRuntime:        at androidx.fragment.app.k.a(Unknown Source:818)
12-16 15:05:41.493  9158  9158 E AndroidRuntime:        at androidx.fragment.app.k.i(Unknown Source:38)
12-16 15:05:41.493  9158  9158 E AndroidRuntime:        at androidx.fragment.app.k.a(Unknown Source:42)
12-16 15:05:41.493  9158  9158 E AndroidRuntime:        at androidx.fragment.app.a.d(Unknown Source:169)
12-16 15:05:41.493  9158  9158 E AndroidRuntime:        at androidx.fragment.app.k.b(Unknown Source:38)
12-16 15:05:41.493  9158  9158 E AndroidRuntime:        at androidx.fragment.app.k.a(Unknown Source:116)
12-16 15:05:41.493  9158  9158 E AndroidRuntime:        at androidx.fragment.app.k.b(Unknown Source:88)
12-16 15:05:41.493  9158  9158 E AndroidRuntime:        at androidx.fragment.app.k.j(Unknown Source:21)
12-16 15:05:41.493  9158  9158 E AndroidRuntime:        at androidx.fragment.app.k$1.run(Unknown Source:2)
12-16 15:05:41.493  9158  9158 E AndroidRuntime:        at android.os.Handler.handleCallback(Handler.java:790)
12-16 15:05:41.493  9158  9158 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:99)
12-16 15:05:41.493  9158  9158 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:164)
12-16 15:05:41.493  9158  9158 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:6494)
12-16 15:05:41.493  9158  9158 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
12-16 15:05:41.493  9158  9158 E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:440)
12-16 15:05:41.493  9158  9158 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
12-16 15:05:41.496  1045  3283 W ActivityManager:   Force finishing activity xyz.hisname.fireflyiii/.ui.onboarding.OnboardingActivity
12-16 15:05:41.509  1045  1082 I ActivityManager: Showing crash dialog for package xyz.hisname.fireflyiii u0
12-16 15:05:42.000  1045  1081 W ActivityManager: Activity pause timeout for ActivityRecord{545287 u0 xyz.hisname.fireflyiii/.ui.onboarding.OnboardingActivity t4720 f}
12-16 15:05:42.017  5725  5725 W GeckoEventDispatcher: No listener for GeckoView:SetFocused
emansih commented 5 years ago

oh hmm... here's a dirty hack.

  1. Clear app data
  2. Go to settings -> accounts -> find Firefly III Mobile -> remove account
Findus23 commented 5 years ago

Odd, I expected accounts to also be deleted when clearing all app data.

But this doesn't solve the issue, only the skipping since the account already exists doesn't appear anymore.

```text 12-16 15:24:42.465 1045 22062 D AccountManagerService: Visibility was not initialized 12-16 15:24:42.468 1045 22062 I AccountManagerService: the accounts changed, sending broadcast of android.accounts.LOGIN_ACCOUNTS_CHANGED 12-16 15:24:42.477 13177 13177 I Exchange: Accounts changed - requesting FolderSync for unsynced accounts 12-16 15:24:42.510 14463 14463 D AndroidRuntime: Shutting down VM 12-16 15:24:42.511 14463 14463 E AndroidRuntime: FATAL EXCEPTION: main 12-16 15:24:42.511 14463 14463 E AndroidRuntime: Process: xyz.hisname.fireflyiii, PID: 14463 12-16 15:24:42.511 14463 14463 E AndroidRuntime: java.lang.IllegalArgumentException: Invalid URL host: "" 12-16 15:24:42.511 14463 14463 E AndroidRuntime: at okhttp3.t$a.a(Unknown Source:529) 12-16 15:24:42.511 14463 14463 E AndroidRuntime: at okhttp3.t.e(Unknown Source:6) 12-16 15:24:42.511 14463 14463 E AndroidRuntime: at d.s$a.a(Unknown Source:5) 12-16 15:24:42.511 14463 14463 E AndroidRuntime: at xyz.hisname.fireflyiii.data.a.a$a.a(Unknown Source:20) 12-16 15:24:42.511 14463 14463 E AndroidRuntime: at xyz.hisname.fireflyiii.repository.b.a.a(Unknown Source:37) 12-16 15:24:42.511 14463 14463 E AndroidRuntime: at xyz.hisname.fireflyiii.ui.onboarding.b.A(Unknown Source:151) 12-16 15:24:42.511 14463 14463 E AndroidRuntime: at androidx.fragment.app.d.R(Unknown Source:20) 12-16 15:24:42.511 14463 14463 E AndroidRuntime: at androidx.fragment.app.k.a(Unknown Source:818) 12-16 15:24:42.511 14463 14463 E AndroidRuntime: at androidx.fragment.app.k.i(Unknown Source:38) 12-16 15:24:42.511 14463 14463 E AndroidRuntime: at androidx.fragment.app.k.a(Unknown Source:42) 12-16 15:24:42.511 14463 14463 E AndroidRuntime: at androidx.fragment.app.a.d(Unknown Source:169) 12-16 15:24:42.511 14463 14463 E AndroidRuntime: at androidx.fragment.app.k.b(Unknown Source:38) 12-16 15:24:42.511 14463 14463 E AndroidRuntime: at androidx.fragment.app.k.a(Unknown Source:116) 12-16 15:24:42.511 14463 14463 E AndroidRuntime: at androidx.fragment.app.k.b(Unknown Source:88) 12-16 15:24:42.511 14463 14463 E AndroidRuntime: at androidx.fragment.app.k.j(Unknown Source:21) 12-16 15:24:42.511 14463 14463 E AndroidRuntime: at androidx.fragment.app.k$1.run(Unknown Source:2) 12-16 15:24:42.511 14463 14463 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:790) 12-16 15:24:42.511 14463 14463 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99) 12-16 15:24:42.511 14463 14463 E AndroidRuntime: at android.os.Looper.loop(Looper.java:164) 12-16 15:24:42.511 14463 14463 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6494) 12-16 15:24:42.511 14463 14463 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 12-16 15:24:42.511 14463 14463 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:440) 12-16 15:24:42.511 14463 14463 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) 12-16 15:24:42.513 1045 22062 W ActivityManager: Force finishing activity xyz.hisname.fireflyiii/.ui.onboarding.OnboardingActivity 12-16 15:24:42.518 12587 12660 I ContactsProvider: Accounts changed 12-16 15:24:42.522 1045 1082 I ActivityManager: Showing crash dialog for package xyz.hisname.fireflyiii u0 12-16 15:24:42.557 12587 12660 I ContactsProvider: Accounts changed 12-16 15:24:42.600 12587 12660 I ContactDirectoryManager: deleted 0 stale rows which don't have any relevant directory 12-16 15:24:42.602 12587 12660 I ContactDirectoryManager: Discovered 0 contact directories in 14ms ```

I'm now trying to get the app to compile locally. @TobiasDev, does it work now for you?

emansih commented 5 years ago

Yea, i have the same issue as you. When deleting app data account data isn't deleted. I'm unsure if it's a framework bug or a bug in my code.

Findus23 commented 5 years ago

If it helps you, the same stack trace with a debug APK:

12-16 16:13:37.279 23965 23965 D AndroidRuntime: Shutting down VM
12-16 16:13:37.281 23965 23965 E AndroidRuntime: FATAL EXCEPTION: main
12-16 16:13:37.281 23965 23965 E AndroidRuntime: Process: xyz.hisname.fireflyiii.debug, PID: 23965
12-16 16:13:37.281 23965 23965 E AndroidRuntime: java.lang.IllegalArgumentException: Invalid URL host: ""
12-16 16:13:37.281 23965 23965 E AndroidRuntime:        at okhttp3.HttpUrl$Builder.parse(HttpUrl.java:1405)
12-16 16:13:37.281 23965 23965 E AndroidRuntime:        at okhttp3.HttpUrl.get(HttpUrl.java:916)
12-16 16:13:37.281 23965 23965 E AndroidRuntime:        at retrofit2.Retrofit$Builder.baseUrl(Retrofit.java:458)
12-16 16:13:37.281 23965 23965 E AndroidRuntime:        at xyz.hisname.fireflyiii.data.remote.RetrofitBuilder$Companion.getClient(RetrofitBuilder.kt:50)
12-16 16:13:37.281 23965 23965 E AndroidRuntime:        at xyz.hisname.fireflyiii.repository.auth.AuthViewModel.getAccessToken(AuthViewModel.kt:19)
12-16 16:13:37.281 23965 23965 E AndroidRuntime:        at xyz.hisname.fireflyiii.ui.onboarding.LoginFragment.onResume(LoginFragment.kt:150)
12-16 16:13:37.281 23965 23965 E AndroidRuntime:        at androidx.fragment.app.Fragment.performResume(Fragment.java:2499)
12-16 16:13:37.281 23965 23965 E AndroidRuntime:        at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:926)
12-16 16:13:37.281 23965 23965 E AndroidRuntime:        at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManagerImpl.java:1229)
12-16 16:13:37.281 23965 23965 E AndroidRuntime:        at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:1295)
12-16 16:13:37.281 23965 23965 E AndroidRuntime:        at androidx.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:686)
12-16 16:13:37.281 23965 23965 E AndroidRuntime:        at androidx.fragment.app.FragmentManagerImpl.executeOps(FragmentManagerImpl.java:2057)
12-16 16:13:37.281 23965 23965 E AndroidRuntime:        at androidx.fragment.app.FragmentManagerImpl.executeOpsTogether(FragmentManagerImpl.java:1847)
12-16 16:13:37.281 23965 23965 E AndroidRuntime:        at androidx.fragment.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManagerImpl.java:1802)
12-16 16:13:37.281 23965 23965 E AndroidRuntime:        at androidx.fragment.app.FragmentManagerImpl.execPendingActions(FragmentManagerImpl.java:1709)
12-16 16:13:37.281 23965 23965 E AndroidRuntime:        at androidx.fragment.app.FragmentManagerImpl$1.run(FragmentManagerImpl.java:147)
12-16 16:13:37.281 23965 23965 E AndroidRuntime:        at android.os.Handler.handleCallback(Handler.java:790)
12-16 16:13:37.281 23965 23965 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:99)
12-16 16:13:37.281 23965 23965 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:164)
12-16 16:13:37.281 23965 23965 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:6494)
12-16 16:13:37.281 23965 23965 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
12-16 16:13:37.281 23965 23965 E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:440)
12-16 16:13:37.281 23965 23965 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
12-16 16:13:37.285  1045 23554 W ActivityManager:   Force finishing activity xyz.hisname.fireflyiii.debug/xyz.hisname.fireflyiii.ui.onboarding.OnboardingActivity
emansih commented 5 years ago

Well, i can't replicate your bug even with the unobfuscated stack trace.

emansih commented 5 years ago

Ahhh...i replicated your bug after hours of trail and error

emansih commented 5 years ago

Thanks for reporting. See if the latest release(v1.1.0) fixes your issue. Feel free to reopen the issue if it does not.

Findus23 commented 5 years ago

Many thanks for your help and great work on this app. I just installed 1.1.2 from F-Droid and setup is working fine.