{"id":17713501,"url":"https://github.com/kernel0x/bundlesaver","last_synced_at":"2025-04-05T20:08:05.588Z","repository":{"id":258685905,"uuid":"874400212","full_name":"kernel0x/bundlesaver","owner":"kernel0x","description":"Android library that fixes TransactionTooLargeException during state saving and restoring in Runtime","archived":false,"fork":false,"pushed_at":"2024-10-18T04:47:43.000Z","size":91,"stargazers_count":131,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-21T05:44:53.113Z","etag":null,"topics":["android","state","state-restoration","state-saving","transactiontoolargeexception"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kernel0x.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-17T18:57:32.000Z","updated_at":"2024-10-21T05:43:01.000Z","dependencies_parsed_at":"2024-10-25T16:53:21.046Z","dependency_job_id":null,"html_url":"https://github.com/kernel0x/bundlesaver","commit_stats":null,"previous_names":["kernel0x/bundlesaver"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kernel0x%2Fbundlesaver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kernel0x%2Fbundlesaver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kernel0x%2Fbundlesaver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kernel0x%2Fbundlesaver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kernel0x","download_url":"https://codeload.github.com/kernel0x/bundlesaver/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247393570,"owners_count":20931812,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","state","state-restoration","state-saving","transactiontoolargeexception"],"created_at":"2024-10-25T10:05:03.401Z","updated_at":"2025-04-05T20:08:05.570Z","avatar_url":"https://github.com/kernel0x.png","language":"Kotlin","readme":"# Bundle Saver\r\nA library that fixes TransactionTooLargeException during state saving and restoring in Runtime.\r\n\r\n## Just Say No to TransactionTooLargeException\r\nHow many times, while sitting in the evening with a cup of tea and browsing through Crashlytics, have you encountered such an Exception?\r\n\r\n````java\r\nFatal Exception: java.lang.RuntimeException\r\nandroid.os.TransactionTooLargeException: data parcel size 535656 bytes Bundle stats: androidx.lifecycle.BundlableSavedStateRegistry.key [size=534156]\r\n````\r\n\r\n### What's happening? How did this occur?\r\nAny developer knows about bundles and their size limitations, but the problem can arise in large applications with deeply nested screens and complex states. When a Binder transaction exceeds 1(or 2) MB, a TransactionTooLargeException will occur. But there is a solution! Introducing, BundleSaver!\r\n\r\n### Features\r\n- ***Avoid TransactionTooLargeException***: Automatically handles large bundles by saving excess data to disk.\r\n- ***Easy Integration***: Simple initialization and usage with minimal boilerplate code.\r\n- ***Concurrency Support***: Utilizes a cached thread pool for efficient background operations.\r\n- ***Logging***: Built-in logging to monitor bundle sizes and ensure compliance with size limits.\r\n- ***Memory and Disk Management***: Clears data from memory and disk as needed, ensuring optimal performance.\r\n\r\n## Getting Started\r\n\r\n### Installation\r\n\r\nAdd it in your root build.gradle at the end of repositories:\r\n\r\n````java\r\ndependencyResolutionManagement {\r\n    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)\r\n    repositories {\r\n        ...\r\n        maven { url 'https://jitpack.io' }\r\n    }\r\n}\r\n````\r\n\r\nAdd the BundleSaver dependency to your build.gradle file in App module:\r\n````java\r\ndependencies {\r\n    implementation \"com.github.kernel0x:bundlesaver:1.0.0\"\r\n}\r\n````\r\n\r\n### Usage\r\n\r\nInitialize an instance of BundleManager (preferably in the Application's onCreate() method)\r\n````java\r\nclass App : Application() {\r\n\r\n    override fun onCreate() {\r\n        super.onCreate()\r\n        BundleManager.initialize(this)\r\n    }\r\n}\r\n````\r\n\r\nNext, you should add the following to each of your Activities (***Important! The order must be exactly like this!***).\r\n````java\r\nclass MainActivity : Activity() {\r\n\r\n    override fun onCreate(savedInstanceState: Bundle?) {\r\n        BundleManager.restoreInstanceState(this, savedInstanceState)\r\n        super.onCreate(savedInstanceState)\r\n    }\r\n\r\n    override fun onSaveInstanceState(outState: Bundle) {\r\n        super.onSaveInstanceState(outState)\r\n        BundleManager.saveInstanceState(this, outState)\r\n    }\r\n}\r\n````\r\n\r\nThat's it!\r\n\r\n#### Optional\r\nClearing Data and Logging.\r\n\r\n## Releases\r\n\r\nCheckout the [Releases](https://github.com/kernel0x/bundlesaver/releases) tab for all release info.\r\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkernel0x%2Fbundlesaver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkernel0x%2Fbundlesaver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkernel0x%2Fbundlesaver/lists"}