Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I set extractNativeLibs to false when using Android App Bundle?

I had a problem installing my app on the new Android Q Beta 1 via Android Studio. It looks just like this problem.

The answer suggests setting android:extractNativeLibs in the Manifest and it does fix the installation problem. Funny is, that is doesn't matter if it's set to true or false (either case work) but I must set it.


As realm is the only native code included in my app, I wanted to ask if I should set this flag.

Until now, I didn't need it but this and this tells me that it's actually a good thing to set this to false. It even states:

When building an AAB, it has the extractNativeLibs flag set to "false" by default.

With this set, it should be fine to use an APK or an AAB but the native code must be zipaligned. So one question remains:

Are the realm binaries correctly zipaligned?

Or in general: Are there any recommendations when using realm?


When everything is fine with this flag (and my previous AABs working just fine), the only issue here seems to be Android Q needing this flag when installing a (debug-)APK, right?

like image 686
hardysim Avatar asked Nov 06 '22 19:11

hardysim


1 Answers

When building an AAB, the native libraries will be aligned correctly automatically (the generation of APKs is handled by bundletool).

Regarding APK not running without the attribute set, this looks like a bug, either in Android Q or Android Grade Plugin. Could you file a bug for the AGP (they'll reroute it if the problem is in the platform)?

like image 64
Pierre Avatar answered Nov 14 '22 22:11

Pierre