Giter Club home page Giter Club logo

androidun7zip's Introduction

AndroidUn7zip(安卓7zip解压)

A simple library with lzma sdk for 7z extraction.(使用LZMA SDK解压7z压缩包)

auc api

Introduction

Begin To Use

  • Add gradle dependencie:
repositories {
    maven { url 'https://jitpack.io' }
}

dependencies {
   implementation 'com.github.hzy3774:AndroidP7zip:v1.7.2'
}
dependencies {
    implementation 'com.hzy:un7zip:+'
}
  • Or just download the aar here
  • If you want to add some abi filters
android {
    ...
    defaultConfig {
        ...
        ndk {
            abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86'
         }
    }
}

Java API:

boolean extractFile(filePath, outPath, callback);
boolean extractAsset(assetManager, fileName, outPath, callback);
String getLzmaVersion();

ProGuard

If you are using ProGuard you might need to add the following options:

-keep class com.hzy.lib7z.** { *; }

Fetures

  • easily extract 7z from file
  • directly extract 7z from assets
  • unicode file names is available
  • add extract callbacks

Screenshot

image

Thanks To

  • danhantao offered X86 compiled(修复了X86编译问题)
  • ransj offered the way to extract 7z file from assets directly(添加了直接从assets解压的功能)

About Me

Contact To Me

image

Others

  • 想捐助我喝杯热水(¥0.01起捐)
    donate

androidun7zip's People

Contributors

danhantao avatar huzongyao avatar hzy3774 avatar ransj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

androidun7zip's Issues

ndk编译时error: 'AAsset_getLength64' was not declared in this scope

././un7zip/7zAssetFile.cpp: In function 'WRes InAssetFile_Open(AAssetManager*, CSzAssetFile*, const char*)':
././un7zip/7zAssetFile.cpp:28:41: error: 'AAsset_getLength64' was not declared in this scope
p->length = AAsset_getLength64(asset);
^
make: *** [obj/local/armeabi-v7a/objs/un7zip/./un7zip/7zAssetFile.o] Error 1

Extract From File not worked

Hi, thank you for your solution.
i have a problem.
When i select 7z file from SD card and click on "StartExtractFile" it always returns false.

Android10 Input File Open Error

机型:华为P20
系统:Android10
复现步骤:
1、把assets目录下的TestAsset.7z拷贝到SDcard根目录
2、点击Choose File按钮, 选择SDcard根目录的TestAsset.7z
3、点击Extract File按钮

java.lang.NoSuchMethodError

A: art/runtime/thread.cc:1344] Throwing new exception 'no non-static method "Lai/ones/android/ones/utils/e$2$1;.onError(ILjava/lang/String;)V"' with unexpected pending exception: java.lang.NoSuchMethodError: no non-static method "Lai/ones/android/ones/utils/e$2$1;.onStart()V"
A: art/runtime/thread.cc:1344] at boolean com.hzy.lib7z.Z7Extractor.nExtractAsset(android.content.res.AssetManager, java.lang.String, java.lang.String, com.hzy.lib7z.a, long) (Z7Extractor.java:-2)
A: art/runtime/thread.cc:1344] at boolean com.hzy.lib7z.Z7Extractor.a(android.content.res.AssetManager, java.lang.String, java.lang.String, com.hzy.lib7z.a) (Z7Extractor.java:38)

可以考虑增加回调接口,允许使用 ReLinker 来加载 .so 文件吗?

出错log:

java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.sail.advanced.booster-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]] couldn't find "libun7zip.so"
    at java.lang.Runtime.null loadLibrary(null)(Runtime.java:366)
    at java.lang.System.null loadLibrary(null)(System.java:989)
    at com.hzy.lib7z.Z7Extractor.void <clinit>()(Z7Extractor.java:91)
    at com.hzy.lib7z.Z7Extractor.int extractAsset(android.content.res.AssetManager,java.lang.String,java.lang.String,com.hzy.lib7z.IExtractCallback)(Z7Extractor.java:57)
    at com.library.clean.db.DBHelper.void copyRawDBToApkDb()(DBHelper.java:40)
    at com.library.clean.CleanSdk$1.void run()(CleanSdk.java:25)
    at com.sharp.tooklit.threadhelper.ThreadPool$TaskWithPriority.void run()(ThreadPool.java:165)
    at java.util.concurrent.ThreadPoolExecutor.null runWorker(null)(ThreadPoolExecutor.java:1112)
    at java.util.concurrent.ThreadPoolExecutor$Worker.null run(null)(ThreadPoolExecutor.java:587)
    at java.lang.Thread.null run(null)(Thread.java:818)

只在个别机型上出现,目前看到的是 API 19, 占得比例也较小。

mmkv 的建议方案:

在某些 Android 设备上(API level 19)遇到java.lang.UnsatisfiedLinkError。这是怎么回事,我应该采取什么措施?
API level 19 的 Android 设备在安装、更新 APK 时,可能会遗漏 libmmkv.so。针对这个问题,已有专门的开源库 ReLinker 解决。

解压.PNG文件出错

解压txt文件OK,为什么一解压.png文件就报 errorCode 16 message Stream Extract Error

可否推到maven上 方便引用

很感谢这个project,但因为用了desprateNDK 我没法直接集成
希望能丢到maven上 或者jitpack.io这种地方
谢谢

ndk-build x86 not pass

zjh@ubuntu:~/Downloads/AndroidUn7zip-master/AndUn7z/jni$ $ANDROID_NDK/ndk-build
[armeabi] Install : libun7z.so => libs/armeabi/libun7z.so
[armeabi-v7a] Install : libun7z.so => libs/armeabi-v7a/libun7z.so
[x86] Compile : un7z <= CpuArch.c
/home/zjh/Downloads/AndroidUn7zip-master/AndUn7z/jni/un7z//./src/CpuArch.c: In function 'x86cpuid_CheckAndRead':
/home/zjh/Downloads/AndroidUn7zip-master/AndUn7z/jni/un7z//./src/CpuArch.c:75:3: error: inconsistent operand constraints in an 'asm'
asm volatile (
^
/home/zjh/Downloads/AndroidUn7zip-master/AndUn7z/jni/un7z//./src/CpuArch.c:75:3: error: inconsistent operand constraints in an 'asm'
asm volatile (
^
make: *** [/home/zjh/Downloads/AndroidUn7zip-master/AndUn7z/obj/local/x86/objs/un7z/./src/CpuArch.o] Error 1

Cannot extract file that in the Download dir. And the 1.6.0 demo apk cannot parse Download Dir Uri to file path.

I download a 7z file to the sdcard dir and try to extract it, but show me "SZ_ERROR_ARCHIVE" when I pass the file path (/storage/emulated/0/xxxxx/xxxx.7z) but extract as assets successfully. I download the 1.6.0 demo apk and try to extract too, I find It always tell me the path file is null and the code cannot parse file in download dir to file path.
I guess the reason why extract failed is the srcPath parse failed on 1.7.1. Can you check it? @hzy3774

java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.iekie.free.clean-1/base.apk"],nativeLibraryDirectories=[/data/app/com.iekie.free.clean-1/lib/x86, /vendor/lib, /system/lib]]] couldn't find "libun7zip.so"

1. 基本信息:

  • as 版本:3.3.2
  • gradle 版本:3.3.2
  • gradle 插件版本:4.10.1
  • compileSdkVersion:28
  • targetSdkVersion:28
  • un7zip_version:1.5.0

2. 错误信息:

  • 机型:vivo X9
  • 系统版本:6.0.1
  • 错误日志:
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file &quot;/data/app/com.iekie.free.clean-1/base.apk&quot;],nativeLibraryDirectories=[/data/app/com.iekie.free.clean-1/lib/x86, /vendor/lib, /system/lib]]] couldn&#39;t find &quot;libun7zip.so&quot;
	at java.lang.Runtime.loadLibrary(Runtime.java:369)
	at java.lang.System.loadLibrary(System.java:1077)
	at com.hzy.lib7z.Z7Extractor.&lt;clinit&gt;(Unknown Source)
	at org.clean.library.c.a.b(Unknown Source)
	at org.clean.library.c$1.run(Unknown Source)
	at com.iekie.a.a.g.d$a.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
	at java.lang.Thread.run(Thread.java:818)

3. 代码使用:

没有在 build.gradle 文件中过滤 so。

Migrate from JCenter to another maven repository

Are you using JCenter to host the artifact?

Because if I remove jcenter() from repositories gradle block, the library won't be imported:

repositories {
        jcenter() //if I remove this
}

dependencies {
        implementation 'com.hzy:un7zip:1.7.1'
}

JCenter is at end of life. Please migrate if needed.

UnsatisfiedLinkError: dlopen failed: cannot locate symbol "

在某些手机上 (红米 LG 2)上会出现crash

Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "__aeabi_memset" referenced by "/data/app/com.starmakerinteractive.starmaker-1/lib/arm/libun7zip.so"...

Extract from stream on the fly

Hello. Just a suggestion to make possible unzipping while, for example, downloading file. If I have 500mb zipped file on the server and need to place it on the phone in unzipped state (2 gb unzipped file), I wouldn't want to download it first then unzip. It will require 2.5 gb of free storage instead of 2gb.

It would be cool to also unzip file to stream. To make it possible to directly send file to the server or to store it in RAM, without placing it in phone ROM.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.