Skip to content

Error occurs when writing output apk - Splitting not support for pre Lollipop Android (Api 22). #2130

Open
@huangkr03

Description

@huangkr03

Describe the bug
This error occurs when calling PackManager.v().writeOutput(); after analyzing the apk file that minSdkVersion < 22.

Input file
com.nokoprint.apk,its metadata are as follows:
packageName: com.nokoprint
label: NokoPrint
icon: res/mipmap-mdpi-v4/ic_launcher.png
versionName: 5.2.0
versionCode: 230
minSdkVersion: 19
targetSdkVersion: 32
maxSdkVersion: null

To reproduce
It seems that all of the input apks that minSdkVersion < 22 will raise this error when calling PackManager.v().writeOutput();
I also tried Options.v().set_android_api_version(compileSdkVersion); and Options.v().set_android_api_version(minSdkVersion);. The error keeps occuring.

Expected behavior
Error will occur when calling PackManager.v().writeOutput();

Stacktrace

Exception in thread "Thread-64" java.lang.RuntimeException: Dex file overflow. Splitting not support for pre Lollipop Android (Api 22).
at soot.toDex.MultiDexBuilder.hasOverflowed(MultiDexBuilder.java:96)
at soot.toDex.MultiDexBuilder.internClass(MultiDexBuilder.java:58)
at soot.toDex.DexPrinter.addAsClassDefItem(DexPrinter.java:663)
at soot.toDex.DexPrinter.add(DexPrinter.java:1686)
at soot.PackManager.writeClass(PackManager.java:1072)
at soot.PackManager.lambda$writeOutput$1(PackManager.java:705)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)

Additional context
I tried to use apktool to reset the minSdkVersion of the app, and the error disappeared. But this process is too troublesome.
So I wonder if soot could help modify the minSdkVersion when calling PackManager.v().writeOutput();.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions