microsoftconnect / intune-app-wrapping-tool-android

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

Can't install wrapped app #44

Closed FAngelvs closed 3 years ago

FAngelvs commented 3 years ago

Hi,

I have ionic/cordova app. Recently switched to ionic 5 / cordova 9 from much older version.

I create an app release version, apply wrapping tool, sign. If I try to install APK directly - I can see this in logs:


2021-02-10 10:19:07.260 5023-5106/? E/PackageInstaller: Commit of session 179850470 failed: Failed to collect certificates from /data/app/vmdl179850470.tmp/PackageInstaller: Attempt to get length of null array
2021-02-10 10:19:08.418 10466-7321/? E/GlideExecutor: Request threw uncaught throwable
    com.bumptech.glide.m: Failed to find any ModelLoaders for model: StructureElementKey{key=/850068c7-90b2-4a04-b9f2-7972c8ada90d/filesync/.../app-release-unsigned-wrapped.apk/1612914284000}
        at com.bumptech.glide.j.c(SourceFile:584)
        at com.bumptech.glide.c.b.k.m(SourceFile:205)
        at com.bumptech.glide.c.b.k.n(SourceFile:223)
        at com.bumptech.glide.c.b.az.a(SourceFile:44)
        at com.bumptech.glide.c.b.l.j(SourceFile:302)
        at com.bumptech.glide.c.b.l.run(SourceFile:1269)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
        at java.lang.Thread.run(Thread.java:764)
        at com.bumptech.glide.c.b.c.c.run(SourceFile:446)
2021-02-10 10:19:08.419 10466-7346/? E/GlideExecutor: Request threw uncaught throwable
    com.bumptech.glide.m: Failed to find any ModelLoaders for model: StructureElementKey{key=/850068c7-90b2-4a04-b9f2-7972c8ada90d/filesync/.../wrapped.apk/1612917597000}
        at com.bumptech.glide.j.c(SourceFile:584)
        at com.bumptech.glide.c.b.k.m(SourceFile:205)
        at com.bumptech.glide.c.b.k.n(SourceFile:223)
        at com.bumptech.glide.c.b.az.a(SourceFile:44)
        at com.bumptech.glide.c.b.l.j(SourceFile:302)
        at com.bumptech.glide.c.b.l.run(SourceFile:1269)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
        at java.lang.Thread.run(Thread.java:764)
        at com.bumptech.glide.c.b.c.c.run(SourceFile:446)
2021-02-10 10:19:11.185 5907-6167/? E/ImsAdaptorImpl: setSSACInfo : ImsAdaptorImpl.
2021-02-10 10:19:11.201 5907-6167/? E/ImsAdaptorImpl: setSSACInfo : ImsAdaptorImpl.

Also tried to install using Company Portal app. It fails to install there too. But there I can see only this in logs: 2021-02-10 10:21:19.612 5023-5106/? E/PackageInstaller: Commit of session 1949276321 failed: Failed to extract native libraries, res=-2 Any ideas what that might be?

Not wrapped, signed release APK installs with no issues. Only thing that I've noticed - with this new ionic / cordova build - it starts failing if I apply zipalign to it.

With regards, Viktor

Nathan187 commented 3 years ago

did you ever find a fix for this?

FAngelvs commented 3 years ago

@Nathan187 Yeap. I just don't zipalign anymore :)

Previous build process was like:

  1. build
  2. sign
  3. zipalign (2 and 3 might be in wrong order, I do not remember how exactly it was)

now it is just:

  1. build
  2. sign.

Looks to be OK now. Not sure if Play Store will accept it, though. We do not use it. But according to my memories - alignment verification shows that everything is OK and APK is aligned even without aligning it.

Nathan187 commented 3 years ago

so, you are not wrapping the app? (thanks for the response)

FAngelvs commented 3 years ago

@Nathan187 Ah. Yeah. Sorry. I forgot about that.

I still wrap it. So, current process is like:

  1. build
  2. wrap
  3. sign
Nathan187 commented 3 years ago

are you using jarsigner? (sorry for the dumb question) i've been struggling with this.

are you having problems if the app requires permissions (i.e. network, internet, location)

FAngelvs commented 3 years ago

Nope, I use build-tools\28.0.3\apksigner:

call "%sdk%\build-tools\28.0.3\apksigner" sign --ks .\[filename].keystore -v --v1-signing-enabled true --v2-signing-enabled true --ks-pass pass:%pwd% ".\platforms\android\app\build\outputs\apk\release\app-release-unsigned-wrapped.apk"

and no issues with permissions

Nathan187 commented 3 years ago

everything i try, just doesn't work. i used the example you provided and it signed. tried to upload it to managed google play....said it wasn't zipaligned. zip aligned it...says APK signature is invalid. never got this crap to work

Nathan187 commented 3 years ago

@FAngelvs I owe you a drink. You helped me get beyond my issue. And for that I am quite thankful!

I was wrapping the apk (using jar signer) with the SigAlg flag...and I shouldn't have done that. I removed that parameter and after wrapping, I signed it with apk signer. That seem to do the trick. (was having problems with zipalign...but it's not necessary, so i skip that step...which i think you are to zipalign before signing)

FAngelvs commented 3 years ago

@Nathan187 Ha! I'm happy this helped you.

But for that zipalign before signing - I recall like this is what you should NOT do. I recall seeing something like that while trying to resolve this issue by myself.

Drzaln commented 2 years ago

Hi @FAngelvs Thanks for your explanation for this problem. However in my case, this is a little bit different. I need to zipalign the apk first before sign it using apksigner, otherwise I can't install it in my phone.