Mobile app crashes when opening screen on android

hi,

I am building a mobile app and it works fine within retool with the app user mode but when I try it in the the retool mobile app on android it will open the first, second screen but when I open the detailscreen it will crash the app in total.

I have no idea how to troubleshoot this to be honest. I already tried to change queries to variables, remove logic change screens but it will always crash. What can I do?

Hi @Sander ,

maybe the query result is "to big" for the memory?
That was the reason for us. We used old Android-Devices with only 2GB of RAM.

Greetings
Hendrik

Thanks for the tip, don't think that's the case, it's a very small query with just a few records for testing and I am using a samsung s23 so should be ok.

Even when I clear the app cache, remove the data from the app and create a new screen and link that new screen the app crashes, this is so annoying!

Still trying to fix this, I enabled debug in the mobile retool app and enabled log to file, file log level debug but where can I find this log file?

The console within the app shows successful queries but nothing when the app crashes

retool support? can you help out please

@Tess can you help out here? Really stuck with this and no idea how to solve this, just tried it on iOS and there it works fine :frowning:

Hi @Sander,

Looks like another user is running into a similar issue. What version of Retool are you using? It appears the issue was resolved for this user by upgrading to the current cloud version.

Hi @Sander,

One thing you can do is to use Android studio and capture the logs from crash.

Here are the instructions.

Guide - Investigate crash using log cat

Step 1: Install Android Studio

  1. Download Android Studio:
  1. Install Android Studio:
  • Run the downloaded installer and follow the on-screen instructions to install Android Studio.
  • During the installation process, make sure to install the Android SDK and the necessary emulator images.

Step 2: Set Up Your Device

  1. Enable Developer Options on your Android device:
  • Go to Settings > About phone.
  • Tap Build number seven times to unlock Developer Options.
  1. Enable USB Debugging:
  • Go to Settings > Developer options.
  • Enable USB debugging.
  1. Connect Your Device:
  • Connect your Android device to your computer using a USB cable.
  • Allow USB debugging on your device if prompted.

Step 3: Set Up Android Studio for Logcat

  1. Open Android Studio:
  • Launch Android Studio from your installed applications.
  1. Create a New Project (optional):
  • If you're opening Android Studio for the first time, create a new project. You can name it anything, as you won't be using it directly.
  1. Open Logcat:
  • In Android Studio, go to View > Tool Windows > Logcat.
  • Alternatively, you can find the Logcat window at the bottom of the Android Studio interface.

Step 4: Capture Logs from com.retool.retool

  1. Filter Logcat for the Retool App:
  • In the Logcat window, there's a filter bar. Type com.retool.retool to filter logs specific to the Retool app.
  1. Reproduce the Crash:
  • Open the com.retool.retool app on your Android device and reproduce the crash.
  1. Capture the Logs:
  • Observe the logs in the Logcat window. Look for any error messages or stack traces that occur at the time of the crash.
  • Right-click within the Logcat window and select Save Logcat to File to save the logs for further analysis.

Send us this file and we can take a look.

Thanks
Suparn

2 Likes

@AbbeyHernandez I am using Cloud so that should not be the problem.

1 Like

Ok thanks, will try to follow this and send the log files.

@suparn not sure why it does work on iOS and the app in user mode online

2024-07-25 10:26:38.905  1791-1791  LayerHistory            surfaceflinger                       I  com.retool.retool/com.retool.retool.MainActivity$_27133#17004 Max (can't resolve refresh rate)
2024-07-25 10:26:39.179 27133-27448 LiquidCoreRuntimeEngine com.retool.retool                    D  LOG: Raw Data:,[object Object]
2024-07-25 10:26:39.179 27133-27448 LiquidCoreRuntimeEngine com.retool.retool                    D  LOG: Denominations String:,25,35,50,75,100
2024-07-25 10:26:39.181 27133-27448 LiquidCoreRuntime       com.retool.retool                    E  Got unexpected exception exception:Error: JSObject not an array
                                                                                                    Error: JSObject not an array
                                                                                                        at log (<code>:12:34)
                                                                                                        at v (<code>:1376:320)
                                                                                                        at Object.log (<code>:1376:606)
                                                                                                        at eval (__retool_user_code.js:18:11)
                                                                                                        at <code>:1353:1645
                                                                                                        at Generator.next (<anonymous>)
                                                                                                        at n (<code>:22:70)
                                                                                                        at v (<code>:22:281)
                                                                                                        at <code>:22:340
                                                                                                        at new Promise (<code>:2071:2047)
                                                                                                    Error: JSObject not an array
                                                                                                    	at org.liquidplayer.javascript.JSValue.toJSArray(JSValue.java:388)
                                                                                                    	at org.liquidplayer.javascript.JSValue.toJavaObject(JSValue.java:440)
                                                                                                    	at org.liquidplayer.javascript.JSFunction.function(JSFunction.java:504)
                                                                                                    	at org.liquidplayer.javascript.JSFunction.functionCallback(JSFunction.java:466)
                                                                                                    	at org.liquidplayer.javascript.JNIJSObject.callAsFunction(Native Method)
                                                                                                    	at org.liquidplayer.javascript.JNIJSObject.callAsFunction(JNIJSObject.java:58)
                                                                                                    	at org.liquidplayer.javascript.JSFunction.apply(JSFunction.java:413)
                                                                                                    	at org.liquidplayer.javascript.JSFunction.call(JSFunction.java:377)
                                                                                                    	at org.liquidplayer.javascript.JSContext$2$1.run(JSContext.java:175)
2024-07-25 10:26:39.184 27133-27448 AndroidRuntime          com.retool.retool                    E  FATAL EXCEPTION: Thread-51
                                                                                                    Process: com.retool.retool, PID: 27133
                                                                                                    java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object[] org.liquidplayer.javascript.JSBaseArray.toArray(java.lang.Class)' on a null object reference
                                                                                                    	at org.liquidplayer.javascript.JSValue.toJavaObject(JSValue.java:440)
                                                                                                    	at org.liquidplayer.javascript.JSFunction.function(JSFunction.java:504)
                                                                                                    	at org.liquidplayer.javascript.JSFunction.functionCallback(JSFunction.java:466)
                                                                                                    	at org.liquidplayer.javascript.JNIJSObject.callAsFunction(Native Method)
                                                                                                    	at org.liquidplayer.javascript.JNIJSObject.callAsFunction(JNIJSObject.java:58)
                                                                                                    	at org.liquidplayer.javascript.JSFunction.apply(JSFunction.java:413)
                                                                                                    	at org.liquidplayer.javascript.JSFunction.call(JSFunction.java:377)
                                                                                                    	at org.liquidplayer.javascript.JSContext$2$1.run(JSContext.java:175)
2024-07-25 10:26:39.197 27133-27235 TrafficStats            com.retool.retool                    D  tagSocket(161) with statsTag=0xffffffff, statsUid=-1
2024-07-25 10:26:39.200 27133-27197 InputMethodManager      com.retool.retool                    I  invalidateInput
2024-07-25 10:26:39.208  2835-4081  PackageManager          system_server                        D  setEnabledSetting : userId = 0 packageName = com.retool.retool cmp = androidx.work.impl.background.systemalarm.RescheduleReceiver newState = 1 callingPackage = com.retool.retool
2024-07-25 10:26:39.208  2835-4081  ApplicationPolicy       system_server                        D  getApplicationStateEnabled : pkg = com.retool.retool userId : 0
2024-07-25 10:26:39.209  2835-4081  ApplicationPolicy       system_server                        D  getApplicationComponentState : pkg = com.retool.retool userId : 0
2024-07-25 10:26:39.212 27133-27133 unknown:WrappingUtils   com.retool.retool                    W  Don't know how to round that drawable: com.facebook.react.views.image.ReactImageDownloadListener$EmptyDrawable@95e013
// Fetch data from the getDemoninations query
const rawData = getDemoninations.data;

let denominationsArray = [];

if (rawData && rawData.denominations && rawData.denominations.length > 0) {
  const denominationsString = rawData.denominations[0];
  
  denominationsArray = denominationsString.split(',').map(Number);
} 

// Return the processed data
return denominationsArray;

Hey @Sander

We just replaced LiquidCoreRuntime with new runtime, can you try again to see if it crashes ?

LiquidCoreRuntime uses old Node version, which was missing a lot of new JS features and we replaced with newer Node version.

@james.lee thanks for the update, I cleared the cache of the app, removed the data, but still the same issue. Any idea how I can change this query to work with android? Sorry my developer skills are limited

// Fetch data from the getDemoninations query
const rawData = getDemoninations.data;

let denominationsArray = [];

if (rawData && rawData.denominations && rawData.denominations.length > 0) {
  const denominationsString = rawData.denominations[0];
  
  denominationsArray = denominationsString.split(',').map(Number);
} 

// Return the processed data
return denominationsArray;

Could you invite me to your instance so I can debug ?

I DM'd you my email

After a long holiday I checked again and it suddenly works now :slight_smile: so that's good haha

1 Like