I've got two different projects written in Ruby, using Ruboto to pack the Ruby into an .apk so it can be pushed onto an Android device. Both projects will compile and run on my phone as well as a phone emulator, but adding the line 'require 'json'' in both projects, changing nothing else, cause them to fail on startup and kick me back to the phone homepage. So it's definitely something with that line. Any ideas on what could cause this?
Using JSON in a Ruboto project
420 Views Asked by user1028497 At
2
There are 2 best solutions below
0
donV
On
Ruboto offers a helper method to run code with increased stack size:
require 'ruboto/util/stack'
with_large_stack{require 'json'}
or
with_large_stack do
require 'json'
end
This will run your code in a separate thread with larger stack allowing deep recursion. The default stack size for the with_large_stack method is 64KB. You can set this value using an optional integer argument or the option hash:
with_large_stack(128){require 'json'}
or
with_large_stack(:size => 128){require 'json'}
The stack size is given in kilobytes (KB).
Related Questions in ANDROID
- Creating global Class holder
- Flutter + Dart: Editing name of a tab shows up a black screen
- android-pdf-viewer Received status code 401 from server: Unauthorized
- Sdk 34 WRITE_EXTERNAL_STORAGE not working
- ussd reader in Recket Native module
- Incorrect display of LinearGradientBrush in IOS
- The Binary Version Of its metadata is 1.8.0, expected Version is 1.6.0 build error
- I can't make TextInput to auto expand properly in Android
- Creating multiple instances of a class with different initializing values in Flutter
- How to create a lottie animation
- making android analyze with coverity sast tool
- Flutter plugin development android src not opening after opening example
- I initialize my ViewModel in the Activity with several fragments as tabs, but the fragments(tabs) return null for the updated livedata
- Node.js Server + Socket.IO + Android Mobile Applicatoin XHR Polling Error...?
- How I can use the shared preferences class?
Related Questions in RUBY
- how to integrate cashfree payment gateway in ruby on rails project
- RSpec Capybara throwing Selenium error when trying to click a button with browser confirm
- Duplicate GET requests - Rails & Heroku
- convert csv file with json data inside to a column, rows table in 2nd csv file
- Installing dependencies from a gemspec file
- Verifying Google Identity OAuth2 token with Ruby
- Java code of AES/GCM/NoPadding encryption algorithm with authentication tag
- How to fix error in model with gem lockbox
- Cannot install Ruby Gem on Window
- use logstash filter ,aes gcm encrypted in ruby,but cannot decrypted in java
- In Rails 7, what is the right ActiveRecord callback to use if I need to prevent (or rollback) persistance on error?
- How can I go through an array and still remove elements from it
- Nokogiri only returning 5 results
- How do I get the fullscreen mode in firefox?
- undefined group option when using branch reset group regex in Ruby
Related Questions in JSON
- Handling both JSON and form values in POST request body with unknown values in Golang
- JSON Body is Not Passing Certain Strings
- Custom rewriter for json
- TypeScript: Type checking while parsing an arbitrary JSON that is typed/
- I dont understand what to do with: System.Text.Json.JsonException: 'The JSON value could not be converted to System.Collections.Generic.IEnumerable`1
- How to perform CRUD operations on a static JSON array in Angular? (without API)
- Dynamic Nested Multi-Dimensional Arrays in Rust
- Creating bar chart in FastAPI
- How to encode ttsJson data?
- Trying to get the id of the last element in my json file through an api
- How to give index id to my uploaded json file in FastAPI?
- JQ JSON - Values to Array
- Spring boot JSON parse error: Unexpected character error
- convert csv file with json data inside to a column, rows table in 2nd csv file
- Sigma.JS custom rendering
Related Questions in REQUIRE
- ERR_REQUIRE_ESM Error When Refreshing the Page in NextJS with Nivo
- In node.js is there a way to reuse a list of const-require statements, in all files?
- Trying to import KcAdminClient
- Vitest cannot be imported in a CommonJS module using require()
- How to use the require function for dynamic image? The image source will be changed by AJAX request
- require() of ES Module \node_modules\string-width\index.js from \node_modules\wide-align\align.js not supported
- TypeError: _$$_REQUIRE(_dependencyMap[7], "(...)ssets-registry/path-support.js") is not a function (it is Object)
- Interesting error using a variable with required function inside a method in Vue.js
- which [Node Require] is the right way to use and why?
- How can I use require and import both in node.js?
- How to use "zypper info" with a specific version of a package
- Uncaught ReferenceError: require is not defined in React Vite in Production
- Hard-coded 'require' from a racket macro doesn't bind 'provided' identifiers
- Import nor require are working inside my jest test files in my node.js app
- TypeScript avoid TS2749 and avoid using typeof on classes imported using require (run using bun)
Related Questions in RUBOTO
- How to setup a ruboto project in Ubuntu
- how do I change directory in ruboto running on android
- Ruunning a method with paramters and give out a returned value
- Accessing network from Ruboto
- Is there any tool in Ruboto like ProMotion in RubyMotion?
- ruboto Setup with Windows 8, apache ant not found
- Ruboto barcode tutorial, build fails
- Accessing the /res/drawable folder in Ruboto
- Installing Ruboto on Mac using Homebrew-ed Sdk
- What ruboto debugging tool should I use?
- Where's a Gemfile.apk tutorial? Or the default Gemfile.apk gems?
- MacBookPro 13" not install Intel HAXM accelerator for android emulators via ruboto
- Ruboto horizontal progress bar?
- Ruboto - On running rake-install start, app does not get powered up on emulator
- Camera record review and upload android web view
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
I had the same problem; you can use
to get more information about the crash. If you look there, you will find an error message about a stack overflow . You can circumvent this stack overflow by requiring only json/pure:
This still does not help with the general problem: most require calls lead to a stack overflow. Via Google, I found that Android is not able to have too many nested recursive calls, only about 22, until it crashes with a stack overflow. The solution I was pointed to was to use iteration, instead of recursion. :)
So right now, I know of no real solution. Most big or useful gems result in the same problem, e.g. yaml, httpi, or nokogiri.
Edit: There is a similar question in the Google mailing-list.