hawk icon indicating copy to clipboard operation
hawk copied to clipboard

Fix 16KB Page Size Conflict with Hawk/Conceal

Open davidnavarrom opened this issue 3 months ago • 10 comments

Hey everyone,

This is a step-by-step guide on how we solved the requirement from Google Play Console about 16KB memory page size compatibility.

We got a notice from Google Play that any app targeting Android 15 or higher needs to support 16KB memory page sizes

This new rule mainly affects apps that use native code (the .so files). After checking our app, we found that the com.facebook.conceal library, which is a dependency of com.orhanobut:hawk, was using native code that wasn't 16KB-aligned.

https://ibb.co/zVq4VkZy

Step 1: Rebuilding Conceal for 16KB Alignment

Our first move was download the source code for the Conceal library (https://github.com/facebookarchive/conceal) and recompiled it ourselves. The goal was to make sure its native binaries (.so files) were properly aligned for 16KB, which would satisfy the new requirement.

This gave us a brand new, custom .aar file that we thought would solve the problem.

Step 2: The Manifest merger failed Error

When we tried to use our newly compiled .aar file in our project, we ran into a completely different build error:

Manifest merger failed : uses-sdk:minSdkVersion 24 cannot be smaller than version 28 declared in library [conceal-release.aar]

Here's what was happening:

Our App: We have our minSdkVersion set to 24 (Android 7.0) because we want to support a wide range of older devices.

Our Recompiled Library: So, in fixing the 16KB alignment issue, we accidentally created a new problem: our app couldn't use the library because its minimum SDK level was too low.

Step 3: Rebuilding with Both Fixes

The final fix was to go back and rebuild the Conceal library one more time, but this time, we made two key changes at once:

Kept the 16KB Alignment: We made sure all the build settings required by Google Play were still in place. Changed the minSdkVersion: We went into the library's build.gradle file and changed the minSdkVersion from 28 down to 24, matching our main project.

This second rebuild gave us the perfect .aar file: one that was both 16KB-aligned and compatible with our app's minSdkVersion.

How we integrated it:

  • We created a libs folder inside our app directory (app/libs).
  • We dropped the final, fixed .aar file into that folder.
  • We updated our app's build.gradle to point to the local file.

The Final, build.gradle file:

dependencies {
    // We still need to exclude Hawk's default version of Conceal
    implementation('com.orhanobut:hawk:2.0.1') { 
        exclude group: 'com.facebook.conceal', module: 'conceal' 
    }

    // Now, we point to our local .aar file that solves everything
    implementation files('libs/conceal-custom-sdk.aar') 
}

To confirm that the library is 16KB-aligned, you can use the APK Analyzer. It no longer shows any warning messages.

https://ibb.co/nMPCKrpS

My next steps are to run it through QA, test it on different devices and OS versions, and then publish the update to the Play Store. I will report back with the results.

EDIT: It works

davidnavarrom avatar Sep 06 '25 10:09 davidnavarrom

Please!

Ium-Lab avatar Sep 08 '25 14:09 Ium-Lab

@davidnavarrom Can you please share the .aar that you compiled? I tried doing so myself but ran into a lot of incompatibility issues because so many things are outdated.

ZeusLMT avatar Sep 09 '25 11:09 ZeusLMT

Hi,

The update has fixed the infringement and is working correctly.

Play Console now confirms the issue is resolved.

davidnavarrom avatar Sep 12 '25 10:09 davidnavarrom

@ZeusLMT I recommend you try building the library in your own environment separate from your usual development setup. We compiled Conceal using the latest NDK (version 28), which builds libconceal.so with the 16KB flags by default. To get it to work, we had to update all of our Gradle and Android Gradle Plugin versions. Give it a try and let me know how it goes

davidnavarrom avatar Sep 12 '25 10:09 davidnavarrom

temporarily, to solve the 16kb issue I found it easier to look for another more updated library. I changed to combination 'com.google.code.gson:gson:2.10.1' + 'androidx.security:security-crypto:1.1.0' and I eliminated Hawk

moisb avatar Sep 14 '25 02:09 moisb

@moisb We agree that it's the first option to consider. The problem is that some projects are heavily tied to the use of this library, and a short-term migration would represent a major change to the project. That's why we'll do it in a second phase. Thanks!

davidnavarrom avatar Sep 14 '25 11:09 davidnavarrom

@ZeusLMT check the following repository. This project has the .aar file uploaded.

davidnavarrom avatar Sep 14 '25 11:09 davidnavarrom

@davidnavarrom Could you share your fork of (https://github.com/facebookarchive/conceal) with the 16KB page size fix and also provide a built .aar?

I tried using the fork from (https://github.com/triniwiz/conceal) and published it as a private artifact, but all previously stored data was lost.

What I’m trying to do is something like this with a private artifact:

api("com.orhanobut:hawk:2.0.1") {
    exclude(group = "com.facebook.conceal", module = "conceal")
}
api("com.facebook.conceal:conceal:1.1.3") // Fixed artifact

Since my project is a library (and consumers cannot use .aar files directly), I need to depend on a patched Conceal artifact while keeping compatibility with previously stored data.


Finally, I managed to fix it

The library now supports replacing the original version without breaking compatibility — existing encrypted data remains accessible, and everything works seamlessly. Here’s my fork with the fix (from tag 1.1.3): 👉 https://github.com/GundamD/conceal/tree/fix-issue-16kb-lib-113

implementation("com.orhanobut:hawk:2.0.1") {
    exclude(group = "com.facebook.conceal", module = "conceal")
}
implementation("com.github.GundamD:conceal:v1.1.3-16kb-fixed-3") // Fixed artifact

GundamD avatar Sep 18 '25 11:09 GundamD

@davidnavarrom with your .aar it works well, thanks for sharing!

lukasondrak96 avatar Sep 22 '25 09:09 lukasondrak96

Looks like this is the time to finally use original way to write/read data from Shared Preferences :-)

walkmn avatar Sep 23 '25 21:09 walkmn