Is it possible to add ZIP file to APK package as a raw resource and read it with ZipFile class? It looks like it's trivial to open file from SD card, but not from APK.
Files by Google allows you to extract and view contents of compressed files. Note: Only . zip files are supported.
Download and install Files by Google from the Play Store if it's not available on your device already. Open the app, then navigate to the folder containing your ZIP file (ZIP files have a . ZIP file extension). Tap the ZIP file and select Extract from the pop-up to start the process.
Whether you receive a zip file as an email attachment, or want to extract and view the contents of a zip file from the web, just “Open with WinZip”. Sharing files is safe and simple too, with direct integration with multiple clouds. WinZip makes it easy to handle major compressed types of files on your Android device!
Step 2: Open your android studio go to the app > res > right-click > New > Android Resource Directory as shown in the below image. Step 3: Then a pop-up screen will arise like below. Here in Resource type choose raw.
I don't believe so. As you alluded, it's easy to use ZipFile
with an actual file on the file system, but not so for a file embedded in your application.
For accessing a zip file in your APK, you'd have to use something like Resources.openRawResource(R.raw.zip_file)
and then wrap the returned InputStream
in a ZipInputStream
and do it the usual Java way, rather than with the Android method.
Alternatively, if you really find you need to use the ZipFile
class, you could extract the zip file from the APK to the SD card or, more reliably, to your application's local storage.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With