l-jinbin / apkdatamultiplexing Goto Github PK
View Code? Open in Web Editor NEWAPK数据复用优化
APK数据复用优化
Cannot read entry '**/test.apk' (offset: 6460432, size: 137274417) because it overlaps with 'lib/arm64-v8a/libALBiometricsJni.so'
某些原始 apk 数据复用优化后会无法安装
两个 &&
应该改成 ||
这样改也可以:
// 必须4k对齐
if (innerEntry.getMethod() == ZipMaker.METHOD_STORED || innerEntry.getDataOffset() % 4 != 0) {
String name = innerEntry.getName();
if (name.equals("resources.arsc") || name.endsWith(".so")) {
System.out.println(name + " getDataOffset: " + (innerEntry.getDataOffset() % 4));
System.out.println(name + " getMethod: " + (innerEntry.getMethod() == ZipMaker.METHOD_STORED));
continue;
}
}
输出:
lib/armeabi/libxxx.so getDataOffset: 0
lib/armeabi/libxxx.so getMethod: true
经过打印 innerEntry.getDataOffset() % 4
发现是启用了 4k 对齐,但是 innerEntry.getMethod()
是 METHOD_STORED
。这样改就正常了。
怎么没看到IO重定向相关的代码呢
使用V1 + V2 / V3 签名的apk进行数据数据复用:
1、测试在800多MB的apk是正常的
2、测试在2.2G的apk(com.studiowildcard.wardrumstudios.ark),安装会报错
Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES: Failed to collect certificates from /data/app/vmdl1215474834.tmp/base.apk using APK Signature Scheme v3: integer overflow]
而只使用apksig 进行 V1 + V2 / V3 签名,没有数据复用,可以正常安装,能否提供点帮助,非常感谢
if (name.equals("resources.arsc") || name.startsWith(".so")) {
是不是应该为
if (name.equals("resources.arsc") || name.endsWith(".so")) {
I made a simple command line tool on PC for this. I repackaged original APK as storage, assuming it means no compression but I'm still getting error that it must be packaged with the stored method, regardless what zip utilities. What I am doing wrong?
Exception in thread "main" java.io.IOException: Entry must be packaged with the stored method: assets/test.apk
at bin.zip.DataMultiplexing.openEntryAsZipFile(DataMultiplexing.java:156)
at bin.zip.DataMultiplexing.collectChildren(DataMultiplexing.java:113)
at bin.zip.DataMultiplexing.optimize(DataMultiplexing.java:44)
at bin.zip.DataMultiplexing.optimize(DataMultiplexing.java:30)
at bin.Main.main(Main.java:19)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.