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
- Delay in loading Html Page(WebView) from assets folder in real android device
- MPAndroidChart method setWordWrapEnabled() not found
- Designing a 'new post' android activity
- Android :EditText inside ListView always update first item in the listview
- Android: Transferring Data via ContentIntent
- Wrong xml being inflated android
- AsyncTask Class
- Unable to receive extras in Android Intent
- Website zoomed out on Android default browser
- Square FloatingActionButton with Android Design Library
- Google Maps API Re-size
- Push toolbar content below statusbar
- Android FragmentPagerAdapter Circular listview
- Layout not shifting up when keyboard is open
- auDIO_OUTPUT_FLAG_FAST denied by client can't connect to localhost
Related Questions in RUBY
- Best way to make an HABTM association via console
- undefined method `namespace' for main:Object (NoMethodError) - active record / rakefile
- Ruby destroy is not working? Or objects still present?
- Trying to set the value of an input with mechanize
- How to split the logic in a ruby game
- How can I monitor an endpoint's status with Ruby?
- Why can a private class method be explicitly invoked in Ruby?
- Rails - Ajax do not work properly on production server
- syntax error, unexpected kEND
- Carrierwave file upload with different file types
- b.javascript_dialog().exists? is not working for me in WATIR 4.0.2
- Combine two arrays of hashes
- Building a simple calculator form in Rails 4
- How do I update create route from rails 3 to 4
- Comparison of Fixnum with nil failed - palindrome program Ruby
Related Questions in JSON
- getting undefined while iterating json
- How can I serialize a numpy array while preserving matrix dimensions?
- What is best way to check if any of the property of object is null or empty?
- How to query JSON data according to JSON array's size with Spark SQL?
- Extracting data from json_decode with lat and lng geolocation
- Convert JSON.gz to JSON in node js
- How do I get the type to convert to when deserializing from Jackson
- Escape dot in jquery validate plugin
- Are allOf and properties keywords interchangeable?
- Sort continents by amount of countries
- Is there a data format lighter than json?
- Object of class CS_REST_Wrapper_Result could not be converted to string in CAMPAIGN MONITOR
- How to read JSON data from a web server running PHP and MySQL?
- Parse Nsmutabledictionary and extract value
- Handle empty JSON values in Java
Related Questions in REQUIRE
- Why HTML5 required field is not mandatory, if form posted to two different pages using JavaScript?
- CodeIgniter: failed to open stream: No such file or directory
- Node.js require path stored in a variable
- Requiring a gem with a system class naming conflict
- Expressjs my custom script file executes and then causes my server to 500
- Child Process Node.js with CasperJs: Cannot find module 'casper'; require statement
- Pros & Cons of using requirejs (-m amd) for typescript+angular projects
- node-uuid IS installed but require('node-uuid') fails
- Using the shell provided with NodeJS
- PHP include/require: Prevent fallback in path resolution
- dojo.require statement is not loading esri Map module as expected
- How to register module
- Edit required/exported variable in Nodejs
- How to properly require any Ruby gem in an Apache CGI application?
- Include, Require a syntax error file
Related Questions in RUBOTO
- Ruboto: Android SDK Tools is missing
- best way to set up an Android emulator on Linux for Ruboto?
- MacBook Pro Retina cannot install Intel HAXM via Ruboto
- Using JSON in a Ruboto project
- Include Ruboto-Core with Android app on install
- rake aborted! No such file or directory - ant -version
- What ruboto debugging tool should I use?
- Installing Ruboto on Mac using Homebrew-ed Sdk
- ruboto app slow start up
- "Android SDK command adb : Not found"
- JRuby dont finds Android Platforms
- ruby on android : ruboto vs rhodes?
- Dalvik error with JRuby with SL4A
- Android Ruboto IRB - How to start demo irb server
- 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 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.