microsoftconnect / ms-intune-app-sdk-android

Intune App SDK for Android enables data protection features and mobile app management via Microsoft Intune
41 stars 17 forks source link

Build failure after upgrade grade 8 #186

Closed Satoshi-Sakamoto147 closed 3 months ago

Satoshi-Sakamoto147 commented 9 months ago

Intune Android App SDK [Gradle Build Plugin] Issue

Questions to Ask Before Submission

  1. Does your app compile and launch successfully without the Intune App SDK? Yes

  2. Have you checked the [Microsoft Intune App SDK for Android] repository for similar issues? Yes. It's similar to the ticket below, but it wasn't reopened, so I created a new ticket. https://github.com/msintuneappsdk/ms-intune-app-sdk-android/issues/171

  3. Are you using the latest version of the [SDK and Plugin]? Yes

Summary

Please briefly describe the issue you are experiencing.

Details

Logs

  1. Gradle build logs

Zip file 'C:\workspace\app\build\intermediates\classes\devHogeHogeDebug\ALL\devHogeHogeDebugMamifyClasses\classes.jar' already contains entry 'org/opencv/BuildConfig.class', cannot overwrite

  1. Since the log of our product code cannot be published, I customized Taskr-Sample-Intune-Android-App and output the log. patch file: intune_gradle8.patch

Build file 'C:\workspace\Taskr-Sample-Intune-Android-App\app\build.gradle' line: 12

A problem occurred evaluating project ':app'.
> Failed to apply plugin 'com.microsoft.intune.mam'.
   > Gradle 8 is not yet supported. Please use the -preview version of the plugin.
ostannar commented 9 months ago

I have the same failure with an other class file and no solution this problem.

meghandaly commented 8 months ago

@Satoshi-Sakamoto147 Was your app previously integrated with the MAM SDK and then began failing when updated? Or is this a brand-new integration?

For future, please add a summary of the issue in the location provided by the template.

ostannar commented 8 months ago

I have the same error as @Satoshi-Sakamoto147 . For me, the MAM SDK was already included before I wanted to perform the grade update.

meghandaly commented 8 months ago

@ostannar Included and properly integrated? Was this a Gradle only update or an SDK + Gradle update? Can you share your logs as well?

Satoshi-Sakamoto147 commented 8 months ago

Since the log of our product code cannot be published, I customized Taskr-Sample-Intune-Android-App and output the log. patch file: intune_gradle8.patch

Log:

Build file 'C:\workspace\Taskr-Sample-Intune-Android-App\app\build.gradle' line: 12

A problem occurred evaluating project ':app'.
> Failed to apply plugin 'com.microsoft.intune.mam'.
   > Gradle 8 is not yet supported. Please use the -preview version of the plugin.

Although it is different from the error in my environment, does this mean that ms-intune-app-sdk does not support gradle8 yet?

ostannar commented 8 months ago

@meghandaly It was a Gradle and SDK update. In the meantime I took back the Gradle update and left the SDK with version 9.7.0. That runs so far without problems.

But I would also like to update to Gradle 8. I get the same error message as @Satoshi-Sakamoto147 Show issue #171

How can this be solved?

ostannar commented 8 months ago

I have the same error also with version 10.0.0 of Gradle plugin.

Can someone tell me how to solve the problem?

meghandaly commented 5 months ago

@Satoshi-Sakamoto147 and @ostannar

Can you please update your version of Javassist to 3.29.2? We missed a documentation update (updates currently pending doc team approval) that specified this as a dependency for the MAM SDK ≥ 10.0.0.

Satoshi-Sakamoto147 commented 5 months ago

@meghandaly I tried updating Javassist to 3.29.2,(or latest version 3.30.2) but the result remained the same.

  1. I get code from git@github.com:msintuneappsdk/Taskr-Sample-Intune-Android-App.git master branch.
  2. Apply this patch intune_example_update_gradle8.patch
bannus commented 4 months ago

Hi all, the Sample app repo is currently consuming MAM SDK 9.5.0, which needs to use the preview version of the MAM plugin to work with AGP 8+. We will work to get this updated, but I can confirm that this works locally and does not reproduce the original issue reported ("Zip file already contains entry"). We will still need Gradle logs and the Build Plugin Report Logs to investigate this issue.

Satoshi-Sakamoto147 commented 3 months ago

@bannus cc: @ostannar @meghandaly @oydang Thank you for your information. I was able to build with Gradle 8 and launch Taskr-Sample-Intune-Android-App.

  1. download https://github.com/msintuneappsdk/Taskr-Sample-Intune-Android-App latest version(c11ee86771f7dbc537b2e19e88eaed77ae06b4f0)
  2. Start Android Studio
  3. Apply 20240329_upgrade_to_gradle_8.patch ( include Microsoft.Intune.MAM.SDK.aar and com.microsoft.intune.mam.build.jar(from ms-intune-app-sdk-android-10.0.0) replacement)
  4. Click SyncNow(or Try Again) in gradle file
  5. rebuild
My Development Environment Android Studio AGP Gradle Version
Iguana 2023.2.1 8.3.1 8.4