A Bug in Admob Facebook Mediation

1,329 views
Skip to first unread message

Y B

unread,
Jul 20, 2019, 6:00:51 PM7/20/19
to google-adm...@googlegroups.com
While looking in other posts in this forum, I can see that I'm not alone here,
The latest GoogleMobileAdsFacebookMediation will cause build errors in unity.

Steps to reproduce:
1. import Firebase Database
2. import Facebook SDK
3. import Admob SDK
4. import Audience Network SDK
5. import GoogleMobileAdsFacebookMediation

Will cause a build error that I'm not able to solve for days: 

CommandInvokationFailure: Gradle build failed. 
C:\Program Files\Unity\Hub\Editor\2019.1.0f2\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\OpenJDK\Windows\bin\java.exe -classpath "C:\Program Files\Unity\Hub\Editor\2019.1.0f2\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.6.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"

stderr[

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':transformClassesWithMultidexlistForRelease'.
> com.android.build.api.transform.TransformException: Error while generating the main dex list.

* 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 15s
]
stdout[
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2019.1.0f2\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\build-tools\28.0.3\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2019.1.0f2\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platform-tools\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2019.1.0f2\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-28\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2019.1.0f2\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\package.xml. Probably the SDK is read-only
:checkReleaseClasspath
:preBuild UP-TO-DATE
:EMNotificationResources:preBuild UP-TO-DATE
:EMNotificationResources:preReleaseBuild UP-TO-DATE
:EMNotificationResources:checkReleaseManifest
:EMNotificationResources:processReleaseManifest
:Firebase:preBuild UP-TO-DATE
:Firebase:preReleaseBuild UP-TO-DATE
:Firebase:checkReleaseManifest
:Firebase:processReleaseManifest
:GoogleMobileAdsPlugin:preBuild UP-TO-DATE
:GoogleMobileAdsPlugin:preReleaseBuild UP-TO-DATE
:GoogleMobileAdsPlugin:checkReleaseManifest
:GoogleMobileAdsPlugin:processReleaseManifest
:preReleaseBuild
:EMNotificationResources:compileReleaseAidl NO-SOURCE
:Firebase:compileReleaseAidl NO-SOURCE
:GoogleMobileAdsPlugin:compileReleaseAidl NO-SOURCE
:compileReleaseAidl NO-SOURCE
:EMNotificationResources:packageReleaseRenderscript NO-SOURCE
:Firebase:packageReleaseRenderscript NO-SOURCE
:GoogleMobileAdsPlugin:packageReleaseRenderscript NO-SOURCE
:compileReleaseRenderscript
:checkReleaseManifest UP-TO-DATE
:generateReleaseBuildConfig UP-TO-DATE
:prepareLintJar UP-TO-DATE
:mainApkListPersistenceRelease UP-TO-DATE
:generateReleaseResValues UP-TO-DATE
:generateReleaseResources
:EMNotificationResources:compileReleaseRenderscript
:EMNotificationResources:generateReleaseResValues
:EMNotificationResources:generateReleaseResources
:EMNotificationResources:packageReleaseResources
:Firebase:compileReleaseRenderscript
:Firebase:generateReleaseResValues
:Firebase:generateReleaseResources
:Firebase:packageReleaseResources
:GoogleMobileAdsPlugin:compileReleaseRenderscript
:GoogleMobileAdsPlugin:generateReleaseResValues
:GoogleMobileAdsPlugin:generateReleaseResources
:GoogleMobileAdsPlugin:packageReleaseResources
:mergeReleaseResources
:createReleaseCompatibleScreenManifests UP-TO-DATE
:processReleaseManifest
C:\Unity SSD\Words - Copy\Temp\gradleOut\src\main\AndroidManifest.xml:24:9-31:50 Warning:
activity#com.google.firebase.auth.internal.FederatedSignInActivity@android:launchMode was tagged at AndroidManifest.xml:24 to replace other declarations but no other declaration present
:splitsDiscoveryTaskRelease UP-TO-DATE
:EMNotificationResources:generateReleaseRFile
:Firebase:generateReleaseRFile
:GoogleMobileAdsPlugin:generateReleaseRFile
:processReleaseResources
:generateReleaseSources
:EMNotificationResources:generateReleaseBuildConfig
:EMNotificationResources:prepareLintJar UP-TO-DATE
:EMNotificationResources:generateReleaseSources
:EMNotificationResources:javaPreCompileRelease
:EMNotificationResources:compileReleaseJavaWithJavac
:EMNotificationResources:processReleaseJavaRes NO-SOURCE
:EMNotificationResources:transformClassesAndResourcesWithPrepareIntermediateJarsForRelease
:Firebase:generateReleaseBuildConfig
:Firebase:prepareLintJar UP-TO-DATE
:Firebase:generateReleaseSources
:Firebase:javaPreCompileRelease
:Firebase:compileReleaseJavaWithJavac
:Firebase:processReleaseJavaRes NO-SOURCE
:Firebase:transformClassesAndResourcesWithPrepareIntermediateJarsForRelease
:GoogleMobileAdsPlugin:generateReleaseBuildConfig
:GoogleMobileAdsPlugin:prepareLintJar UP-TO-DATE
:GoogleMobileAdsPlugin:generateReleaseSources
:GoogleMobileAdsPlugin:javaPreCompileRelease
:GoogleMobileAdsPlugin:compileReleaseJavaWithJavac
:GoogleMobileAdsPlugin:processReleaseJavaRes NO-SOURCE
:GoogleMobileAdsPlugin:transformClassesAndResourcesWithPrepareIntermediateJarsForRelease
:javaPreCompileRelease
:compileReleaseJavaWithJavac
:compileReleaseNdk NO-SOURCE
:compileReleaseSources
:lintVitalRelease
:mergeReleaseShaders UP-TO-DATE
:compileReleaseShaders UP-TO-DATE
:generateReleaseAssets UP-TO-DATE
:EMNotificationResources:mergeReleaseShaders
:EMNotificationResources:compileReleaseShaders
:EMNotificationResources:generateReleaseAssets
:EMNotificationResources:packageReleaseAssets
:Firebase:mergeReleaseShaders
:Firebase:compileReleaseShaders
:Firebase:generateReleaseAssets
:Firebase:packageReleaseAssets
:GoogleMobileAdsPlugin:mergeReleaseShaders
:GoogleMobileAdsPlugin:compileReleaseShaders
:GoogleMobileAdsPlugin:generateReleaseAssets
:GoogleMobileAdsPlugin:packageReleaseAssets
:mergeReleaseAssets
:transformClassesWithDexBuilderForRelease
:transformClassesWithMultidexlistForRelease FAILED
63 actionable tasks: 51 executed, 12 up-to-date
]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <177bc8179be6497489c4b5b319f290d7>:0)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <177bc8179be6497489c4b5b319f290d7>:0)
UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <177bc8179be6497489c4b5b319f290d7>:0)
UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1[T] progress, System.String error) (at <177bc8179be6497489c4b5b319f290d7>:0)
UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <177bc8179be6497489c4b5b319f290d7>:0)
Rethrow as GradleInvokationException: Gradle build failed
UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <177bc8179be6497489c4b5b319f290d7>:0)
UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <177bc8179be6497489c4b5b319f290d7>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <177bc8179be6497489c4b5b319f290d7>:0)
Rethrow as BuildFailedException: Exception of type 'UnityEditor.Build.BuildFailedException' was thrown.
UnityEditor.Android.PostProcessor.CancelPostProcess.AbortBuild (System.String title, System.String message, System.Exception ex) (at <177bc8179be6497489c4b5b319f290d7>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <177bc8179be6497489c4b5b319f290d7>:0)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (UnityEditor.BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <177bc8179be6497489c4b5b319f290d7>:0)
UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <177bc8179be6497489c4b5b319f290d7>:0)
UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:281)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)




Important to notice:
If I delete those lines from FacebookMediationDependencies.xml (lines 3-12):
<androidPackage spec="com.google.ads.mediation:facebook:5.4.0.0">
      <repositories>
        <repository>https://jcenter.bintray.com/</repository>
      </repositories>
    </androidPackage>
    <androidPackage spec="com.facebook.android:audience-network-sdk:5.4.0">
      <repositories>
        <repository>https://jcenter.bintray.com/</repository>
      </repositories>
    </androidPackage>
 
 the build completes, but 'Mediation Test Suite' shows that the adapter is not working.



More info if needed:
1. Using custom gradle without proguard
2. Building with multidex enabled
3. Happens when building - Mono / IL2CPP
4. Using custom android manifest
5. Using Unity 2019.1.0f2

My custom gradle file:
// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN

buildscript {
    repositories {
        google()
        jcenter()
    }

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

allprojects {
    repositories {
        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:///" + file(rootProject.projectDir.path + "/../../").absolutePath
        maven {
            url "https://maven.google.com"
        }
        maven {
            url "https://maven.google.com" // Assets/EasyMobile/Editor/EasyMobileDependencies.xml:23, Assets/EasyMobile/Editor/EasyMobileDependencies.xml:29
        }
        maven {
            url (unityProjectPath + "/Assets/EasyMobile/Plugins/Android/m2repository") // Assets/EasyMobile/Editor/EasyMobileDependencies.xml:35
        }
        maven {
            url (unityProjectPath + "/Assets/Firebase/m2repository") // Assets/Firebase/Editor/AnalyticsDependencies.xml:20, Assets/Firebase/Editor/AppDependencies.xml:20, Assets/Firebase/Editor/AuthDependencies.xml:20, Assets/Firebase/Editor/DatabaseDependencies.xml:20, Assets/Firebase/Editor/MessagingDependencies.xml:22, Assets/Firebase/Editor/RemoteConfigDependencies.xml:22
        }
        maven {
            url "https://jcenter.bintray.com/" // Assets/GoogleMobileAds/Editor/FacebookMediationDependencies.xml:8, Assets/GoogleMobileAds/Editor/FacebookMediationDependencies.xml:13
        }
        maven {
            url "https://maven.google.com/" // Assets/GoogleMobileAds/Editor/GoogleMobileAdsDependencies.xml:7
        }
        mavenLocal()
        jcenter()
        mavenCentral()
    }
}
// Android Resolver Repos End
apply plugin: 'com.android.application'
**APPLY_PLUGINS**

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:multidex:1.0.1'
// Android Resolver Dependencies Start
    implementation 'com.android.support:appcompat-v7:24.0.+' // Assets/EasyMobile/Editor/EasyMobileDependencies.xml:29
    implementation 'com.android.support:appcompat-v7:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
    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:support-v4:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
    implementation 'com.android.support:support-v4:26.1.+' // Assets/EasyMobile/Editor/EasyMobileDependencies.xml:23
    implementation 'com.facebook.android:audience-network-sdk:5.4.0' // Assets/GoogleMobileAds/Editor/FacebookMediationDependencies.xml:13
    implementation 'com.google.ads.mediation:facebook:5.4.0.0' // Assets/GoogleMobileAds/Editor/FacebookMediationDependencies.xml:8
    implementation 'com.google.android.gms:play-services-ads:17.2.0' // Assets/GoogleMobileAds/Editor/GoogleMobileAdsDependencies.xml:7
    implementation 'com.google.auto.value:auto-value-annotations:1.6.3' // Assets/Firebase/Editor/AppDependencies.xml:22
    implementation 'com.google.firebase:firebase-analytics:16.5.0' // Assets/Firebase/Editor/RemoteConfigDependencies.xml:15
    implementation 'com.google.firebase:firebase-analytics-unity:6.1.1' // Assets/Firebase/Editor/AnalyticsDependencies.xml:20
    implementation 'com.google.firebase:firebase-app-unity:6.1.1' // Assets/Firebase/Editor/AppDependencies.xml:20
    implementation 'com.google.firebase:firebase-auth:17.0.0' // Assets/Firebase/Editor/AuthDependencies.xml:13
    implementation 'com.google.firebase:firebase-auth-unity:6.1.1' // Assets/Firebase/Editor/AuthDependencies.xml:20
    implementation 'com.google.firebase:firebase-common:17.1.0' // Assets/Firebase/Editor/AppDependencies.xml:13
    implementation 'com.google.firebase:firebase-config:17.0.0' // Assets/Firebase/Editor/RemoteConfigDependencies.xml:13
    implementation 'com.google.firebase:firebase-config-unity:6.1.1' // Assets/Firebase/Editor/RemoteConfigDependencies.xml:22
    implementation 'com.google.firebase:firebase-database:17.0.0' // Assets/Firebase/Editor/DatabaseDependencies.xml:13
    implementation 'com.google.firebase:firebase-database-unity:6.1.1' // Assets/Firebase/Editor/DatabaseDependencies.xml:20
    implementation 'com.google.firebase:firebase-iid:[18.0.0]' // Assets/Firebase/Editor/RemoteConfigDependencies.xml:17
    implementation 'com.google.firebase:firebase-messaging:18.0.0' // Assets/Firebase/Editor/MessagingDependencies.xml:17
    implementation 'com.google.firebase:firebase-messaging-unity:6.1.1' // Assets/Firebase/Editor/MessagingDependencies.xml:22
    implementation 'com.sglib.easymobile:easy-mobile:1.+' // Assets/EasyMobile/Editor/EasyMobileDependencies.xml:35
// 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 {
        minSdkVersion **MINSDKVERSION**
        targetSdkVersion **TARGETSDKVERSION**
multiDexEnabled true
        applicationId '**APPLICATIONID**'
        ndk {
            abiFilters **ABIFILTERS**
        }
        versionCode **VERSIONCODE**
        versionName '**VERSIONNAME**'
    }

    lintOptions {
        abortOnError false
    }

    aaptOptions {
        noCompress = ['.unity3d', '.ress', '.resource', '.obb'**STREAMING_ASSETS**]
        ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~"
    }**SIGN**

    buildTypes {
        debug {
            minifyEnabled **MINIFY_DEBUG**
            useProguard **PROGUARD_DEBUG**
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD****SIGNCONFIG**
            jniDebuggable true
        }
        release {
            minifyEnabled **MINIFY_RELEASE**
            useProguard **PROGUARD_RELEASE**
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD****SIGNCONFIG**
        }
    }**PACKAGING_OPTIONS****SPLITS**
**BUILT_APK_LOCATION**
**EXTERNAL_SOURCES**
    bundle {
        language {
            enableSplit = false
        }
        density {
            enableSplit = false
        }
        abi {
            enableSplit = true
        }
    }
}**SPLITS_VERSION_CODE****REPOSITORIES****SOURCE_BUILD_SETUP**



My Custom Android Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest
  package="XXXX"
  android:versionCode="1"
  android:versionName="1.0">

  <supports-screens
        android:smallScreens="true"
        android:normalScreens="true"
        android:largeScreens="true"
        android:xlargeScreens="true"
        android:anyDensity="true"/>

  <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission>

  <application
    android:name="multidex.clever.com.clevermultidex.CleverApplication"
    android:label="@string/app_name"
    android:icon="@drawable/app_icon"
    android:fullBackupContent="false"
    android:debuggable="false"
    android:isGame="true"
    >

    <!-- The MessagingUnityPlayerActivity is a class that extends
         UnityPlayerActivity to work around a known issue when receiving
         notification data payloads in the background. -->
    <activity
      android:name="com.google.firebase.MessagingUnityPlayerActivity"
      android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
      <meta-data
        android:name="unityplayer.UnityActivity"
        android:value="true" />
    </activity>

    <service android:name="com.google.firebase.messaging.MessageForwardingService" android:exported="false" />
    <activity android:name="com.facebook.unity.FBUnityLoginActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
    <activity android:name="com.facebook.unity.FBUnityDialogsActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
    <activity android:name="com.facebook.unity.FBUnityAppLinkActivity" android:exported="true" />
    <activity android:name="com.facebook.unity.FBUnityDeepLinkingActivity" android:exported="true" />
    <activity android:name="com.facebook.unity.FBUnityGameRequestActivity" />
    <activity android:name="com.facebook.unity.FBUnityCreateGameGroupActivity" />
    <activity android:name="com.facebook.unity.FBUnityJoinGameGroupActivity" />
    <activity android:name="com.facebook.unity.AppInviteDialogActivity" />
    <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="XXXX" />
    <meta-data android:name="com.facebook.sdk.AutoLogAppEventsEnabled" android:value="true" />
    <meta-data android:name="com.facebook.sdk.AdvertiserIDCollectionEnabled" android:value="true" />
    <provider android:name="com.facebook.FacebookContentProvider" android:authorities="XXXX" android:exported="true" />

    <!-- TODO: Replace with your real AdMob app ID -->
    <meta-data
        android:name="com.google.android.gms.ads.APPLICATION_ID"
        android:value="XXXX"/>

    <!-- NATIVE-SHARE -->
    <provider
        android:name="com.yasirkula.unity.UnitySSContentProvider"
        android:authorities="XXXX"
        android:exported="false"
        android:grantUriPermissions="true" />

  </application>
</manifest>





I hope that I provided enough information, I'm frustrated from trying to solve this issue.

Mobile Ads SDK Forum Advisor Prod

unread,
Jul 21, 2019, 11:10:30 PM7/21/19
to yakir...@gmail.com, google-adm...@googlegroups.com
Hi there,

Thank you for reaching out to us, and for providing extensive details about your concern.

I was able to build the sample project for Unity after following these steps for importing both the AdMob SDK and the GoogleMobileAdsFacebookMediation package. Could you confirm if the same would work on your end?

That said, I was getting build errors once I added the Facebook SDK package to the sample project. Kindly note that you do not need to import both the Facebook SDK and the Audience Network SDK if your intention was to simply add the Facebook Audience Network (FAN) as a mediated network for AdMob. As per this page, the only imports necessary for FAN mediation would be:
  1. Import Admob SDK.
  2. Import GoogleMobileAdsFacebookMediation.
However, if you did in fact needed to import the Facebook or Audience Network SDK, then I'm afraid that I will not be able to give insights to these third-party SDKs. I recommend contacting the support channel of Facebook for further assistance on these SDKs.

Let me know if this helps.

Regards,
Ziv Yves Sanchez
Mobile Ads SDK Team

ref:_00D1U1174p._5001UEFboj:ref

Y B

unread,
Jul 22, 2019, 5:50:33 PM7/22/19
to google-adm...@googlegroups.com
Hi Ziv,
After reading your response, I created a new project and done these steps:

1. Imported the following SDK's:
a. Facebook SDK
b. Admob SDK
c. Audience Network SDK

2. Enabled custom gradle and multi-dex and then encountered a build error

3. I fixed by the build error by going to AudienceNetwork/Plugins/Android/libs and removing the following files:
a. recyclerview-v7
b. support-compat
c. support-core-ui
d. support-core-utils
e. support-v4

4. Now everything worked, all imported SDK's were running fine,
So I tried to import the last SDK which is required by Admob Mediation docs: GoogleMobileAdsFacebookMediation SDK

5. Build errors showing - can't find a lead to the source of the error
But it might prove that the issue is in-fact in the GoogleMobileAdsFacebookMediation SDK, because all other SDK's were running just fine before importing it to the new project.

Let me know what you think.

Thanks

Mobile Ads SDK Forum Advisor Prod

unread,
Jul 22, 2019, 10:14:04 PM7/22/19
to yakir...@gmail.com, google-adm...@googlegroups.com
Hi there,

Thank you for giving the replication steps for your concern.

I tried using your replication steps on my end, and was able to successfully build an APK with it. Below are the details of the SDK and framework versions I've used: Attached also are sample files built by the setup described above. Do note however that I did not do step 2 in your replication steps. Could you confirm if this would work on your end?
FacebookFAN-source_zip.html
FacebookFAN_unknown.html
FacebookFAN-export_zip.html

Y B

unread,
Jul 23, 2019, 2:00:08 PM7/23/19
to Google Mobile Ads SDK Developers
Hey Ziv,
Thank you for looking into it.

After upgrading Unity to version 2019.3.0a8, I tried to import the project (source) you provided and execute the build from my side.
Unfortunately, I wasn't able to successfully build an APK and the issue still persists.
Please note that I tried to perform the same process on several computers, with diff JDK versions, and the results were the same.


These are the build errors I'm facing while building an APK with the project your provided, the error seems to indicate on duplicate classes:

CommandInvokationFailure: Gradle build failed.
C:/Program Files/Unity/Hub/Editor/2019.3.0a8/Editor/Data/PlaybackEngines/AndroidPlayer/Tools\OpenJDK\Windows\bin\java.exe -classpath "C:\Program Files\Unity\Hub\Editor\2019.3.0a8\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-5.1.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleDebug"


stderr[

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':launcher:checkDebugDuplicateClasses'.
> 1 exception was raised by workers:
  java.lang.RuntimeException: java.lang.RuntimeException: Duplicate class com.facebook.ads.AbstractAdListener found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.Ad found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.AdChoicesView found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.AdError found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.AdIconView found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.AdListener found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.AdOptionsView found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.AdOptionsView$Orientation found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.AdSettings found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.AdSettings$IntegrationErrorMode found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.AdSettings$MultiprocessSupportMode found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.AdSettings$TestAdType found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.AdSize found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.AdView found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.AdView$1 found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.AudienceNetworkActivity found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.AudienceNetworkActivity$1 found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.AudienceNetworkAds found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.AudienceNetworkAds$AdFormat found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.AudienceNetworkAds$InitListener found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.AudienceNetworkAds$InitResult found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.AudienceNetworkAds$InitSettingsBuilder found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.BidderTokenProvider found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.BuildConfig found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.CacheFlag found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.DefaultMediaViewVideoRenderer found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.ExtraHints found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.ExtraHints$1 found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.ExtraHints$Builder found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.ExtraHints$HintType found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.ExtraHints$Keyword found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.InstreamVideoAdListener found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.InstreamVideoAdView found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.InterstitialAd found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.InterstitialAdExtendedListener found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.InterstitialAdListener found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.MediaView found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.MediaView$1 found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.MediaViewListener found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.MediaViewVideoRenderer found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.MediaViewVideoRendererWithBackgroundPlayback found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.NativeAd found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.NativeAd$AdCreativeType found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.NativeAdBase found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.NativeAdBase$Image found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.NativeAdBase$MediaCacheFlag found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.NativeAdBase$NativeComponentTag found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.NativeAdBase$Rating found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.NativeAdLayout found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.NativeAdListener found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.NativeAdScrollView found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.NativeAdScrollView$AdViewProvider found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.NativeAdView found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.NativeAdView$Type found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.NativeAdViewAttributes found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.NativeAdsManager found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.NativeAdsManager$Listener found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.NativeBannerAd found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.NativeBannerAdView found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.NativeBannerAdView$Type found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.RewardData found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.RewardedAdListener found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.RewardedVideoAd found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.RewardedVideoAdExtendedListener found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.RewardedVideoAdListener found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.S2SRewardedVideoAdExtendedListener found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.S2SRewardedVideoAdListener found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.VideoAutoplayBehavior found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.VideoStartReason found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.internal.api.AdChoicesViewApi found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.internal.api.AdComponentView found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.internal.api.AdComponentView$1 found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.internal.api.AdComponentViewApi found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.internal.api.AdComponentViewApiProvider found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.internal.api.AdComponentViewParentApi found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.internal.api.AdNativeComponentView found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.internal.api.AdOptionsViewApi found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.internal.api.AdSettingsApi found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.internal.api.AdSizeApi found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.internal.api.AdViewApi found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.internal.api.AdViewConstructorParams found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.internal.api.AdViewParentApi found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.internal.api.AdsMessengerServiceApi found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.internal.api.AudienceNetworkActivityApi found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.internal.api.AudienceNetworkAdsApi found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.internal.api.BidderTokenProviderApi found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.internal.api.BuildConfigApi found in modules classes.jar (:AudienceNetwork:) and classes.jar (:com.facebook.android.audience-network-sdk-5.5.0-beta:)
  Duplicate class com.facebook.ads.internal.api.D<message truncated>


Please let me know if you have any suggestions.

Thank you.


 

Mobile Ads SDK Forum Advisor Prod

unread,
Jul 23, 2019, 10:19:43 PM7/23/19
to yakir...@gmail.com, google-adm...@googlegroups.com
Hi there,

I apologize for sending over non-compiling source code. I tested the same on my end and it was producing the same error log, despite it compiling into an APK before.

That said, I was able to make it compile again by deleting the com.facebook.android.audience-network-sdk-5.5.0-beta.aar file in Assets/Plugins/Android. Could you check if the same would work on your end?

Aras Aydogan

unread,
Aug 1, 2019, 8:43:28 AM8/1/19
to google-adm...@googlegroups.com
I get the same "duplicate class" errors when I integrate any mediation sdk. I have tried GoogleMobileAds -Unity- and -Applovin- mediation and got the same errors.

Beside that, when I integrate the latest Admob plugin, apk crashes on startup (not responding to touches or stopped working)

using Unity 2018.4.5f1

Mobile Ads SDK Forum Advisor Prod

unread,
Aug 1, 2019, 9:53:33 PM8/1/19
to avor...@gmail.com, google-adm...@googlegroups.com
Hi Aras,

Thank you for reaching out to us.

Could you provide the details below using the Reply privately to author option so that I can investigate the issue?
  • Sample project that replicates the issue
  • AdMob plugin version
  • Mediation plugins versions (for each mediation network)
  • Error logs
Reply all
Reply to author
Forward
0 new messages