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

Failed to load app resource table for API 31 resources from com.google.android.material:material #62

Closed ruiperes closed 1 year ago

ruiperes commented 2 years ago

Describe the bug: Failed to load app resource table

App Wrapping Tool Version: 1.0.3610.6 OS Version: Windows 10 Java version: 11 - 64bit Application built using Android.

The Wrapping tool can't copy files in private.

wrapping_log.log

Please Help

GElkayam commented 2 years ago

Running into the same issue.

Application wrapping in progress. App Wrapping Tool Version: 1.0.3610.6
C:\Users\GUY~1.ELK\AppData\Local\Temp\IntuneAppWrappingTool-5765979565311517907\sourceApk\res\values-v31\colors.xml:55: error: resource android:color/Indigo_800 is private.
C:\Users\GUY~1.ELK\AppData\Local\Temp\IntuneAppWrappingTool-5765979565311517907\sourceApk\res\values-v31\colors.xml:56: error: resource android:color/Indigo_700 is private.
C:\Users\GUY~1.ELK\AppData\Local\Temp\IntuneAppWrappingTool-5765979565311517907\sourceApk\res\values-v31\colors.xml:58: error: resource android:color/GM2_grey_800 is private.
C:\Users\GUY~1.ELK\AppData\Local\Temp\IntuneAppWrappingTool-5765979565311517907\sourceApk\res\values-v31\colors.xml:59: error: resource android:color/Blue_800 is private.
C:\Users\GUY~1.ELK\AppData\Local\Temp\IntuneAppWrappingTool-5765979565311517907\sourceApk\res\values-v31\colors.xml:60: error: resource android:color/Blue_700 is private.
GElkayam commented 2 years ago

seems the issue is derived at upstream bug, https://github.com/iBotPeaches/Apktool/issues/2797 and was fixed in version 2.6.1, but the wrapper uses the apktool-lib-2.6.0.jar Tried to manually change it, and the wrapping tool did not run. @codylund is there a plan to update hte dependency and release a new version soon?

Seems explicitly connected to usage of material-components-android. @ruiperes are you using that? which version? I was able to wrap the apk when downgrading dependency version to implementation 'com.google.android.material:material:1.4.0'

meghandaly commented 2 years ago

@GElkayam Can you clarify: "Tried to manually change it, and the wrapping tool did not run." ?

Did you attempt the workaround proposed in [BUG] brut.common.BrutException when building Android 12 app with Material3 color scheme #2761:

"in your colors.xml, replace all @android with @*android"

sagar-sg commented 2 years ago

@GElkayam @meghandaly We are not using Material3 components in our Project It still throws this error. To make things more clear I tried to wrap new plain project with INTUNE SDK Still not Working. Please refer issue #60 for log file and other info.

meghandaly commented 2 years ago

@sagar-sg As @rygo-msft identified, the logs in your issue match the logs contained herein:

WRN C:\Users\sagar\AppData\Local\Temp\IntuneAppWrappingTool-4996429882418164810\sourceApk\res\values-v31\colors.xml:55: error: resource android:color/Indigo_800 is private.
WRN C:\Users\sagar\AppData\Local\Temp\IntuneAppWrappingTool-4996429882418164810\sourceApk\res\values-v31\colors.xml:56: error: resource android:color/Indigo_700 is private.
WRN C:\Users\sagar\AppData\Local\Temp\IntuneAppWrappingTool-4996429882418164810\sourceApk\res\values-v31\colors.xml:58: error: resource android:color/GM2_grey_800 is private.
WRN C:\Users\sagar\AppData\Local\Temp\IntuneAppWrappingTool-4996429882418164810\sourceApk\res\values-v31\colors.xml:59: error: resource android:color/Blue_800 is private.
WRN C:\Users\sagar\AppData\Local\Temp\IntuneAppWrappingTool-4996429882418164810\sourceApk\res\values-v31\colors.xml:60: error: resource android:color/Blue_700 is private.

The plain project appears to include Material3 by default and thus the error is duplicated there.

Can you share whether your app is using any additional Android libraries? Also, have you attempted the workaround above?

sagar-sg commented 2 years ago

@meghandaly We were able to wrap the apk when downgrading dependency version to implementation 'com.google.android.material:material:1.4.0'. Kindly suggest the fix to support latest material version 1.6.0 If you are suggesting the solution to manually replace all @android with @*android" ,then kindly let us know how to modify manually inside generated dependencies.

meghandaly commented 2 years ago

@sagar-sg Happy to hear that workaround is available to y'all.

We are looking into that fix and once we have a timeline we can share we will do so.

ruiperes commented 2 years ago

@sagar-sg i downgrade the materials dependency version to version 1.4.0 and i got the same error.

GElkayam commented 2 years ago

Hi @meghandaly , PSB

@GElkayam Can you clarify: "Tried to manually change it, and the wrapping tool did not run." ?

I tried to change the jar files from 2.6.0 to 2.6.1 that is supposed to have the issue fixed.

Did you attempt the workaround proposed in [BUG] brut.common.BrutException when building Android 12 app with Material3 color scheme #2761:

"in your colors.xml, replace all @android with @*android"

I was unable to change the colors.xml with that, as I had nothing that was pointing to those colors. it was probably added as part of the dependency in that updated materials.

@meghandaly , were you able to reproduce the issue on your end? is there a way I can get a test version with apktool jars of 2.6.1 to see if that solves the issue?

GElkayam commented 2 years ago

@sagar-sg i downgrade the materials dependency version to version 1.4.0 and i got the same error.

exact same error, or something a bit different? if you take the apk you created, and put it into android studio's apk analyzer, do you see a v31 in the color resources?

ruiperes commented 2 years ago

@meghandaly any updates about the next release solving this problem?

ruiperes commented 2 years ago

Any update about this?

bannus commented 2 years ago

We are tracking this internally (#14305778) and this will be fixed in a future release, no ETA to share at this time.

ianbby commented 1 year ago

Hey team, looks like this error is still present in the latest 1.0.3610.6 release. Here's what I'm seeing:

[...]
Copying original files...
SDK information for the application set to {minSdkVersion=23, targetSdkVersion=31}
Checking whether resources has changed...
Building resources...
aapt2 compile command ran:
[C:\Users\A70090~1\AppData\Local\Temp\2\brut_util_Jar_13800338966693114589160338669311294073.tmp, compile, --dir, C:\Users\A70090~1\AppData\Local\Temp\2\IntuneAppWrappingTool-6411306351700991477\sourceApk\res, --legacy, -o, C:\Users\A70090~1\AppData\Local\Temp\2\IntuneAppWrappingTool-6411306351700991477\sourceApk\build\resources.zip]
C:\Users\A70090~1\AppData\Local\Temp\2\IntuneAppWrappingTool-6411306351700991477\sourceApk\res\values-v31\colors.xml:55: error: resource android:color/Indigo_800 is private.
C:\Users\A70090~1\AppData\Local\Temp\2\IntuneAppWrappingTool-6411306351700991477\sourceApk\res\values-v31\colors.xml:56: error: resource android:color/Indigo_700 is private.
C:\Users\A70090~1\AppData\Local\Temp\2\IntuneAppWrappingTool-6411306351700991477\sourceApk\res\values-v31\colors.xml:58: error: resource android:color/GM2_grey_800 is private.
C:\Users\A70090~1\AppData\Local\Temp\2\IntuneAppWrappingTool-6411306351700991477\sourceApk\res\values-v31\colors.xml:59: error: resource android:color/Blue_800 is private.
C:\Users\A70090~1\AppData\Local\Temp\2\IntuneAppWrappingTool-6411306351700991477\sourceApk\res\values-v31\colors.xml:60: error: resource android:color/Blue_700 is private.
error: failed linking references.
Failed to package app.
        com.microsoft.intune.mam.apppackager.utils.AppPackagerException: Failed to load app resource table.
                com.microsoft.intune.mam.apppackager.utils.ResourceUtils.loadResourceTable(ResourceUtils.java:165)
                com.microsoft.intune.mam.apppackager.utils.ResourceUtils.mergeResources(ResourceUtils.java:104)
                com.microsoft.intune.mam.apppackager.WrapperAgent.wrapResources(WrapperAgent.java:184)
                com.microsoft.intune.mam.apppackager.AbstractWrapperAgent.wrap(AbstractWrapperAgent.java:66)
                com.microsoft.intune.mam.apppackager.AppPackager.packageApp(AppPackager.java:85)
                com.microsoft.intune.mam.apppackager.PackagerMain.mainInternal(PackagerMain.java:231)
                com.microsoft.intune.mam.apppackager.PackagerMain.main(PackagerMain.java:58)
        brut.androlib.AndrolibException: brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [C:\Users\A70090~1\AppData\Local\Temp\2\brut_util_Jar_13800338966693114589160338669311294073.tmp, link, -o, C:\Users\A70090~1\AppData\Local\Temp\2\APKTOOL6525058543925378810.tmp, --min-sdk-version, 23, --target-sdk-version, 31, --no-auto-version, --no-version-vectors, --no-version-transitions, --no-resource-deduping, -0, arsc, -I, C:\Users\A70090~1\AppData\Local\Temp\2\IntuneAppWrappingTool-6411306351700991477\framework\1.apk, --manifest, C:\Users\A70090~1\AppData\Local\Temp\2\IntuneAppWrappingTool-6411306351700991477\sourceApk\AndroidManifest.xml, C:\Users\A70090~1\AppData\Local\Temp\2\IntuneAppWrappingTool-6411306351700991477\sourceApk\build\resources.zip]
[...]
Failed to load app resource table.
Verbose logs can be found at: C:\Users\A70090~1\AppData\Local\Temp\2\IntuneAppWrappingToolLog_20230116_063827.txt.
The application could not be wrapped.
meghandaly commented 1 year ago

Latest release with the updated APKTools is live! Release 1.0.3935.1 🥳

GElkayam commented 1 year ago

Thanks @meghandaly , I'll try the new version and report back.

GElkayam commented 1 year ago

Hi @meghandaly , I've tested on both old and new version and now it works as expected. Thank you so much!

Application wrapping in progress. App Wrapping Tool Version: 1.0.3935.1
Using Apktool 2.7.0 on xxxxxxxxxxxxx.apk
.
.
.
The application was successfully wrapped.