diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 7fe1b13..d938db2 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -22,6 +22,7 @@ ().patchedApk - if (Build.VERSION.SDK_INT < 29) { - state = StepState.Skipped - return - } - var resourcesArscBytes: ByteArray? = null + var nativeLibPaths: List? = null var dexCount: Int = -1 // Align resources.arsc due to targeting API 30 for silent install @@ -54,6 +49,18 @@ class AlignmentStep : Step(), KoinComponent { } } + // Align native libs due to using extractNativeLibs + nativeLibPaths = ZipReader(apk).use { zip -> + val libPaths = zip.entryNames.filter { it.endsWith(".so") } + for ((idx, path) in libPaths.withIndex()) { + // Index is just used as a placeholder id to cache on disk + val bytes = zip.openEntry(path)!!.read() + val file = paths.patchingWorkingDir().resolve("$idx.so") + file.writeBytes(bytes) + } + libPaths + } + ZipWriter(apk, /* append = */ true).use { zip -> // Delete all the unaligned files from APK if (resourcesArscBytes != null) @@ -62,6 +69,9 @@ class AlignmentStep : Step(), KoinComponent { for (i in 0..