2

We have a rather large (~625 MB) APK file that we are trying to sign for use on Kindle Fire. If we use the basic debug profile the build works just fine. However, when we sign the apk using any keystore (we generated a test, and used our prod keystore), we get the following crash:

    11-19 20:04:12.218: E/szipinf(13794): Error reading asset data
    11-19 20:04:12.218: E/szipinf(13794): Unable to access asset data: -1
    11-19 20:04:12.218: W/dalvikvm(13794): threadid=27: thread exiting with uncaught exception (group=0x41f3eac8)
    11-19 20:04:12.218: E/AndroidRuntime(13794): FATAL EXCEPTION: Thread-23834
    11-19 20:04:12.218: E/AndroidRuntime(13794): java.io.IOException:
    11-19 20:04:12.218: E/AndroidRuntime(13794): at android.content.res.AssetManager.readAsset(Native Method)
    11-19 20:04:12.218: E/AndroidRuntime(13794): at android.content.res.AssetManager.access$700(AssetManager.java:35)
    11-19 20:04:12.218: E/AndroidRuntime(13794): at android.content.res.AssetManager$AssetInputStream.read(AssetManager.java:576)

We've used the exact same signing methods (using jarsigner and then zipAlign) on many other projects and never seen this issue before. The application works perfectly fine before we sign the file but sees this issue 100% of the time post signing.

If anyone had seen similar issues I'd be really interested to know how you solved the problem. I've searched extensively and found nothing that comes close to explaining this behaviour.

  • looks like a compilation error. did you try to clean and rebuild the package? – njzk2 Dec 19 '13 at 20:15
  • do you use libraries ? and do you use eclipse to generate the apk ? – njzk2 Dec 19 '13 at 20:16
  • 1
    The apk compiles just fine and runs when debug signed. When we sign with a production key we get the above crash. – Kevin Stewart Dec 19 '13 at 20:17
  • funny how you appear to be answering my comment, and yet succeed in eluding both questions. – njzk2 Dec 19 '13 at 20:42
  • You edited more content in after I replied. It's not a compilation issue. We've tried to rebuild many times. I'm not actually on the team, but I assume that there are libraries being used. I don't believe that eclipse is generating the apk file as it's part of an automatic build process that I believe is headless. From what I can tell there is nothing wrong with the apk file. We aren't having any problem until AFTER the file is signed using our production signature. – Kevin Stewart Dec 19 '13 at 20:58
  • ok. just making sure. how big is the asset file, and what extension does it uses? – njzk2 Dec 19 '13 at 21:05
  • also, can you post the code you use that causes this exception? – njzk2 Dec 19 '13 at 21:07
  • it's ~625MB and it's a .apk – Kevin Stewart Dec 19 '13 at 21:07
  • I mean the file in the assets, not the apk. – njzk2 Dec 19 '13 at 21:07
  • There's many files, and they range in size. On the large end there is a 40MB .DAT file, but most of the assets are 500kb-5mb. They are using ATITC compression. – Kevin Stewart Dec 19 '13 at 21:11
  • From what I have read about assets, you should start by identifying which specific file is problematic. Then, there are some mentions about using an extension that android won't try to optimize during compilation. – njzk2 Dec 19 '13 at 21:13
  • (but start by identifying the specific file, and try without it. and post that file's extension and size) – njzk2 Dec 19 '13 at 21:13
  • I personally don't have access to the code, and I don't believe I could post it for various NDA reasons either. I'm having trouble seeing where this is going though, because the code itself does actually work as expected as long as the file is signed only with Android Debug. As far as I can tell signing an apk shouldn't be changing the contents of the files that are signed. – Kevin Stewart Dec 19 '13 at 21:15
  • possible duplicate of [IOException while reading from InputStream](http://stackoverflow.com/questions/1273300/ioexception-while-reading-from-inputstream) – njzk2 Dec 19 '13 at 21:17
  • Why would you have a 625MB APK? That's *way* too big. – hichris123 Dec 19 '13 at 21:18
  • this is the thing: you are asking a question because you have an issue, you don't know why it is occurring and you possibly ran out of ideas. I don't know much about your issue, and I ask you information in order to narrow down the issue. Also, I tend to be skeptical toward the questions and the people asking the questions (and I don't really take into consideration where you believe the issue lies). If you are so sure the issue is about signing, I don't know how I can help you. May be if you could post the commands used to sign the apk? – njzk2 Dec 19 '13 at 21:23
  • Also, you can take a look at this apparently similar issue : http://stackoverflow.com/questions/1273300/ioexception-while-reading-from-inputstream – njzk2 Dec 19 '13 at 21:23
  • 1
    It's very large, I agree. I believe that the issue has to do with size. I'll also suggest looking at which specific assets are causing issues and flagging them in a way that they aren't compressed, though this may exacerbate the size issue. – Kevin Stewart Dec 19 '13 at 21:24
  • I don't know if that related issue is actually the solution in this case, because this is only an issue in the signed APK, but I've pointed the interested parties into looking that way and we'll see if it helps. – Kevin Stewart Dec 19 '13 at 21:30

0 Answers0