microsoftconnect / intune-app-wrapping-tool-android

Use the Intune App Wrapping Tool for Android to enable Android apps to be managed by Microsoft Intune
28 stars 11 forks source link

Wrapped apk is not zip aligned #69

Closed mi0o closed 1 year ago

mi0o commented 1 year ago

Hello After uploading the wrapperd apk to portal it gaves me this notice : the file is not zip aligned. image

My steps>

1) Build cordova aab file 2) Convert abb to apk with bundletool

java -jar bundletool-all-1.11.0.jar build-apks --bundle=app-release.aab --output=my_app.apks --overwrite --mode=universal --ks=prodapp.keystore --ks-pass=pass:XXX --ks-key-alias=prodapp --key-pass=pass:XXX

3) Wrap apk with intune powershell tool invoke-AppWrappingTool -InputPath .\universal.apk -OutputPath .\app_wrapped\universal_wrapped.apk -Verbose

4) Then force zipalign with this command (i tried to skip this steps also) .\zipalign.exe -f -v 4 .\universal_wrapped.apk universal_wrapped-z.apk

5) Sign apk again jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore prodapp.keystore universal_wrapped-z.apk prodapp

everything finished successfully. but unable to upload APK.

If I skip Wrapping tool it works. but I want to use MEM Policies.

Thanks

rygo-msft commented 1 year ago

Hi @mi0o, the App Wrapping Tool shouldn't do anything that would impact the apps ability to zipalign.

I have seen issues with zipalign in the past (unrelated to App Wrapper) where you need to run zipalign multiple times to align the apk properly. As far as I understand, this is an Android Toolchain bug.

Per the android docs for zipalign, if you use jarsigner for signing, zipalign must be run after signing. https://developer.android.com/studio/command-line/zipalign

You may want to consider using apksigner as it is the newer preferred android tool https://developer.android.com/studio/command-line/apksigner