Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support 7-Zip archives #163

Closed
xmikos opened this issue Jul 12, 2015 · 15 comments · Fixed by #1606
Closed

Support 7-Zip archives #163

xmikos opened this issue Jul 12, 2015 · 15 comments · Fixed by #1606
Assignees
Labels
Issue-Feature A feature request or improvement.
Milestone

Comments

@xmikos
Copy link

xmikos commented Jul 12, 2015

Please add support for 7-Zip (.7z) archives. Preferably also support encrypted ones.

@arpitkh96 arpitkh96 added the Issue-Feature A feature request or improvement. label Aug 15, 2015
@ghost
Copy link

ghost commented Nov 29, 2015

It can be done with commons-compress...

@yankejustin
Copy link

@wb9688 What do you mean?

@mirh
Copy link

mirh commented Aug 23, 2017

@B4rabbas
Copy link

Hello,
How do you add common compress to amaze or the android system ?
Thanks.

Best regards
B.

@EmmanuelMess
Copy link
Member

EmmanuelMess commented Feb 12, 2018

Commons compress is already implemented... Adding 7z to the decompression is not that difficult, see CompressedHelper.

@B4rabbas
Copy link

B4rabbas commented Feb 12, 2018

Hello Emmanuel,
Thanks for your job ! That's so great.
So I have to enter all theses commands in adb shell, isn't it ?
Thanks.
Cheers
B.

Edit : I've just try : your script it don't work this way, maybe I have to edit some stuff into it ? ty

barabbas@PepperChuwi:~$ adb shell
adb server is out of date.  killing...
* daemon started successfully *
shell@HWPLK:/ $ package com.amaze.filemanager.filesystem.compressed;
/system/bin/sh: package: not found
127|shell@HWPLK:/ $ 
*
 * @author Emmanuel
 *         on 23/11/2017, at 17:46.
 */

public class CompressedHelper {

    public static final String fileExtensionZip = "zip", fileExtensinJar = "127|shell@HWPLK:/ $ import android.content.Context;

/system/bin/sh: import: not found
127|shell@HWPLK:/ $ 

ilesystem.compressed.extractcontents.helpers.GzipExtractor;                   <

[...]

@EmmanuelMess
Copy link
Member

To add support for 7zip you must create the Decompressor and Extractor and then add the constructors to getCompressorInstance() and getExtractorInstance() respectively (for that you will need to create the isSevenZip() function in CompressedHelper). Then recompile and run.

@VishalNehra
Copy link
Member

@EmmanuelMess maybe you can implement it? It's difficult for someone without the knowledge of java programming.

@EmmanuelMess
Copy link
Member

Not enough time, will see.

@TeamAmaze TeamAmaze deleted a comment from B4rabbas Feb 14, 2018
@B4rabbas
Copy link

B4rabbas commented Feb 14, 2018

I don't kwow why that make you mad ?! That was constructive & polite, it don't need to be moderated (just answer "I can't give you info" or anything else). Don't care about me I'll never ask you anything... Bye

@EmmanuelMess
Copy link
Member

EmmanuelMess commented Feb 14, 2018

@B4rabbas This is a 7z issue in a file manager, your deleted comment wasn't constructive, it was just asking for tutorials, this is not the place.

@B4rabbas
Copy link

B4rabbas commented Feb 14, 2018

If I compile an apk with the compress-commons code and share it there I think it's a good request if the issue is fixed at the end...
However you can moderate this message too when you read it. I'll just read the few info I found here and try to make it with theses in completion of info mined on others forums
Of course it's not emotional reaction/ego trip, if I find a method to compile it I'll share it to, with your help or not (I understand you have a life like anybody else).

@EmmanuelMess EmmanuelMess added this to the v3.4.0 milestone Feb 25, 2018
@TranceLove
Copy link
Collaborator

TranceLove commented Mar 1, 2019

A little update about the situation.

For processing 7zip files, commons-compress seems to be the obvious choice, since we had been using it and if you don't want to mess with yet another external library.

I did wrote some POC on my own feature branch (which is a greedy one, I was trying to solve #138 and bring #1222 back), but end up crashing my Oneplus 2 running Slim7 (7.1.2)

2019-03-01 22:42:01.092 32484-32601/? E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
    Process: com.amaze.filemanager.debug, PID: 32484
    java.lang.RuntimeException: An error occurred while executing doInBackground()
        at android.os.AsyncTask$3.done(AsyncTask.java:325)
        at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
        at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
        at java.util.concurrent.FutureTask.run(FutureTask.java:242)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
        at java.lang.Thread.run(Thread.java:761)
     Caused by: 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-oj.jar)
        at org.apache.commons.compress.archivers.sevenz.SevenZFile.<init>(SevenZFile.java:108)
        at org.apache.commons.compress.archivers.sevenz.SevenZFile.<init>(SevenZFile.java:262)
        at com.amaze.filemanager.asynchronous.asynctasks.compress.SevenZipHelperTask.addElements(SevenZipHelperTask.java:30)
        at com.amaze.filemanager.asynchronous.asynctasks.compress.CompressedHelperTask.doInBackground(CompressedHelperTask.java:48)
        at com.amaze.filemanager.asynchronous.asynctasks.compress.CompressedHelperTask.doInBackground(CompressedHelperTask.java:33)
        at android.os.AsyncTask$2.call(AsyncTask.java:305)
        at java.util.concurrent.FutureTask.run(FutureTask.java:237)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) 
        at java.lang.Thread.run(Thread.java:761) 

And it turned out, java.io.File.toPath() is only available from Android 8.0 onwards.

Choices ahead:

  • Make 7z support only available > Android 8.0, but let's face it, many of us still have Kitkats and Lollipops
  • Or some refactoring that can try to dodge java.io.File.toPath()?
  • Use other library if available... but read this SO entry too

Either way, feel free to contribute if you like, either fork my branch or roll your own PR.

@TranceLove
Copy link
Collaborator

TranceLove commented Mar 3, 2019

Tried to fix the compatibility problem with "backported" commons-compress's 7zip to use FileChannel only, which should be adequate for our purposes (as of f002016).

Though displays are incorrect, at least such modified code can run fine on Android emulator running 4.4 (API 19).

Will continue work on as time allows.

@TranceLove TranceLove reopened this Mar 3, 2019
@VishalNehra
Copy link
Member

@TranceLove great! Really appreciate you finding time to work on it. I'll also check your code and see if I can be of any help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Feature A feature request or improvement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants