juicycleff / flutter-unity-view-widget

Embeddable unity game engine view for Flutter. Advance demo here https://github.com/juicycleff/flutter-unity-arkit-demo
BSD 3-Clause "New" or "Revised" License
2.15k stars 525 forks source link

'android.support.v4' that cannot be safely rewritten #707

Closed Dosenbiiir closed 1 year ago

Dosenbiiir commented 2 years ago

Flutter Android Build Error I followed the instructions from the getting started guide. But if i want to build the android app i get the following error message:

Execution failed for task ':app:checkDebugAarMetadata'. Could not resolve all files for configuration ':app:debugRuntimeClasspath'. Failed to transform support-v4-25.1.0-.aar (:support-v4-25.1.0:) to match attributes {artifactType=android-aar-metadata, org.gradle.status=integration}. Execution failed for JetifyTransform: /Users/username/development/my-app/android/unityLibrary/libs/support-v4-25.1.0.aar. Failed to transform '/ Users/username/development/my-app/android/unityLibrary/libs/support-v4-25.1.0.aar' using Jetifier. Reason: AmbiguousStringJetifierException, message: The given artifact contains a string literal with a package reference 'android.support.v4' that cannot be safely rewritten. Libraries using reflection such as annotation processors need to be updated manually to add support for androidx.. (Run with --stacktrace for more details.) This is a known exception, and Jetifier won't be able to jetify this library. Suggestions:

  • If you believe this library doesn't need to be jetified (e.g., if it already supports AndroidX, or if it doesn't use support libraries/AndroidX at all), add android.jetifier.blacklist = {comma-separated list of regular expressions (or simply names) of the libraries that you don't want to be jetified} to the gradle.properties file.
  • If you believe this library needs to be jetified (e.g., if it uses old support libraries and breaks your app if it isn't jetified), contact the library's authors to update this library to support AndroidX and use the supported version once it is released. If you need further help, please leave a comment at https://issuetracker.google.com/issues/140747218.

It seems like the library is using android.support.v4. Can i savely disable the jetifier? Or what is the workaround for this?

Flutter Version: 3.3.7 compileSdkVersion: 33 Unity Version: 2021.3.12

Thanks

timbotimbo commented 2 years ago

Given that it originates from unityLibrary/libs/support-v4-25.1.0.aar, it looks like this is from the Unity export.

Dosenbiiir commented 2 years ago

Thanks for your fast reply. You are absolutely correct. The support-v4 library comes from Mapbox. (The Android build is working in Unity but not in Flutter because it uses AndroidX and Jetifier there)

The error is not related to flutter-unity-view.

Thank you.

Dosenbiiir commented 1 year ago

Just in case someone else is facing the problem. You can manually "jetify" Mapbox as described here: https://github.com/mapbox/mapbox-unity-sdk/issues/1438 But i haven't tried it because i decided to switch over to arcGIS.