My app won't work properly on Android

Hello Devs, 

My app won’t work properly on Android and is stuck on one function while on iOS everything is perfectly fine.

I checked all the permissions and I also installed a debugging tool to read the device log and here is it:

11-09 19:20:12.771 I/WindowManager(274): WIN DEATH: Window{41491da0 com.gmail.noor.build\_Android/com.ansca.corona.CoronaActivity paused=true} 11-09 19:20:12.771 W/WindowManager(274): Force-removing child win Window{414c12f0 SurfaceView paused=false} from container Window{41491da0 com.gmail.noor.build\_Android/com.ansca.corona.CoronaActivity paused=true} 11-09 19:20:15.567 I/ActivityManager(274): START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.gmail.noor.build\_Android/com.ansca.corona.CoronaActivity} from pid 2932 11-09 19:20:15.599 I/ActivityManager(274): Start proc com.gmail.noor.build\_Android for activity com.gmail.noor.build\_Android/com.ansca.corona.CoronaActivity: pid=13792 uid=10127 gids={3003, 1015} 11-09 19:20:15.661 I/ActivityThread(13792): Pub com.gmail.noor.build\_Android.files: com.ansca.corona.storage.FileContentProvider 11-09 19:20:15.685 D/dalvikvm(13792): Trying to load lib /data/data/com.gmail.noor.build\_Android/lib/libcorona.so 0x413e0320 11-09 19:20:15.692 D/dalvikvm(13792): Added shared lib /data/data/com.gmail.noor.build\_Android/lib/libcorona.so 0x413e0320 11-09 19:20:16.247 I/ActivityManager(274): Displayed com.gmail.noor.build\_Android/com.ansca.corona.CoronaActivity: +673ms 11-09 19:20:16.396 V/Corona (13792): \> Class.forName: network.LuaLoader 11-09 19:20:16.396 V/Corona (13792): \< Class.forName: network.LuaLoader 11-09 19:20:16.403 V/Corona (13792): Loading via reflection: network.LuaLoader 11-09 19:20:16.450 V/Corona (13792): \> Class.forName: CoronaProvider.licensing.google.LuaLoader 11-09 19:20:16.450 V/Corona (13792): \< Class.forName: CoronaProvider.licensing.google.LuaLoader 11-09 19:20:16.450 V/Corona (13792): Loading via reflection: CoronaProvider.licensing.google.LuaLoader 11-09 19:20:18.974 I/Corona (13792): 11-09 19:20:18.974 I/Corona (13792): 11-09 19:20:18.974 I/Corona (13792): 11-09 19:20:18.974 I/Corona (13792): 11-09 19:20:18.974 I/Corona (13792): Slug Name : get\_recent\_posts/?custom\_fields=dbt\_text 11-09 19:20:18.974 I/Corona (13792): 11-09 19:20:18.974 I/Corona (13792): 11-09 19:20:18.974 I/Corona (13792): 11-09 19:20:18.974 I/Corona (13792): 11-09 19:20:18.974 I/Corona (13792): -- Downloading Contect & Updates -- 11-09 19:20:18.974 I/Corona (13792): 11-09 19:20:18.974 I/Corona (13792): 11-09 19:20:19.817 I/Corona (13792): Checking files… 11-09 19:20:19.833 I/Corona (13792): Checking files… 11-09 19:20:19.856 I/Corona (13792): Checking files… 11-09 19:20:19.872 I/Corona (13792): Checking files… 11-09 19:20:19.888 I/Corona (13792): Checking files… 11-09 19:20:19.903 I/Corona (13792): Checking files… 11-09 19:20:19.919 I/Corona (13792): Checking files… 11-09 19:20:19.935 I/Corona (13792): Checking files… 11-09 19:20:19.950 I/Corona (13792): Checking files… 11-09 19:20:19.974 I/Corona (13792): Checking files… 11-09 19:20:19.989 I/Corona (13792): Checking files… 11-09 19:20:20.005 I/Corona (13792): Checking files… 11-09 19:20:20.021 I/Corona (13792): Checking files… 11-09 19:20:20.036 I/Corona (13792): Checking files… 11-09 19:20:20.052 I/Corona (13792): Checking files… 11-09 19:20:20.075 I/Corona (13792): Checking files… 11-09 19:20:20.075 I/Corona (13792): Runtime error 11-09 19:20:20.075 I/Corona (13792): ?:0: attempt to index upvalue '?' (a nil value) 11-09 19:20:20.075 I/Corona (13792): stack traceback: 11-09 19:20:20.075 I/Corona (13792): [C]: ? 11-09 19:20:20.075 I/Corona (13792): ?: in function '\_listener' 11-09 19:20:20.075 I/Corona (13792): ?: in function \<?:141\> 11-09 19:20:20.075 I/Corona (13792): ?: in function \<?:218\> 11-09 19:20:20.083 I/Corona (13792): Runtime error 11-09 19:20:20.083 I/Corona (13792): 11-09 19:20:20.083 I/Corona (13792): stack traceback: 11-09 19:20:20.083 I/Corona (13792): [C]: ? 11-09 19:20:20.083 I/Corona (13792): ?: in function '\_listener' 11-09 19:20:20.083 I/Corona (13792): ?: in function \<?:141\> 11-09 19:20:20.083 I/Corona (13792): ?: in function \<?:218\> 11-09 19:20:22.747 W/ActivityManager(274): Activity destroy timeout for ActivityRecord{41566b78 com.gmail.noor.build\_Android/com.ansca.corona.CoronaActivity}

I can’t figure out what is causing the issue even after reading the logs. 

Config.lua 

--calculate the aspect ratio of the device local aspectRatio = display.pixelHeight / display.pixelWidth application = { content = { width = aspectRatio \> 1.5 and 320 or math.ceil( 480 / aspectRatio ), height = aspectRatio \< 1.5 and 480 or math.ceil( 320 \* aspectRatio ), scale = "letterBox", fps = 60, imageSuffix = { ["@2x"] = 1.5, ["@4x"] = 3.0, }, }, notification = { google = { projectNumber = "XXXXXXXXX" }, iphone = { types = { "badge", "sound", "alert" } } } }&nbsp;

Build setting

settings = { plugins = { ["CoronaProvider.native.popup.social"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone = true }, }, }, iphone = { plist = { UIPrerenderedIcon = true, UIApplicationExitsOnSuspend = false, UIStatusBarHidden = false, CFBundleIconFile = "Icon.png", CFBundleIconFiles = { "Icon.png", "Icon@2x.png", "Icon-40.png", "Icon-40@2x.png", "Icon-60.png", "Icon-60@2x.png", "Icon-72.png", "Icon-72@2x.png", "Icon-76.png", "Icon-76@2x.png", "Icon-Small-50.png", "Icon-Small-50@2x.png", "Icon-Small.png", "Icon-Small@2x.png" }, }, }, android = { permissions = { { name = ".permission.C2D\_MESSAGE", protectionLevel = "signature" }, }, usesPermissions = { "android.permission.WRITE\_EXTERNAL\_STORAGE", "android.permission.INTERNET", "android.permission.ACCESS\_NETWORK\_STATE", "android.permission.ACCESS\_WIFI\_STATE", "android.permission.GET\_ACCOUNTS", "android.permission.RECEIVE\_BOOT\_COMPLETED", "com.google.android.c2dm.permission.RECEIVE", ".permission.C2D\_MESSAGE", }, }, orientation = { default = "portrait", supported = { "portrait", "portraitUpsideDown" } }, }&nbsp;

This is driving me crazy and I’m close to giving up … 

I will be really thankful for anyone who can help 

  1. Do you only want the social plugin on iOS?  Could this be an error around that (one difference between iOS and Android that’s obvious).

  2. Besides case sensitivity issues, errors in your build.settings is probably the #2 cause of it won’t run on device problems.  I don’t see any obvious errors, but, without seeing all the indentions correctly, it’s hard to visually check it.

  3. I would recommend putting some prints in your code to identify where it’s crashing.  Clearly you’re getting somewhere after Checking files or near the end of that process.  

  4. We know the error is in a listener file and some value defined locally above that listener function is nil.  Without some code it’s going to be hard to tell more.

Rob

  1. Yes, the social plugin should only be on iOS. And I have already tried removing that block of code for the social plugin and it’s giving me the same error.

  2. Are there any case sensitivity issues? because I don’t see any. Also, how can I reproduce the problem? Any suggestion here?

  3. I already did that and it’s the same error. Error will be after the already defined printed statement “Checking files…”

  4. I will check that listener again, but I’m confident it’s not the issue as I have no problem on iOS device builds.

I’m suspecting it’s a writing to file permission related issue on Android but not really sure about it, because that listener checking if the file that was downloaded exists yet or not… could that be an issue?  

Thank you Rob!

For #2, I was suggesting that there may be an error in your build.settings.  It’s a common cause of “It doesn’t run on Android”.

It’s going to be hard to offer any advice without seeing the code around the error.  But yea, it could be an issue.

I replaced build.settings file for an app that works fine on Android and I got the same error. Could it be a bug in Corona SDK? Can I email you the source code to look at (I’m at dead road and can’t find any problem)? This is the first time it happens to me. I have developed five previous apps with no issues like this one. 

  1. Do you only want the social plugin on iOS?  Could this be an error around that (one difference between iOS and Android that’s obvious).

  2. Besides case sensitivity issues, errors in your build.settings is probably the #2 cause of it won’t run on device problems.  I don’t see any obvious errors, but, without seeing all the indentions correctly, it’s hard to visually check it.

  3. I would recommend putting some prints in your code to identify where it’s crashing.  Clearly you’re getting somewhere after Checking files or near the end of that process.  

  4. We know the error is in a listener file and some value defined locally above that listener function is nil.  Without some code it’s going to be hard to tell more.

Rob

  1. Yes, the social plugin should only be on iOS. And I have already tried removing that block of code for the social plugin and it’s giving me the same error.

  2. Are there any case sensitivity issues? because I don’t see any. Also, how can I reproduce the problem? Any suggestion here?

  3. I already did that and it’s the same error. Error will be after the already defined printed statement “Checking files…”

  4. I will check that listener again, but I’m confident it’s not the issue as I have no problem on iOS device builds.

I’m suspecting it’s a writing to file permission related issue on Android but not really sure about it, because that listener checking if the file that was downloaded exists yet or not… could that be an issue?  

Thank you Rob!

For #2, I was suggesting that there may be an error in your build.settings.  It’s a common cause of “It doesn’t run on Android”.

It’s going to be hard to offer any advice without seeing the code around the error.  But yea, it could be an issue.

I replaced build.settings file for an app that works fine on Android and I got the same error. Could it be a bug in Corona SDK? Can I email you the source code to look at (I’m at dead road and can’t find any problem)? This is the first time it happens to me. I have developed five previous apps with no issues like this one.