sevenzipjbinding icon indicating copy to clipboard operation
sevenzipjbinding copied to clipboard

Is it support Android?

Open qqli007 opened this issue 10 years ago • 17 comments

qqli007 avatar Dec 01 '15 06:12 qqli007

Theoretically yes, but I never tried it. You can try ARM jar for ARM-based Android systems.

borisbrodski avatar Dec 01 '15 22:12 borisbrodski

@borisbrodski , I test the library on Mi Note, android os 4.4.4 and It not work. I test it like this: 1.use those libs sevenzipjbinding.jar sevenzipjbinding-Linux-arm.jar

  try {
            SevenZip.initSevenZipFromPlatformJAR();
            System.out.println("7-Zip-JBinding library was initialized");
        } catch (SevenZipNativeInitializationException e) {
            e.printStackTrace();
        }

and the error log:

12-06 17:50:43.342 32609-32609/com.example.lz.myunrar W/System.err: net.sf.sevenzipjbinding.SevenZipNativeInitializationException: Error loading SevenZipJBinding native library into JVM: error loading native library 'lib7-Zip-JBinding.so' from a jar-file 'sevenzipjbinding-<Platform>.jar'. [You may also try different SevenZipJBinding initialization methods 'net.sf.sevenzipjbinding.SevenZip.init*()' in order to solve this problem] 
12-06 17:50:43.342 32609-32609/com.example.lz.myunrar W/System.err:     at net.sf.sevenzipjbinding.SevenZip.throwInitException(SevenZip.java:827)
12-06 17:50:43.342 32609-32609/com.example.lz.myunrar W/System.err:     at net.sf.sevenzipjbinding.SevenZip.throwInitException(SevenZip.java:822)
12-06 17:50:43.342 32609-32609/com.example.lz.myunrar W/System.err:     at net.sf.sevenzipjbinding.SevenZip.copyOrSkipLibraries(SevenZip.java:563)
12-06 17:50:43.342 32609-32609/com.example.lz.myunrar W/System.err:     at net.sf.sevenzipjbinding.SevenZip.initSevenZipFromPlatformJARIntern(SevenZip.java:454)
12-06 17:50:43.342 32609-32609/com.example.lz.myunrar W/System.err:     at net.sf.sevenzipjbinding.SevenZip.initSevenZipFromPlatformJAR(SevenZip.java:339)
12-06 17:50:43.342 32609-32609/com.example.lz.myunrar W/System.err:     at com.example.lz.myunrar.MainActivity.test7zipJ(MainActivity.java:64)
12-06 17:50:43.342 32609-32609/com.example.lz.myunrar W/System.err:     at com.example.lz.myunrar.MainActivity.onCreate(MainActivity.java:38)
12-06 17:50:43.342 32609-32609/com.example.lz.myunrar W/System.err:     at android.app.Activity.performCreate(Activity.java:5249)
12-06 17:50:43.342 32609-32609/com.example.lz.myunrar W/System.err:     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
12-06 17:50:43.342 32609-32609/com.example.lz.myunrar W/System.err:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2165)
12-06 17:50:43.342 32609-32609/com.example.lz.myunrar W/System.err:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2250)
12-06 17:50:43.342 32609-32609/com.example.lz.myunrar W/System.err:     at android.app.ActivityThread.access$900(ActivityThread.java:141)
12-06 17:50:43.342 32609-32609/com.example.lz.myunrar W/System.err:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1213)
12-06 17:50:43.342 32609-32609/com.example.lz.myunrar W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:102)
12-06 17:50:43.342 32609-32609/com.example.lz.myunrar W/System.err:     at android.os.Looper.loop(Looper.java:136)
12-06 17:50:43.342 32609-32609/com.example.lz.myunrar W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:5072)
12-06 17:50:43.342 32609-32609/com.example.lz.myunrar W/System.err:     at java.lang.reflect.Method.invokeNative(Native Method)
12-06 17:50:43.342 32609-32609/com.example.lz.myunrar W/System.err:     at java.lang.reflect.Method.invoke(Method.java:515)
12-06 17:50:43.342 32609-32609/com.example.lz.myunrar W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
12-06 17:50:43.342 32609-32609/com.example.lz.myunrar W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
12-06 17:50:43.342 32609-32609/com.example.lz.myunrar W/System.err:     at dalvik.system.NativeStart.main(Native Method)

Do you have any idea with this?

qqli007 avatar Dec 06 '15 09:12 qqli007

Look's like we experience this issue: https://code.google.com/p/android/issues/detail?id=10076

#7 [email protected] OK - I now understand android a little better now. I normal java you can locate resources (via the classloader) by bundling them in with the class files and then making a java archive. Android creates the dex from the classes and any resources get thrown out unless explicitly referenced by apkbuilder using '-rf' for the root resource dir and then the resources are saved as a tree at the base of the apk file.

It's a real shame that your documentation doesn't specify this in both ClassLoader and ResourceBundle - it would save the few a lot of time!

Thanks for the pointers ... best, Nick

I will have to rewrite initialization algorithm for Android later.

But for now, could you please try to load the ARM native library manually? Just extract sevenzipjbinding-Linux-arm.jar and put the library into resources directory. Then load it manually like this

System.load(libraryPathAndFileNameOnAndroidDevice);
SevenZip.initLoadedLibraries();
System.out.println("7-Zip-JBinding library was initialized");

borisbrodski avatar Dec 07 '15 08:12 borisbrodski

@borisbrodski ,I do it like this:

System.load(Environment.getExternalStorageDirectory() + "/Download/lib7-Zip-JBinding.so");
            SevenZip.initLoadedLibraries();
            System.out.println("7-Zip-JBinding library was initialized");

but it has err:

12-09 16:11:40.834 2853-2853/com.example.lz.myunrar E/AndroidRuntime: FATAL EXCEPTION: main
                                                                      Process: com.example.lz.myunrar, PID: 2853
                                                                      java.lang.UnsatisfiedLinkError: dlopen failed: empty/missing DT_HASH in "lib7-Zip-JBinding.so" (built with --hash-style=gnu?)
                                                                          at java.lang.Runtime.load(Runtime.java:333)
                                                                          at java.lang.System.load(System.java:512)
                                                                          at com.example.lz.myunrar.MainActivity.test7zipJ(MainActivity.java:65)
                                                                          at com.example.lz.myunrar.MainActivity.onCreate(MainActivity.java:38)
                                                                          at android.app.Activity.performCreate(Activity.java:5249)
                                                                          at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
                                                                          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2165)
                                                                          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2250)
                                                                          at android.app.ActivityThread.access$900(ActivityThread.java:141)
                                                                          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1213)
                                                                          at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                          at android.os.Looper.loop(Looper.java:136)
                                                                          at android.app.ActivityThread.main(ActivityThread.java:5072)
                                                                          at java.lang.reflect.Method.invokeNative(Native Method)
                                                                          at java.lang.reflect.Method.invoke(Method.java:515)
                                                                          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
                                                                          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
                                                                          at dalvik.system.NativeStart.main(Native Method)

qqli007 avatar Dec 09 '15 08:12 qqli007

I tried the same thing .ended up with

FATAL EXCEPTION: main java.lang.UnsatisfiedLinkError: dlopen failed: library "libdl.so.2" not found at java.lang.Runtime.loadLibrary(Runtime.java:372) at java.lang.System.loadLibrary(System.java:1076)

arpitkh96 avatar Jan 18 '16 16:01 arpitkh96

Thank you. I consider Android support very important. But it will need some afford to make it happen.

Any help is appreciated!

borisbrodski avatar Jan 19 '16 11:01 borisbrodski

Yea ask it anytime

arpitkh96 avatar Jan 20 '16 18:01 arpitkh96

Thank you!

borisbrodski avatar Jan 22 '16 08:01 borisbrodski

I got the same error (.... java.lang.UnsatisfiedLinkError: dlopen failed: ...) There are some solution?

slapolt avatar Jul 22 '16 12:07 slapolt

There is actually a successful port to Android made by seven332: https://github.com/seven332/sevenzipjbinding/tree/migrate-to-15.09-try2

You might give it a try!

(I will encorporate it into the official 7-Zip-JBinding in a while.)

borisbrodski avatar Jul 22 '16 12:07 borisbrodski

Thanks for the quick response. I need to unpack only - arj. In the link I see tar, zip, 7z ....., but I do not see arj. :( Something missed, or is not there?

slapolt avatar Jul 22 '16 13:07 slapolt

7-Zip-JBinding does support ARJ. Check the ArchiveFormat enum here: https://github.com/seven332/sevenzipjbinding/blob/migrate-to-15.09-try2/jbinding-java/src/net/sf/sevenzipjbinding/ArchiveFormat.java

borisbrodski avatar Aug 02 '16 10:08 borisbrodski

Thanks for your great library. It's very useful for me, but I have a bug with a certain file which I can extract using other apps normally. I get ExtractOperationResult.DATAERROR. I am using seven332's port to android. This is the archive I'm trying to extract. http://www100.zippyshare.com/v/n5VRzhIV/file.html Thanks in advance

MSDarwish2000 avatar Aug 08 '16 13:08 MSDarwish2000

Thank You for the report. I'm on vocation right now (with no laptop in sight!). I will be back in two weeks. Please, drop a small reminder message here, if don't  get response by the time. Thank you! Cheers,Boris

Gesendet von Yahoo Mail auf Android

Am Mo., 8. Aug. 2016 um 15:43 hat [email protected] Folgendes geschrieben:
Thanks for your great library. It's very useful for me, but I have a bug with a certain file which I can extract it using other apps normally. I get ExtractOperationResult.DATAERROR. I am using seven332's port to android. This is the archive I'm trying to extract. http://www100.zippyshare.com/v/n5VRzhIV/file.html Thanks in advance

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

borisbrodski avatar Aug 08 '16 14:08 borisbrodski

Thank you for your quick response. Take your time. I hope you'll enjoy.

MSDarwish2000 avatar Aug 08 '16 19:08 MSDarwish2000

@MSDarwish2000 @borisbrodski can you help me with https://github.com/borisbrodski/sevenzipjbinding/issues/52

asthagarg2428 avatar Apr 06 '22 12:04 asthagarg2428

Hello borisbrodski. Is this project support Android? Hope for your reply!

MyAndyMy avatar Oct 29 '22 07:10 MyAndyMy