Fun with Android NDK

Started by
7 comments, last by grumpyOldDude 8 years, 5 months ago

Again, I'm tasked with getting our games to run on android.

Much fun, the NDK is an endless source of weird and wonderful bugs.

Somehow I missed this one, the last time I ported stuff to android, but it is now my "favorite":

https://code.google.com/p/android/issues/detail?id=16391

in system/core/run-as/package.c:

/* This should be large enough to hold the content of the package database file */
#define PACKAGES_LIST_BUFFER_SIZE 8192

Who in their right mind thinks that is a good idea?!

A quick check on a few of my devices does not show a single one with a packages.list file less then 8kb. (my Samsung S6 is about 17kb, and its brand new)

The smallest I've found is about 9kb.

This means if your app happens to be after those 8kb, on any of the affected devices, its impossible to ndk-debug it.

Fan-tas-tic!

Oh. And in some versions, they messed up the rights for packages.list and/or run-as so it is again impossible to ndk-debug until you root your device and fix it.

In 5.0, or possibly 5.1, there seems to be a new run-as bug on samsung devices, since again, its impossible to ndk-debug.

You think upgrading tools might be a good idea? Think again, on r10e (the latest), the ndk-gdb script is broken, so running it is useless until you patch it.

And in any case, if you try build with v21+, it will not run on any device with android version less then 5.0, because they moved location of cstdlib...

I so love to have to debug my tool chain, and can't wait for what weird and wonderful bugs they can come up with for the next release.

Sorry, just had to vent a bit smile.png

(And if I post some posts with a bad attitude on any of the other subforums, you now know why... I'll try to avoid it)

Advertisement

biggrin.png welcome to the crazy world of Android!

I know you are a smartphone dev veteran .... but still welcome to this chaotic world of Android

can't help being grumpy...

Just need to let some steam out, so my head doesn't explode...

Thank you for the support! :)

Got NDK debugging of my C++ code to work today.

Just had to learn some python and fix the ndk-gdb.py script, because that too turned out to be broken in r10e.

(I guess since ndk-gdb shell script works so bad, someone rewrote it in python. Awsome. Now two non-working versions of the same tool with slightly different bugs)

Oh. And in some versions, they messed up the rights for packages.list and/or run-as so it is again impossible to ndk-debug until you root your device and fix it.

In 5.0, or possibly 5.1, there seems to be a new run-as bug on samsung devices, since again, its impossible to ndk-debug.

You might be touching on the same problem I encountered...in the end I took run-as source code and uploaded my modified version to Samsung mobiles. This was as a last resort after trying all the other attempts to fix it and rooting my phone.

And yes my modified run-as executable got native debugging working!

Now if only Google paid me I would quite happily fix more of their NDK.

Cool!

What changes did you do?

Is it the old 8kb buffer problem that have re-appeared?

I havn't gotten around to rooting the S6 yet, since I got it working on my Acer Iconia Tab (Atom processor), but I'd very much like to get it working on the S6 sooner or later.


Now if only Google paid me I would quite happily fix more of their NDK.

They should post bounties for bug hunters!

For anyone who happens upon this page in the search for getting ndk debugging to work on Samsung S6:

I got it working on 5.1.1 by rooting the device, and set the suid bit on run-as. (chmod 4755 /system/bin/run-as)

I worked on Android OS development for several years, and those native debugging tools are absolutely miserable. We were lucky to be able to keep native debugging working from build to build...

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

It gives me a warm feeling that even experienced programmers are having troubles with the NDK. I had literally zero experience with with Mobile development, but was tasked with getting the Vuforia (AR) Framework running with the Unreal Engine. I still cringe everytime I think of it.

The most remarkable issue was that after downloading and unpacking the NDK, I got weird "failed to call XXX" (or something along those lines) issues when trying to compile some samples. Turns out the NDK-package file didn't unpack all files in the download location, for example several .exe files were missing until I moved the package to another folder and unpacked it there. Wtf? I mean, I know its probably not an NDK issue, but its still weird, I think they offered a downloadable "exe" where I imagined an installer would come up, and then I get an auto-extracting archive. Oh, thanks a lot, what happened to the .7z file ending?

Regardless, it pretty much sums up my (short, noobish) NDK-experience: Omg, wtf am I doing there?

For anyone who happens upon this page in the search for getting ndk debugging to work on Samsung S6:

I got it working on 5.1.1 by rooting the device, and set the suid bit on run-as. (chmod 4755 /system/bin/run-as)

How about errors pertaining to missing jar files? Seem similar to what you solved already? [fixed]

can't help being grumpy...

Just need to let some steam out, so my head doesn't explode...

This topic is closed to new replies.

Advertisement