abrensch / brouter

configurable OSM offline router with elevation awareness, Java + Android
MIT License
476 stars 115 forks source link

Crash on update #574

Closed Fabian42 closed 3 months ago

Fabian42 commented 1 year ago

When I click "Update 1117 tiles", the app crashes:

java.lang.IllegalStateException: Data cannot occupy more than 10240 bytes when serialized
    at androidx.work.Data.toByteArrayInternal(Data.java:407)
    at androidx.work.Data$Builder.build(Data.java:957)
    at btools.routingapp.BInstallerActivity.downloadAll(BInstallerActivity.java:215)
    at btools.routingapp.BInstallerActivity.downloadInstalledTiles(BInstallerActivity.java:487)
    at btools.routingapp.BInstallerActivity.lambda$onCreate$0$btools-routingapp-BInstallerActivity(BInstallerActivity.java:126)
    at btools.routingapp.BInstallerActivity$$ExternalSyntheticLambda1.onClick(Unknown Source:2)
    at android.view.View.performClick(View.java:7259)
    at android.view.View.performClickInternal(View.java:7236)
    at android.view.View.access$3600(View.java:801)
    at android.view.View$PerformClick.run(View.java:27896)
    at android.os.Handler.handleCallback(Handler.java:883)
    at android.os.Handler.dispatchMessage(Handler.java:100)
    at android.os.Looper.loop(Looper.java:214)
    at android.app.ActivityThread.main(ActivityThread.java:7400)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:491)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935)

When I manually select all the tiles, I get the same result, except lines 5 and 6 are:

    at btools.routingapp.BInstallerActivity.downloadSelectedTiles(BInstallerActivity.java:478)
    at btools.routingapp.BInstallerActivity.lambda$onCreate$0$btools-routingapp-BInstallerActivity(BInstallerActivity.java:123)

This is probably related to the amount of tiles I have downloaded, but it didn't happen before.

afischerdev commented 1 year ago

It belongs to the androidx.work.Data class. We should protect this calls not to get a crash.

afischerdev commented 1 year ago

To prevent this crash I add an exception catch and I reduced the downloaded files to 500. So it should be possible to press update all segments. After finish it should come back with a size reduced by 500 and you can press all again.