Sign in to follow this  

Fun with Android NDK

This topic is 769 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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)

Edited by Olof Hedman

Share this post


Link to post
Share on other sites

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)

Edited by Olof Hedman

Share this post


Link to post
Share on other sites

 

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.

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

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)

Edited by Olof Hedman

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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]

Share this post


Link to post
Share on other sites

This topic is 769 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this