I am trying to unzip a zipfile with password protection. I know there is a java library named \"zip4j\" that could help me. But I am failing to open the zip4j website to see
Here we have a file game.zip in Downloads folder in android phone and we are extracting it with the password given below:
String unzipFileAddress = Environment.DIRECTORY_DOWNLOADS "/Game.zip";
String filePassword = "2222"; // password of the file
String destinationAddress = Environment.DIRECTORY_DOWNLOADS + "/Game";
ZipFile zipFile = new ZipFile(unzipFileAddress, filePassword.toCharArray());
try {
zipFile.extractAll(destinationAddress);
} catch (Exception e) {
// if crashes print the message or Toast
}
Add in dependencies in build Gradle (app level) before doing it
dependencies{
implementation 'net.lingala.zip4j:zip4j:2.6.4'
} // for lastest version check the link below
Make sure you have storage permission, these silly mistakes can take your valuable time
// Add in AndroidManifest.xml
Make sure your zip file is not a corrupt file by extracting it manually.
If you want to do some complex work with compression, you should take help from here: https://github.com/srikanth-lingala/zip4j