Search Unity

Resolved The build does not work due to a gradle problem. Could it be related to mediation?

Discussion in 'Unity Mediation' started by skfldao, May 10, 2022.

  1. skfldao

    skfldao

    Joined:
    Jul 28, 2019
    Posts:
    18
    The build does not work due to a gradle problem. Could it be related to mediation?
    On the console

    Required by:
    project :unityLibrary > com.unity3d.mediation:mediation-sdk:0.4.1


    I have attached the console error content as a txt file.
    If you need other materials, please let me know.
     

    Attached Files:

  2. AnwarissaAsbah

    AnwarissaAsbah

    Unity Technologies

    Joined:
    Jul 28, 2021
    Posts:
    1
    Hey skfIdao,

    can you please verify that your importing
    com.unity3d.mediation:mediation-sdk:0.4.+ too.

    Looking at the txt file you shared, gradle is complaining about this
    com.google.android.gmsplay-services-basement:17.+
    which was excluded from all adapters and included in the mediation-sdk library.

    Are you using mainTemplate.gradle
    If so, can you share it?
     
  3. skfldao

    skfldao

    Joined:
    Jul 28, 2019
    Posts:
    18
    I confirmed it was a firebase issue!
    Added
    <application android:allowNativeHeapPointerTagging="false" ... />
    to analyze Unity Crash in firebase 8.9.0. After erasing this line and deleting mainTemplate.gradle, I built it and it worked!
    However, it has been 3 weeks since I added it and the problem occurred.
    I am attaching mainTemplate.gradle, which I deleted because I was wondering if there are any other problems. Let me know if you have any other issues :)

    Code (CSharp):
    1. // GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN
    2.  
    3. // Android Resolver Repos Start
    4. ([rootProject] + (rootProject.subprojects as List)).each { project ->
    5.     project.repositories {
    6.         def unityProjectPath = $/file:///**DIR_UNITYPROJECT**/$.replace("\\", "/")
    7.         maven {
    8.             url "https://maven.google.com"
    9.         }
    10.         maven {
    11.             url "https://unity3ddist.jfrog.io/artifactory/unity-mediation-mvn-prod-local/" // Assets/Editor/MediationAdapterDependencies.xml:6
    12.         }
    13.         maven {
    14.             url (unityProjectPath + "/Assets/GeneratedLocalRepo/Firebase/m2repository") // Assets/FireBase/Editor/AnalyticsDependencies.xml:18, Assets/FireBase/Editor/AppDependencies.xml:22, Assets/FireBase/Editor/CrashlyticsDependencies.xml:20
    15.         }
    16.         maven {
    17.             url (unityProjectPath + "/Assets/GeneratedLocalRepo/GooglePlayGames/Editor/m2repository") // Assets/GooglePlayGames/Editor/GooglePlayGamesPluginDependencies.xml:11
    18.         }
    19.         mavenLocal()
    20.         mavenCentral()
    21.     }
    22. }
    23. // Android Resolver Repos End
    24. apply plugin: 'com.android.library'
    25. **APPLY_PLUGINS**
    26.  
    27. dependencies {
    28.     implementation fileTree(dir: 'libs', include: ['*.jar'])
    29.     implementation "org.jetbrains.kotlin:kotlin-stdlib:1.3.72" // Kotlin
    30.     implementation "androidx.viewpager2:viewpager2:1.0.0"
    31.     implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
    32.     implementation "com.github.bumptech.glide:glide:3.7.0" // Glide
    33.     implementation "com.squareup.retrofit2:retrofit:2.7.2" // Retrofit, Gson
    34.     implementation "com.squareup.retrofit2:converter-gson:2.7.2" // Retrofit, Gson
    35. // Android Resolver Dependencies Start
    36.     implementation 'com.google.android.gms:play-services-base:18.0.1' // Assets/FireBase/Editor/AppDependencies.xml:17
    37.     implementation 'com.google.firebase:firebase-analytics:20.1.2' // Assets/FireBase/Editor/CrashlyticsDependencies.xml:15
    38.     implementation 'com.google.firebase:firebase-analytics-unity:8.9.0' // Assets/FireBase/Editor/AnalyticsDependencies.xml:18
    39.     implementation 'com.google.firebase:firebase-app-unity:8.9.0' // Assets/FireBase/Editor/AppDependencies.xml:22
    40.     implementation 'com.google.firebase:firebase-common:20.1.0' // Assets/FireBase/Editor/AppDependencies.xml:13
    41.     implementation 'com.google.firebase:firebase-crashlytics-ndk:18.2.9' // Assets/FireBase/Editor/CrashlyticsDependencies.xml:13
    42.     implementation 'com.google.firebase:firebase-crashlytics-unity:8.9.0' // Assets/FireBase/Editor/CrashlyticsDependencies.xml:20
    43.     implementation 'com.google.games:gpgs-plugin-support:0.10.12' // Assets/GooglePlayGames/Editor/GooglePlayGamesPluginDependencies.xml:11
    44.     implementation 'com.unity3d.mediation:adcolony-adapter:[0.4,0.5[' // Assets/Editor/MediationAdapterDependencies.xml:10
    45.     implementation 'com.unity3d.mediation:admob-adapter:[0.4,0.5[' // Assets/Editor/MediationAdapterDependencies.xml:11
    46.     implementation 'com.unity3d.mediation:applovin-adapter:[0.4,0.5[' // Assets/Editor/MediationAdapterDependencies.xml:12
    47.     implementation 'com.unity3d.mediation:facebook-adapter:[0.4,0.5[' // Assets/Editor/MediationAdapterDependencies.xml:13
    48.     implementation 'com.unity3d.mediation:ironsource-adapter:[0.4,0.5[' // Assets/Editor/MediationAdapterDependencies.xml:14
    49.     implementation 'com.unity3d.mediation:mediation-sdk:[0.4,0.5[' // Assets/Editor/MediationAdapterDependencies.xml:8
    50.     implementation 'com.unity3d.mediation:unityads-adapter:[0.4,0.5[' // Assets/Editor/MediationAdapterDependencies.xml:15
    51.     implementation 'com.unity3d.mediation:vungle-adapter:[0.4,0.5[' // Assets/Editor/MediationAdapterDependencies.xml:16
    52. // Android Resolver Dependencies End
    53. **DEPS**}
    54.  
    55. // Android Resolver Exclusions Start
    56. android {
    57.   packagingOptions {
    58.       exclude ('/lib/armeabi/*' + '*')
    59.       exclude ('/lib/mips/*' + '*')
    60.       exclude ('/lib/mips64/*' + '*')
    61.       exclude ('/lib/x86/*' + '*')
    62.       exclude ('/lib/x86_64/*' + '*')
    63.   }
    64. }
    65. // Android Resolver Exclusions End
    66. android {
    67.     compileSdkVersion **APIVERSION**
    68.     buildToolsVersion '**BUILDTOOLS**'
    69.  
    70.     compileOptions {
    71.         sourceCompatibility JavaVersion.VERSION_1_8
    72.         targetCompatibility JavaVersion.VERSION_1_8
    73.     }
    74.  
    75.     defaultConfig {
    76.         minSdkVersion **MINSDKVERSION**
    77.         targetSdkVersion **TARGETSDKVERSION**
    78.         ndk {
    79.             abiFilters **ABIFILTERS**
    80.         }
    81.         versionCode **VERSIONCODE**
    82.         versionName '**VERSIONNAME**'
    83.         consumerProguardFiles 'proguard-unity.txt'**USER_PROGUARD**
    84.     }
    85.  
    86.     lintOptions {
    87.         abortOnError false
    88.     }
    89.  
    90.     aaptOptions {
    91.         ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~"
    92.     }**PACKAGING_OPTIONS**
    93. }**REPOSITORIES****SOURCE_BUILD_SETUP**
    94. **EXTERNAL_SOURCES**
    95.  
     
    DeclanMcPartlin likes this.
  4. skfldao

    skfldao

    Joined:
    Jul 28, 2019
    Posts:
    18
    I found the cause of the problem :)
    There was a problem with Firebase.
    I found an release note that said this problem was fixed in Firebase 8.10.1.
    After updating to the latest version 9.2.0, adding mainTamplate.gradle builds without any problem!
     
    DeclanMcPartlin likes this.
  5. mbhagat

    mbhagat

    Joined:
    Dec 15, 2013
    Posts:
    49
    First I removed all present gradle files.
    Then using project settings -player settings-> select checkbox build custom gradle file.
    Then I resolved library using force resolved.
    Then I enable custom property gradle where for my case I needed to enable androidx (this step might be optional based on error)
    And it worked.
     
    Auriga and DeclanMcPartlin like this.