Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Support for 16 KB devices on Capacitor

I have a web application (React 19) wrapped with capacitor 7. With it I ship the app to Android and IOS phones.

I got this message from the Google Play console:

Your app bundle contains native code that does not support 16 KB page sizes

Because I use Capacitor, and all the Android/IOS things come from Capacitor and some corresponding packages, how do I need to deal with the problem?

I've tried looking at the Capacitor site and docs but haven't found any references to the issue.

How can I deal with the issue?

Details:

"@capacitor/android": "^7.4.2",
"@capacitor/app": "^7.0.1",
"@capacitor/core": "^7.4.2",
"@capacitor/device": "^7.0.1",
"@capacitor/ios": "^7.4.2",
like image 632
Chen Peleg Avatar asked Sep 08 '25 06:09

Chen Peleg


1 Answers

The problem has nothing to do with Capacitor, but with a plugin your app is using.

To find out which ones may not be supporting the new size you can:
1 Generate the APK

2 In Android Studio: Build > Analyze APK

3 Check whether there is any .so file inside the lib folder. Like:
enter image description here

In my example I researched and the problem was my sqlite cordova plugin. I upgraded it into a version that supports 16Kb (checked that within the library issues).

The other steps I did to fix it are:

1 In gradle.properties (Project Properties), set android.experimental.enablePagedMemory=true

2 Upgrade AGP version to at least 8.5.1

3Upgrade Gradle to the needed for the AGP upgrade.

4 In Android Studio, go to Tools > SDK Manager > SDK Tools
Find NDK and download and install a version >= 28

5 In your build.gradle (Module :app), add the same NDK version to the android config like:

android {
    ndkVersion "28.2.13676358"
    // rest of your config
}

6 Within the same android config, add these options:

android {
    // rest of your config
    packagingOptions {
        resources {
            excludes += ['META-INF/NOTICE', 'META-INF/LICENSE']
        }
    }
}

7 Ensure that you have the AGP desired version:
// build.gradle (Project: android)
enter image description here

8 Ensure you have the desired Gradle version
// gradle-wrapper.properties

distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip`

With the updated plugin and by building the app with this configuration, you can run the check ELF script over you APK and you should get only ALIGNED segments. That will be the sign that your app supports 16kb and you won't get any warning when running it in a 16kb based system.

Check out the official Android docs for further information.

like image 51
jmonloop Avatar answered Sep 09 '25 18:09

jmonloop