1

Is there any way to programmatically check whether armeabi, armeabi-v7a etc lib will be used by the device?

I'm guessing some combination of Build.CPU_ABI and Build.CPU_ABI2?

What is the most reliable way to check?

Mark
  • 7,446
  • 5
  • 55
  • 75
  • 1
    The most *reliable* way would be to see which actually gets copied out of the apk during installation, as that would seem to capture even bugs in the decisioning system (there has been at least one). – Chris Stratton Feb 24 '14 at 07:50
  • How to conveniently check which of the libs was actually copied? – Mark Feb 24 '14 at 09:06
  • You may be able to extract that from the elf header. Or you could substitute something in each .so before packaging. A same-length string can be substituted in a binary with `sed`. If the files are copied verbatim an md5 fingerprint might work or even length could be enough for disambiguation. – Chris Stratton Feb 24 '14 at 15:00
  • I'd rather not specify MD5 or lib file length, even though I suppose these can be calculated on the fly in gradle. Too much complexity... Maybe a not-so-reliable approach is enough! – Mark Feb 24 '14 at 16:04

1 Answers1

0

Just do the equivalent on native code of this Java call:

String arch = System.getProperty("os.arch");

Something like this, example here:

jclass jc_system = (* env)->FindClass(env, "java/lang/System");
jmethodID jmid_get_property = (*env)->GetStaticMethodID(env, jc_system, "getProperty", "(java/lang/String)java/lang/String");
jstring js_arch_property = (jstring) (* env)->CallStaticObjectMethod(env, jc_system, jmid_get_property, "os.arch");
// Have fun!

Update 1

Ups I forgot to convert "os.arch" (const char*) to jstring, here is how.

Community
  • 1
  • 1
Cedmundo
  • 682
  • 4
  • 12