ARSCLib icon indicating copy to clipboard operation
ARSCLib copied to clipboard

ApkModule.loadApkFile(file) crash

Open mahdizareeii opened this issue 1 year ago • 6 comments

Hi, when I want to load a file in API 21 (android 5) I'm getting following error but in API 34 its ok, thanks in advance to helping me.

java.lang.NoSuchMethodError: No virtual method toPath()Ljava/nio/file/Path; in class Ljava/io/File; or its super classes (declaration of 'java.io.File' appears in /system/framework/core-libart.jar) at com.reandroid.archive.io.ZipFileInput.getFileChannel(ZipFileInput.java:84) at com.reandroid.archive.io.ZipFileInput.getFooter(ZipFileInput.java:69) at com.reandroid.archive.block.EndRecord.findEndRecord(EndRecord.java:61) at com.reandroid.archive.model.CentralFileDirectory.visit(CentralFileDirectory.java:48) at com.reandroid.archive.Archive.(Archive.java:46) at com.reandroid.archive.ArchiveFile.(ArchiveFile.java:30) at com.reandroid.archive.ArchiveFile.(ArchiveFile.java:33) at com.reandroid.apk.ApkModule.loadApkFile(ApkModule.java:1308) at com.reandroid.apk.ApkModule.loadApkFile(ApkModule.java:1305) at com.appstudio.test.appmaker.AppMaker.assembleFile(AppMaker.kt:42)

mahdizareeii avatar Sep 21 '24 18:09 mahdizareeii

As documented here File#toPath() is introduced on API 26.

If you can, at ZipFileInput: change fileChannel = FileChannel.open(this.file.toPath(), StandardOpenOption.READ); to fileChannel = new FileInputStream(file).getChannel();

REAndroid avatar Sep 21 '24 20:09 REAndroid

i added your module in my project, so I don't have access to modify your file, unless I copy all your file into my project :)

mahdizareeii avatar Sep 22 '24 07:09 mahdizareeii

As documented here File#toPath() is introduced on API 26.

If you can, at ZipFileInput: change fileChannel = FileChannel.open(this.file.toPath(), StandardOpenOption.READ); to fileChannel = new FileInputStream(file).getChannel();

Request the latest Releases:https://github.com/REAndroid/ARSCLib/releases

cgapk123 avatar Oct 13 '24 15:10 cgapk123

i know it, but the REAndroid should fix it, Im using the latest version

mahdizareeii avatar Oct 17 '24 06:10 mahdizareeii

@mahdizareeii I tested it myself, getting ARSCLib to work in api 21 would require a lot of changes. For now, I'm enabling desugaring (nio version) in my project to make it work.

I'm considering making an api 21-compatible fork.

kaanelloed avatar Jan 12 '25 21:01 kaanelloed

@kaanelloed i'll try it, thanks my bro

mahdizareeii avatar Jan 16 '25 07:01 mahdizareeii