4

I'm having trouble uploading my .apk to Google Play Store. I've previously been able to upload multiple different builds up to last week, but today I get the error that I should zipalign my file first.

EDIT: Normally, I was able to generate signed and zipaligned .apk's that the AppStore accepted by just using Android Studios built-in "Generate Signed APK" wizard. This did not work today, and led to the following:

I've tried the following:

  • Manual zipalign of the app-release.apk generated by Android studio. When I try this, I get the error "VERIFICATION FAILED" at the end. Some googling says that providing full path to a location where you have write-access is important, so I've tried doing it with the specific path, but to no avail:

    ./zipalign -v -f 4 /Users/<username>/git/<projectname>/app/app-release.apk /Users/<username>/git/<projectname>/app/aligned.apk

  • I then tried to download the APK Signer 1.8.5 and use that to zipalign the .apk - and behold, success! It creates an aligned apk, and i'm able to verify it using both Android Studio's own zipalign tool by

    ./zipalign -c -v 4 app-release_ALIGNED.apk

    and the APK Signer itself. However, when uploading I now get the error:

    Failed to run aapt dump badging: W/ResourceType(208730): Bad resource table: header size 0x80a3 or total size 0x80b50000 is larger than data size 0x7bcc4 ERROR: dump failed because the resource table is invalid/corrupt.

    This, I haven't been able to find solutions for.

  • I then tried to recreate the circumstances I was previously able to upload APKs from by reverting to a previous commit/build, as well as reverting from AS 2.2 preview 3 to AS2.2 preview 2, but again - no luck.

  • Finally, I tried explicitly adding

    zipAlignEnabled true

    to my release config in Gradle, but that didn't help either.

I'm out of suggestions, and hoping someone can help? :-) Thanks

4

2 回答 2

4

最后,尤里卡!

我在根 build.gradle 中偶然发现了这一行:

classpath 'com.android.tools.build:gradle:2.2.0-alpha3'

Android Studio 2.2 preview 3 需要升级这个 gradle 构建工具,而我像往常一样按下了“确定,继续”。我很好奇,并试图将其改回上次有效的方式,

classpath 'com.android.tools.build:gradle:2.2.0-alpha2'

而是在 Android Studio 预览版 2 中构建项目 - 瞧,它成功了!似乎 alpha3 版本存在错误。

我希望这可以帮助别人。我知道我是一个快乐的星期五露营者,这是肯定的!:-)

自我注意:无论我的朋友和同事如何推动,将来不要依赖金丝雀构建来生产应用程序。

于 2016-06-10T12:46:55.080 回答
3

以下是我几天前遇到的事情: 一次尝试一个:

  • 在下载了在 IO 会议期间发布的 Android Studio 2.2 Preview 2 之后,我成功地运行了我的代码,直到时候将更新版本的 apk 发布到 playstore。那是地狱爆发的时候!
  • 我到处找,但什么也没有。因此,有人建议以下方法:生成签名的apk后,将其解压缩并删除META-INF文件夹,然后重新打包并通过终端手动签名。将文件打包成.apk格式很简单:只需使用 zip 扩展名,然后重命名扩展名。
  • 尽管这似乎对我有用,但事实并非如此。不过,它对其他人有用。
  • 最后,我意识到这是由最新的 Android Studio Preview 2 中的一个错误引起的。
  • 谢天谢地,我仍然有我打开的稳定的 2.1 版本,加载了我的项目和 Boom!它像我预期的那样工作。

所以,请尝试最后一个选项,先清理您的项目,然后再试一次。我知道这有多令人沮丧。祝你好运!

于 2016-06-10T12:04:10.453 回答