Decompress Rar file in Android

可紊 提交于 2019-12-03 08:09:34

I just realized this with jUnrar from here https://github.com/edmund-wagner/junrar

Create a new package within your Android src directory called com.github.junrar You should delete com.github.junrar.vfs2 because it has some dependencies and you probably won't use it anyway.

You will probably get some errors about the logger class. You can either remove the few logging lines or like i did write a tiny wrapper which communicates with android.util.Log. I did that and changed the includes.

If you finished importing the code take a look at jUnrars testutils. I used this and it worked out of the box:

https://github.com/edmund-wagner/junrar/blob/master/testutil/src/main/java/com/github/junrar/testutil/ExtractArchive.java

Hope it helps

jjlin

RAR isn't very commonly used (except in certain niches), so you won't find support for it built into the Android libraries. Probably the easiest thing to do is to get a Java library that handles RAR files, as covered in this question:

RAR archives with java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!