I have a 20 MB database stored in apk assets, which are first retrieved for use. For this I use
PackageManager pm = context.getPackageManager(); String apkFile = pm.getApplicationInfo(context.getPackageName(), 0).sourceDir; ZipFile zipFile = new ZipFile(apkFile); ZipEntry entry = zipFile.getEntry("assets/FILENAME"); myInput = zipFile.getInputStream(entry); myOutput = new FileOutputStream(file); byte[] buffer = new byte[1024*4]; int length; int total = 0; int counter = 1; while ((length = myInput.read(buffer)) > 0) { total += length; counter++; if (counter % 32 == 0) { publishProgress(total); } myOutput.write(buffer, 0, length); }
Everything works fine when I export from eclipse (target of Android 2.2) without using proguard. When I export using proguard, unzip starts to work for several seconds (and several progress updates, up to 8%), but then fails with java.io.IOException in java.util.zip.InflaterInputStream.read (..)
It works on an emulator, but crashes on devices (many devices, but I think it always works on Android 4, crashing on Android 2.2). My proguard.cfg is basically the default. Nothing I tried to change seems to help, any ideas?
wordy
source share