Error when trying to import big file
See original GitHub issueShort description
The theme import lets you select any file and when selecting a big (non-JSON) file it crashes. There should probably be a filter for JSON files and an error dialog that tells you when the selected file is not a valid theme JSON. Edit: I see there already is an error snackbar when it fails to parse the JSON so this is not related to the file type. Nevertheless I’m not sure if such a filter is even possible with the API you’re using
Steps to reproduce
- Go to the theme manager
- Tab on the plus and then on Import
- Select a relatively large file
- See error
Environment information
- FlorisBoard Version: 0.3.8
- Install Source: GitHub
- Device: OnePlus 8T
- Android version, ROM: 11, Paranoid Android Ruby Beta 4
~~~ 1615989180585.stacktrace ~~~
java.lang.OutOfMemoryError: Failed to allocate a 268501000 byte allocation with 100663296 free bytes and 119MB until OOM, target footprint 243324296, growth limit 268435456
at java.util.Arrays.copyOf(Arrays.java:3257)
at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:124)
at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:596)
at java.lang.StringBuffer.append(StringBuffer.java:367)
at java.io.StringWriter.write(StringWriter.java:94)
at kotlin.io.TextStreamsKt.copyTo(ReadWrite.kt:125)
at kotlin.io.TextStreamsKt.copyTo$default(ReadWrite.kt:120)
at kotlin.io.TextStreamsKt.readText(ReadWrite.kt:107)
at dev.patrickgold.florisboard.ime.extension.ExternalContentUtils$Companion.readTextFromUri-gIAlu-s(ExternalContentUtils.kt:29)
at dev.patrickgold.florisboard.ime.extension.AssetManager.loadAsset-gIAlu-s(AssetManager.kt:180)
at dev.patrickgold.florisboard.ime.theme.ThemeManager.loadTheme-IoAF18A(ThemeManager.kt:268)
at dev.patrickgold.florisboard.settings.ThemeManagerActivity$importTheme$1.onActivityResult(ThemeManagerActivity.kt:73)
at dev.patrickgold.florisboard.settings.ThemeManagerActivity$importTheme$1.onActivityResult(ThemeManagerActivity.kt:52)
at androidx.activity.result.ActivityResultRegistry$1.onStateChanged(ActivityResultRegistry.java:148)
at androidx.lifecycle.LifecycleRegistry$ObserverWithState.dispatchEvent(LifecycleRegistry.java:354)
at androidx.lifecycle.LifecycleRegistry.forwardPass(LifecycleRegistry.java:265)
at androidx.lifecycle.LifecycleRegistry.sync(LifecycleRegistry.java:307)
at androidx.lifecycle.LifecycleRegistry.moveToState(LifecycleRegistry.java:148)
at androidx.lifecycle.LifecycleRegistry.handleLifecycleEvent(LifecycleRegistry.java:134)
at androidx.lifecycle.ReportFragment.dispatch(ReportFragment.java:68)
at androidx.lifecycle.ReportFragment$LifecycleCallbacks.onActivityPostStarted(ReportFragment.java:187)
at android.app.Activity.dispatchActivityPostStarted(Activity.java:1362)
at android.app.Activity.performStart(Activity.java:8061)
at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3458)
at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221)
at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2067)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7701)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:952)
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
6 Common CSV Import Errors and How to Fix Them - Flatfile
One of the most common CSV import errors is that the file is simply too large. That can be caused by too many...
Read more >The import file is too large to upload - Dynamics 365 Sales
This article provides a solution to an error that occurs when you try to import a solution in Microsoft Dynamics 365.
Read more >Common Problems with Import Files
Import files are usually rejected because the file you're trying to upload exceeds your server's hard limits on file size. Here are the...
Read more >PhpMyAdmin File too large error when trying to import sql
Your best bet is to FTP it to the server and then ssh in (command line) and import the database that way. The...
Read more >Review and troubleshoot import errors
Verify that your data value matches the correct format for the property you are importing, fix any mistakes, then re-import the file. You...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Above PR fixes the import theme crash for big files by limiting the maximum file size for themes to 512kB (a theme on average has ~2kB). Will be included in the next beta release today.
Works perfectly