BranchMetrics / unity-branch-deep-linking-attribution

The Branch Unity SDK for deep linking and attribution. Branch helps mobile apps grow with deep links / deeplinks that power paid acquisition and re-engagement campaigns, referral programs, content sharing, deep linked emails, smart banners, custom user onboarding, and more.
https://docs.branch.io/apps/unity/
MIT License
118 stars 24 forks source link

Execution failed for task ':launcher:checkReleaseDuplicateClasses'. #204

Open FrankdenUijl opened 2 years ago

FrankdenUijl commented 2 years ago

After I import branch.io I get the following Execution during a build for Android. Seems like there is a conflict between packages inside my project. Any idea how to fix this issue?

Unity: 2021.3.8f1 Branch SDK: 0.6.7

image

Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':launcher:checkReleaseDuplicateClasses'.
> 1 exception was raised by workers:
  java.lang.RuntimeException: Duplicate class a.a.a found in modules arcore_client-runtime.jar (:arcore_client:) and installreferrer-2.2-runtime.jar (com.android.installreferrer:installreferrer:2.2)
  Duplicate class android.support.v4.app.INotificationSideChannel found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class android.support.v4.app.INotificationSideChannel$Stub found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class android.support.v4.app.INotificationSideChannel$Stub$Proxy found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class android.support.v4.graphics.drawable.IconCompatParcelizer found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class android.support.v4.os.IResultReceiver found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class android.support.v4.os.IResultReceiver$Stub found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class android.support.v4.os.IResultReceiver$Stub$Proxy found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class android.support.v4.os.ResultReceiver found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class android.support.v4.os.ResultReceiver$1 found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class android.support.v4.os.ResultReceiver$MyResultReceiver found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class android.support.v4.os.ResultReceiver$MyRunnable found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.accessibilityservice.AccessibilityServiceInfoCompat found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.ActivityCompat found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.ActivityCompat$1 found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.ActivityCompat$OnRequestPermissionsResultCallback found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.ActivityCompat$PermissionCompatDelegate found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.ActivityCompat$RequestPermissionsRequestCodeValidator found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.ActivityCompat$SharedElementCallback21Impl found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.ActivityCompat$SharedElementCallback21Impl$1 found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.ActivityManagerCompat found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.ActivityOptionsCompat found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.ActivityOptionsCompat$ActivityOptionsCompatImpl found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.AlarmManagerCompat found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.AppComponentFactory found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.AppLaunchChecker found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.AppOpsManagerCompat found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.BundleCompat found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.BundleCompat$BundleCompatBaseImpl found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.ComponentActivity found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.ComponentActivity$ExtraData found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.CoreComponentFactory found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.CoreComponentFactory$CompatWrapped found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.FrameMetricsAggregator found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.FrameMetricsAggregator$FrameMetricsApi24Impl found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.FrameMetricsAggregator$FrameMetricsApi24Impl$1 found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.FrameMetricsAggregator$FrameMetricsBaseImpl found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.FrameMetricsAggregator$MetricType found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.JobIntentService found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.JobIntentService$CommandProcessor found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.JobIntentService$CompatJobEngine found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.JobIntentService$CompatWorkEnqueuer found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.JobIntentService$CompatWorkItem found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.JobIntentService$GenericWorkItem found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.JobIntentService$JobServiceEngineImpl found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.JobIntentService$JobServiceEngineImpl$WrapperWorkItem found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.JobIntentService$JobWorkEnqueuer found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.JobIntentService$WorkEnqueuer found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.NavUtils found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.NotificationBuilderWithBuilderAccessor found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.NotificationCompat found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.NotificationCompat$Action found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.NotificationCompat$Action$Builder found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.NotificationCompat$Action$Extender found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.NotificationCompat$Action$SemanticAction found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.NotificationCompat$Action$WearableExtender found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.NotificationCompat$BadgeIconType found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.NotificationCompat$BigPictureStyle found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.NotificationCompat$BigTextStyle found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.NotificationCompat$Builder found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.NotificationCompat$CarExtender found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.NotificationCompat$CarExtender$UnreadConversation found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.NotificationCompat$CarExtender$UnreadConversation$Builder found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.NotificationCompat$DecoratedCustomViewStyle found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.NotificationCompat$Extender found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.NotificationCompat$GroupAlertBehavior found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.NotificationCompat$InboxStyle found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.NotificationCompat$MessagingStyle found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.NotificationCompat$MessagingStyle$Message found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.NotificationCompat$NotificationVisibility found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.NotificationCompat$StreamType found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.NotificationCompat$Style found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplicate class androidx.core.app.NotificationCompat$WearableExtender found in modules androidx.core.core-1.0.0-runtime.jar (:androidx.core.core-1.0.0:) and androidx.core.core-1.0.0-runtime.jar (androidx.core:core:1.0.0)
  Duplica<message truncated>
FrankdenUijl commented 2 years ago

I have remove the duplicated androidx.core.core-1.0.0-runtime package.

Still have 1 issue:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':launcher:checkReleaseDuplicateClasses'.
> 1 exception was raised by workers:
  java.lang.RuntimeException: java.lang.RuntimeException: Duplicate class a.a.a found in modules jetified-arcore_client-runtime.jar (:arcore_client:) and jetified-installreferrer-2.2-runtime.jar (com.android.installreferrer:installreferrer:2.2)

  Go to the documentation to learn how to Fix dependency resolution errors.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8

Excluded the "com.android.installreferrer" module "installreferrer" via the main template.gradle. This did work and was able to create an .apk.

// Android Resolver Exclusions End
android {
    ...

    defaultConfig {
        ...
    }

    lintOptions {
      ..
    }

    aaptOptions {
        ..
    }

    compileOptions {
        ...
    }

    buildTypes {
        ...
    }
    configurations {
        all {
            exclude group: "com.android.installreferrer", module: "installreferrer"
        }
    }
....
}

But Branch.initSession(HandleBranchCallback); is never called. Is this because I excluded the com.android.installreferrer ? Also I dont think that excluding com.android.installreferrer is the best way to do this?

What is the best way to fix my issue?

klim-branch commented 1 year ago

Hi @FrankdenUijl

Sorry for super late reply on this thread! This is Kun from the Branch integration team.

Could you please show me how you have implemented Branch on your game? Ex) Event system, init session.. etc Also let me know if you are using your custom gradle file instead of the one that provided by Branch.

Thanks! Kun