googlesamples / unity-jar-resolver

Unity plugin which resolves Android & iOS dependencies and performs version management
Other
1.28k stars 344 forks source link

"androidx.core.app.CoreComponentFactory" colliding with "com.android.support:support-compat:28.0.0" after upgrading Unity to 2019.4.7f1 LTS #395

Closed TalhaCagatay closed 4 years ago

TalhaCagatay commented 4 years ago

Unity editor version: 2019.4.7f1 LTS External Dependency Manager version: 1.2.157 Source you installed EDM (from .unitypackage or Unity Package Manager): .unitypackage Features in External Dependency Manager in use (Android Resolver, iOS Resolver, VersionHandler, etc.): Android Resolver, IOS Resolver Plugins SDK in use (Firebase, Admob, Facebook, etc.): Firebase, Facebook, Mopub Platform you are using the Unity editor on (Mac, Windows, or Linux): Windows Platform you are targeting (iOS, Android, and/or desktop): Android/IOS Scripting Runtime (Mono, and/or IL2CPP): IL2CPP

Can't get build on Android / IOS after upgrading Unity to latest LTS version. While upgrading, unity asked if i want to upgrade database version i clicked yes and when i tried to build for the first time unity said that i need to update my mainTemplate.gradle and i let unity to try automatically updating it.

Attribute application@appComponentFactory value=(androidx.core.app.CoreComponentFactory) from [androidx.core:core:1.1.0] AndroidManifest.xml:24:18-86 is also present at [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91 value=(android.support.v4.app.CoreComponentFactory).

Here is mainTemplate.gradle

// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN

buildscript {
    repositories {
        mavenCentral()
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.0'
**BUILD_SCRIPT_DEPS**}
}

allprojects {
    repositories {
        mavenCentral()
        google()
        jcenter()
        flatDir {
            dirs 'libs'
        }
    }
}

// Android Resolver Repos Start
([rootProject] + (rootProject.subprojects as List)).each {
    ext {
        it.setProperty("android.useAndroidX", true)
        it.setProperty("android.enableJetifier", true)
    }
}
([rootProject] + (rootProject.subprojects as List)).each { project ->
    project.repositories {
        def unityProjectPath = $/file:///**DIR_UNITYPROJECT**/$.replace("\\", "/")
        maven {
            url "https://maven.google.com"
        }
        maven {
            url "https://fyber.bintray.com/marketplace" // Assets/CodaGameSDK/Editor/CodaDependencies.xml:18
        }
        maven {
            url (unityProjectPath + "/Assets/GeneratedLocalRepo/Firebase/m2repository") // Assets/Firebase/Editor/AnalyticsDependencies.xml:18, Assets/Firebase/Editor/AppDependencies.xml:20, Assets/Firebase/Editor/CrashlyticsDependencies.xml:20, Assets/Firebase/Editor/RemoteConfigDependencies.xml:20
        }
        maven {
            url "https://chartboostmobile.bintray.com/Chartboost" // Assets/MoPub/Mediation/Chartboost/Editor/ChartboostDependencies.xml:9
        }
        maven {
            url "https://dl.bintray.com/ironsource-mobile/android-sdk" // Assets/MoPub/Mediation/IronSource/Editor/IronSourceDependencies.xml:9
        }
        maven {
            url "https://tapjoy.bintray.com/maven" // Assets/MoPub/Mediation/Tapjoy/Editor/TapjoyDependencies.xml:9
        }
        maven {
            url "https://jitpack.io" // Assets/MoPub/Mediation/Vungle/Editor/VungleDependencies.xml:9
        }
        mavenLocal()
        jcenter()
        mavenCentral()
    }
}
// Android Resolver Repos End
apply plugin: 'com.android.library'
**APPLY_PLUGINS**

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
// Android Resolver Dependencies Start
    implementation 'androidx.appcompat:appcompat:1.1.0' // Assets/MoPub/Scripts/Editor/MoPubDependencies.xml:4
    implementation 'androidx.legacy:legacy-support-v4:1.0.0' // Assets/MoPub/Scripts/Editor/MoPubDependencies.xml:3
    implementation 'com.android.support:appcompat-v7:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
    implementation 'com.android.support:appcompat-v7:27.1.1' // Assets/GameAnalytics/Editor/GameAnalyticsDependencies.xml:5
    implementation 'com.android.support:cardview-v7:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
    implementation 'com.android.support:customtabs:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
    implementation 'com.android.support:recyclerview-v7:28.0.0' // Assets/CodaGameSDK/Editor/CodaDependencies.xml:11
    implementation 'com.android.support:support-v4:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
    implementation 'com.applovin:applovin-sdk:9.11.6' // Assets/MoPub/Mediation/AppLovin/Editor/AppLovinDependencies.xml:5
    implementation 'com.chartboost:chartboost-sdk:8.0.2' // Assets/MoPub/Mediation/Chartboost/Editor/ChartboostDependencies.xml:9
    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9' // Assets/Firebase/Editor/CrashlyticsDependencies.xml:15
    implementation 'com.facebook.android:audience-network-sdk:5.8.0' // Assets/MoPub/Mediation/FacebookAudienceNetwork/Editor/FacebookAudienceNetworkDependencies.xml:5
    implementation 'com.facebook.android:facebook-applinks:[6.2.0, 7)' // Assets/FacebookSDK/Plugins/Editor/Dependencies.xml:6
    implementation 'com.facebook.android:facebook-core:[6.2.0, 7)' // Assets/FacebookSDK/Plugins/Editor/Dependencies.xml:5
    implementation 'com.facebook.android:facebook-gamingservices:[6.2.0, 7)' // Assets/FacebookSDK/Plugins/Editor/Dependencies.xml:9
    implementation 'com.facebook.android:facebook-login:[6.2.0, 7)' // Assets/FacebookSDK/Plugins/Editor/Dependencies.xml:7
    implementation 'com.facebook.android:facebook-share:[6.2.0, 7)' // Assets/FacebookSDK/Plugins/Editor/Dependencies.xml:8
    implementation 'com.fyber.vamp:core-sdk:7.5.2' // Assets/CodaGameSDK/Editor/CodaDependencies.xml:19
    implementation 'com.fyber.vamp:mopub-custom-events-5.5:7.5.2' // Assets/CodaGameSDK/Editor/CodaDependencies.xml:18
    implementation 'com.fyber.vamp:mraid-kit:7.5.2' // Assets/CodaGameSDK/Editor/CodaDependencies.xml:20
    implementation 'com.fyber.vamp:video-kit:7.5.2' // Assets/CodaGameSDK/Editor/CodaDependencies.xml:21
    implementation 'com.github.vungle:vungle-android-sdk:6.5.3' // Assets/MoPub/Mediation/Vungle/Editor/VungleDependencies.xml:9
    implementation 'com.google.android.gms:play-services-ads:19.0.1' // Assets/MoPub/Mediation/AdMob/Editor/AdMobDependencies.xml:5
    implementation 'com.google.android.gms:play-services-ads-identifier:15.0.1' // Assets/GameAnalytics/Editor/GameAnalyticsDependencies.xml:3
    implementation 'com.google.android.gms:play-services-basement:15.0.1' // Assets/GameAnalytics/Editor/GameAnalyticsDependencies.xml:4
    implementation 'com.google.firebase:firebase-analytics:17.2.2' // Assets/Firebase/Editor/RemoteConfigDependencies.xml:15
    implementation 'com.google.firebase:firebase-analytics-unity:6.13.0' // Assets/Firebase/Editor/AnalyticsDependencies.xml:18
    implementation 'com.google.firebase:firebase-app-unity:6.13.0' // Assets/Firebase/Editor/AppDependencies.xml:20
    implementation 'com.google.firebase:firebase-common:19.3.0' // Assets/Firebase/Editor/AppDependencies.xml:13
    implementation 'com.google.firebase:firebase-config:19.1.1' // Assets/Firebase/Editor/RemoteConfigDependencies.xml:13
    implementation 'com.google.firebase:firebase-config-unity:6.13.0' // Assets/Firebase/Editor/RemoteConfigDependencies.xml:20
    implementation 'com.google.firebase:firebase-crashlytics-unity:6.13.0' // Assets/Firebase/Editor/CrashlyticsDependencies.xml:20
    implementation 'com.ironsource.sdk:mediationsdk:6.15.0.1@jar' // Assets/MoPub/Mediation/IronSource/Editor/IronSourceDependencies.xml:9
    implementation 'com.mintegral.msdk:common:13.0.41' // Assets/MoPub/Mediation/Mintegral/Editor/MintegralDependencies.xml:14
    implementation 'com.mintegral.msdk:interstitial:13.0.41' // Assets/MoPub/Mediation/Mintegral/Editor/MintegralDependencies.xml:6
    implementation 'com.mintegral.msdk:interstitialvideo:13.0.41' // Assets/MoPub/Mediation/Mintegral/Editor/MintegralDependencies.xml:7
    implementation 'com.mintegral.msdk:mtgbanner:13.0.41' // Assets/MoPub/Mediation/Mintegral/Editor/MintegralDependencies.xml:5
    implementation 'com.mintegral.msdk:mtgbid:13.0.41' // Assets/MoPub/Mediation/Mintegral/Editor/MintegralDependencies.xml:16
    implementation 'com.mintegral.msdk:mtgjscommon:13.0.41' // Assets/MoPub/Mediation/Mintegral/Editor/MintegralDependencies.xml:10
    implementation 'com.mintegral.msdk:mtgnative:13.0.41' // Assets/MoPub/Mediation/Mintegral/Editor/MintegralDependencies.xml:15
    implementation 'com.mintegral.msdk:nativeex:13.0.41' // Assets/MoPub/Mediation/Mintegral/Editor/MintegralDependencies.xml:9
    implementation 'com.mintegral.msdk:playercommon:13.0.41' // Assets/MoPub/Mediation/Mintegral/Editor/MintegralDependencies.xml:11
    implementation 'com.mintegral.msdk:reward:13.0.41' // Assets/MoPub/Mediation/Mintegral/Editor/MintegralDependencies.xml:12
    implementation 'com.mintegral.msdk:videocommon:13.0.41' // Assets/MoPub/Mediation/Mintegral/Editor/MintegralDependencies.xml:13
    implementation 'com.mintegral.msdk:videojs:13.0.41' // Assets/MoPub/Mediation/Mintegral/Editor/MintegralDependencies.xml:8
    implementation 'com.mopub.mediation:admob:19.0.1.0' // Assets/MoPub/Mediation/AdMob/Editor/AdMobDependencies.xml:4
    implementation 'com.mopub.mediation:applovin:9.11.6.0' // Assets/MoPub/Mediation/AppLovin/Editor/AppLovinDependencies.xml:4
    implementation 'com.mopub.mediation:chartboost:8.0.2.0' // Assets/MoPub/Mediation/Chartboost/Editor/ChartboostDependencies.xml:4
    implementation 'com.mopub.mediation:facebookaudiencenetwork:5.8.0.0' // Assets/MoPub/Mediation/FacebookAudienceNetwork/Editor/FacebookAudienceNetworkDependencies.xml:4
    implementation 'com.mopub.mediation:ironsource:6.15.0.1.0' // Assets/MoPub/Mediation/IronSource/Editor/IronSourceDependencies.xml:4
    implementation 'com.mopub.mediation:mintegral:13.0.41.0' // Assets/MoPub/Mediation/Mintegral/Editor/MintegralDependencies.xml:4
    implementation 'com.mopub.mediation:tapjoy:12.4.2.0' // Assets/MoPub/Mediation/Tapjoy/Editor/TapjoyDependencies.xml:4
    implementation 'com.mopub.mediation:unityads:3.4.2.0' // Assets/MoPub/Mediation/UnityAds/Editor/UnityAdsDependencies.xml:4
    implementation 'com.mopub.mediation:vungle:6.5.3.0' // Assets/MoPub/Mediation/Vungle/Editor/VungleDependencies.xml:4
    implementation 'com.parse.bolts:bolts-android:1.4.0' // Assets/FacebookSDK/Plugins/Editor/Dependencies.xml:4
    implementation 'com.squareup.picasso:picasso:2.71828' // Assets/CodaGameSDK/Editor/CodaDependencies.xml:10
    implementation 'com.tapjoy:tapjoy-android-sdk:12.4.2' // Assets/MoPub/Mediation/Tapjoy/Editor/TapjoyDependencies.xml:9
    implementation 'com.unity3d.ads:unity-ads:3.4.2' // Assets/MoPub/Mediation/UnityAds/Editor/UnityAdsDependencies.xml:5
    implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.61' // Assets/MoPub/Scripts/Editor/MoPubDependencies.xml:5
// Android Resolver Dependencies End
**DEPS**}

// Android Resolver Exclusions Start
android {
  packagingOptions {
      exclude ('/lib/arm64-v8a/*' + '*')
      exclude ('/lib/armeabi/*' + '*')
      exclude ('/lib/mips/*' + '*')
      exclude ('/lib/mips64/*' + '*')
      exclude ('/lib/x86/*' + '*')
      exclude ('/lib/x86_64/*' + '*')
  }
}
// Android Resolver Exclusions End
android {
    compileSdkVersion **APIVERSION**
    buildToolsVersion '**BUILDTOOLS**'

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
consumerProguardFiles 'proguard-unity.txt'**USER_PROGUARD**
        minSdkVersion **MINSDKVERSION**
        targetSdkVersion **TARGETSDKVERSION**

        ndk {
            abiFilters **ABIFILTERS**
        }
        versionCode **VERSIONCODE**
        versionName '**VERSIONNAME**'
        multiDexEnabled true
    }

    lintOptions {
        abortOnError false
    }

    aaptOptions {
        noCompress = ['.unity3d', '.ress', '.resource', '.obb'**STREAMING_ASSETS**]
    }**SIGN**

    buildTypes {
        debug {
            minifyEnabled **MINIFY_DEBUG**
            useProguard **PROGUARD_DEBUG**
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD**
            jniDebuggable true
        }
        release {
            minifyEnabled **MINIFY_RELEASE**
            useProguard **PROGUARD_RELEASE**
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD****SIGNCONFIG**
        }
    }**PACKAGING_OPTIONS**
**BUILT_APK_LOCATION**

}**REPOSITORIES****SOURCE_BUILD_SETUP**
TalhaCagatay commented 4 years ago

Apperantly this was a bug on unity's side and how i solved it :

Add file in Plugins/Android/gradleTemplate.properties - using unity settings

org.gradle.jvmargs=-XmxJVM_HEAP_SIZEM org.gradle.parallel=true android.useAndroidX=true // this line is new android.enableJetifier=true // // this line is new ADDITIONAL_PROPERTIES

also i changed minSDVersion to 21 which auto enables multiDexing.