Very interesting everyone! I just verified that if I take the output of the 
first attempt to zipalign (which fails), the zipaligned zipaligned file 
worked for me too! It looks like this is a pretty widespread issue that 
thankfully has an easy workaround, and I guess that this will be eliminated 
when the problem is identified and resolved.

To clarify: zipalign your signed APK, and then take that aligned file and 
zipalign it again.

Cheers everyone!

On Friday, 10 June 2016 02:15:15 UTC+10, Fabs wrote:
>
> Hello all.
>
> I have never encountered this issue before, despite developing several 
> apps. When I build a signed production APK using Android Studio, I get an 
> app-release.apk file but it is rejected by Google Play, saying it needs to 
> be zipaligned. When I verify the alignment using zipalign tool, I receive 
> output like this:
>
>  1876394 res/layout/design_bottom_sheet_dialog.xml (OK - compressed)
>  1876935 res/layout/design_layout_snackbar.xml (OK - compressed)
>  1877313 res/layout/design_layout_snackbar_include.xml (OK - compressed)
>  1877936 res/layout/design_layout_tab_icon.xml (OK - compressed)
>  1878215 res/layout/design_layout_tab_text.xml (OK - compressed)
>  1878540 res/layout/design_menu_item_action_area.xml (OK - compressed)
>  1878804 res/layout/design_navigation_item.xml (OK - compressed)
>  1879186 res/layout/design_navigation_item_header.xml (OK - compressed)
>  1879517 res/layout/design_navigation_item_separator.xml (OK - compressed)
>  1879844 res/layout/design_navigation_item_subheader.xml (OK - compressed)
>  1880231 res/layout/design_navigation_menu.xml (OK - compressed)
>  1880609 res/layout/design_navigation_menu_item.xml (OK - compressed)
>  1881116 res/layout/notification_media_action.xml (OK - compressed)
>  1881527 res/layout/notification_media_cancel_action.xml (OK - compressed)
>  1882005 res/layout/notification_template_big_media.xml (OK - compressed)
>  1882747 res/layout/notification_template_big_media_narrow.xml (OK - 
> compressed)
>  1883472 res/layout/notification_template_lines.xml (OK - compressed)
>  1884347 res/layout/notification_template_media.xml (OK - compressed)
>  1884968 res/layout/notification_template_part_chronometer.xml (OK - 
> compressed)
>  1885372 res/layout/notification_template_part_time.xml (OK - compressed)
>  1885772 res/layout/select_dialog_item_material.xml (OK - compressed)
>  1886199 res/layout/select_dialog_multichoice_material.xml (OK - 
> compressed)
>  1886700 res/layout/select_dialog_singlechoice_material.xml (OK - 
> compressed)
>  1887202 res/layout/support_simple_spinner_dropdown_item.xml (OK - 
> compressed)
>  1887559 res/menu/menu_login.xml (OK - compressed)
>  1887906 res/mipmap-hdpi-v4/ic_launcher.png (BAD - 2)
>  1891092 res/mipmap-mdpi-v4/ic_launcher.png (OK)
>  1893113 res/mipmap-xhdpi-v4/ic_launcher.png (BAD - 1)
>  1897545 res/mipmap-xxhdpi-v4/ic_launcher.png (BAD - 1)
>  1904619 res/mipmap-xxxhdpi-v4/ic_launcher.png (BAD - 3)
>  1914156 resources.arsc (OK)
> Verification FAILED
>
> Indeed it is not aligned. But when I try to re-align it, I get this:
>
>  1881710 res/layout/notification_media_action.xml (OK - compressed)
>  1882121 res/layout/notification_media_cancel_action.xml (OK - compressed)
>  1882599 res/layout/notification_template_big_media.xml (OK - compressed)
>  1883341 res/layout/notification_template_big_media_narrow.xml (OK - 
> compressed)
>  1884066 res/layout/notification_template_lines.xml (OK - compressed)
>  1884941 res/layout/notification_template_media.xml (OK - compressed)
>  1885562 res/layout/notification_template_part_chronometer.xml (OK - 
> compressed)
>  1885966 res/layout/notification_template_part_time.xml (OK - compressed)
>  1886366 res/layout/select_dialog_item_material.xml (OK - compressed)
>  1886793 res/layout/select_dialog_multichoice_material.xml (OK - 
> compressed)
>  1887294 res/layout/select_dialog_singlechoice_material.xml (OK - 
> compressed)
>  1887796 res/layout/support_simple_spinner_dropdown_item.xml (OK - 
> compressed)
>  1888153 res/menu/menu_login.xml (OK - compressed)
>  1888500 res/mipmap-hdpi-v4/ic_launcher.png (OK)
>  1891688 res/mipmap-mdpi-v4/ic_launcher.png (OK)
>  1893712 res/mipmap-xhdpi-v4/ic_launcher.png (OK)
>  1898144 res/mipmap-xxhdpi-v4/ic_launcher.png (OK)
>  1905220 res/mipmap-xxxhdpi-v4/ic_launcher.png (OK)
>  1914757 resources.arsc (BAD - 1)
> Verification FAILED
>
> Ultimately, it appears that my APK cannot be aligned by zipalign? I am 
> using these options: -f -v 4 to align and -c -v 4 to verify.
>
> Is this a known issue with zipalign, or have I made some kind of insane 
> error? Cheers.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/186ab83d-b67a-402f-b8e0-45151c0828e9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to