Comments (14)
From Android M, the Android platform supports uncompressed native libraries in APKs, which allows the platform to read the native libraries directly from the APK without having to extract them. This is why you don't see them in the "lib/" directory if you're testing on a device on Android M or later.
Since the Android platform reads the native libraries from the APK directly, you should probably do the same if you need to verify something on them.
There is a flag in Gradle to disable this feature but that leads to bigger APKs on users devices since the native libraries are extracted out of the APK (and thus also longer installation times), so unless there is no workaround for what you're trying to achieve, I would strongly discourage disabling it.
from bundletool.
You can set the property android.bundle.enableUncompressedNativeLibs=false
in the gradle.properties
. Would you mind sharing why this is causing you issue?
from bundletool.
You can set the property
android.bundle.enableUncompressedNativeLibraries=false
in thegradle.properties
. Would you mind sharing why this is causing you issue?
@plecesne Thanks, but the correct property is android.bundle.enableUncompressedNativeLibs
We would like you to be aware that we couldn't use uncompressed native libs feature as we need to use the path of the .so files. For example, when we use pure data, a audio manipulating engine, we shall providing the native library path to its API for it to discover the custom externals
that we built for it to consider in audio processing. So native library path is critical for our purposes. If we leave native libs uncompressed in apk, the path returned by ApplicationInfo.nativeLibraryDir
does not contain native libraries anymore. So puredata engine wouldn't discover our custom externals.
Hope that makes sense. I wonder if there is a way to get valid native libraries path even if we keep native libs uncompressed in the apk.
from bundletool.
Ah, sorry about the name, I'll edit my comment in case somebody finds it later.
Loading the library using System.loadLibrary
(in java) or in dlopen
(in C++) should just work on Android, the platform will find the library even if it's uncompressed in the APK. So I guess it depends how this SDK loads the library you're giving it.
from bundletool.
Depending on non-Android SDKs may require you to leave APKs compressed indeed.
Note that the warning you see was removed in 3.6 canary 3.
from bundletool.
android {
packagingOptions {
jniLibs {
useLegacyPackaging = true
}
}
}
it works for me
from bundletool.
Hy @plecesne thanks for your info and suggestion.
seems I'll choose to read native libs from Apk directly. J
from bundletool.
@plecesne "There is a flag in Gradle to disable this feature" Could you give detail about this? I want to try disable it.
from bundletool.
I just want to have more free space to push some data into apk
from bundletool.
By compressing the native libraries, the APKs served to your users will be bigger! I explained this a bit better in #118
Although the App Bundle looks bigger and the APK files look bigger, the compression performed over the wire will be more efficient, leading to smaller downloads, and the size on device will be saved as well since the platform will not have to extract it at install time (which would result in two copies of the native libraries on device: one compressed in the APK, and one uncompressed in the installation directory).
Note also regarding size limits that the Play Console doesn't not validate the size based on the size of the App Bundle but based on the download size of the generated APKs, so compressing the native libraries doesn't gain you anything there either.
from bundletool.
Good to know that dlopen
would work fine. Still there are libraries that need a lookup "path" to discover and load plugins/extensions in the form of .so
files (like puredata mentioned above). This is typically the case with audio libraries. We used to supply them with the path provided by ApplicationInfo.nativeLibraryDir
. As mentioned, this path is reported empty when native libs are uncompressed in the apk. Thus it doesn't work. So we could take advantage of this feature only if the platform provides a filesystem path that present native libs even though they still reside in apk.
Until then, android.bundle.enableUncompressedNativeLibs=false
is critical for our purposes if we intend to use app bundle. We are glad to use app bundle as it reduced our app size by half! However, currently we get this warning (which is bit unsettling :--)
WARNING: The option setting 'android.bundle.enableUncompressedNativeLibs=false' is experimental and unsupported.
from bundletool.
you can use :
getContext().getApplicationInfo().nativeLibraryDir;
to fetch the actual native lib path if you want to use these libs like export the env with these so libs;
from bundletool.
android.bundle.enableUncompressedNativeLibs=false
It helped me a lot, I suffered a lot with this error
from bundletool.
I have tried with android.bundle.enableUncompressedNativeLibs=false, unfortunately it does not create lib/arm64 folder on release builds
from bundletool.
Related Issues (20)
- Different get-size result between local and server build HOT 1
- Error: Module 'myzip' is missing mandatory file 'manifest/AndroidManifest.xml' HOT 2
- bundletool build-apks failed when minsdk<21 HOT 1
- [BUG] Error: Module 'base' is missing mandatory file 'manifest/AndroidManifest.xml'. HOT 1
- Add bundletool to winget
- The App bundle is not a valid zip file HOT 1
- Unable to sign apk HOT 2
- Unable to sign APK due to FileAlreadyExistsException HOT 5
- com.android.tools.build.bundletool.model.exceptions.InvalidBundleException: Invalid dex file indices, expecting file 'classes?.dex' but found 'classes2.dex'. HOT 2
- Does it make the opposite? HOT 1
- the aab upload to Google Play, size counting issue HOT 1
- Error: Module 'base' is missing mandatory file 'manifest/AndroidManifest.xml'. HOT 2
- How does `bundletool build-apks` generate the versionCode for the APKs? HOT 3
- Returns immediately on command line without any info
- Size differs between bundletool and apkanalyzer.
- Unable to install dynamic feature modules with max sdk in manifest
- Set splittypes
- Please ignore
- Option NOT To Sign The APK Even If Debug Keystore Is Present
- Bundletool Package using 2 versions of AAPT2 Proto
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bundletool.