AppLovin / AppLovin-MAX-React-Native

MIT License
55 stars 29 forks source link

Build android: failed when adding ironSource dependencies #236

Closed DevVibhor closed 12 months ago

DevVibhor commented 1 year ago

MAX Module Version

5.5.3

React Native Version

0.66.3

Device/Platform Info

Android Pixel4a API 31

Current Behavior

Getting this error when adding ironSource dependency in my build.gradle.

` Execution failed for task ':app:checkReleaseAarMetadata'.

Could not resolve all files for configuration ':app:releaseRuntimeClasspath'. Could not find com.applovin.mediation:ironsource-adapter:7.4.0. Searched in the following locations:

`

Expected Behavior

No response

How to Reproduce

To reproduce this you can follow the instructions in the official documentation.

Add this implementation in the build.gradle file (app level) implementation 'com.applovin.mediation:ironsource-adapter:7.4.0.0.0'

Also, add this under repositories of build.gradle (module level) maven { url "https://android-sdk.is.com" }

Then hit sync now, then it will give you the error and sync will fail.

Additional Info

No response

thomasmso commented 1 year ago

Could not find com.applovin.mediation:ironsource-adapter:7.4.0.

It looks like you entered the incorrect version 7.4.0. The adapter version is actually 7.4.0.0.0. You can find it here for future reference: https://github.com/AppLovin/AppLovin-MAX-SDK-Android/blob/master/IronSource/CHANGELOG.md

DevVibhor commented 1 year ago

@thomasmso I have mentioned in the "How to Reproduce" section the version of the adapter and have also rechecked in my build.gradle file and indeed it is implementation 'com.applovin.mediation:ironsource-adapter:7.4.0.0.0'

DevVibhor commented 1 year ago

Hi @thomasmso I think we need to reopen this issue as this hasn't been resolved.

thomasmso commented 1 year ago

@DevVibhor - Could you send over your full build.gradle file? Then our team will take a look at it.

Also, add this under repositories of build.gradle (module level) maven { url "https://android-sdk.is.com" }

Can you try adding this to your app-level build.gradle file?

DevVibhor commented 1 year ago

Also, add this under repositories of build.gradle (module level) maven { url "https://android-sdk.is.com" }

Can you try adding this to your app-level build.gradle file?

@thomasmso I have already added this is my module level build.gradle file as I have mentioned in how to reproduce section.

Here's my build.gradle app level.

apply plugin: "com.android.application"
apply plugin: 'applovin-quality-service'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'

import com.android.build.OutputFile

project.ext.react = [
    enableHermes: true,  // clean and rebuild if changing
]

apply from: "../../node_modules/react-native/react.gradle"

def enableSeparateBuildPerCPUArchitecture = false

def enableProguardInReleaseBuilds = true

def jscFlavor = 'org.webkit:android-jsc:+'

def enableHermes = project.ext.react.get("enableHermes", true);

def nativeArchitectures = project.getProperties().get("reactNativeDebugArchitectures")

def useIntlJsc = false
android {
    ndkVersion rootProject.ext.ndkVersion

    compileSdkVersion rootProject.ext.compileSdkVersion

    defaultConfig {
        applicationId "com.app_name"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
        }
    }
    signingConfigs {
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    buildTypes {
        debug {
            if (nativeArchitectures) {
                ndk {
                    abiFilters nativeArchitectures.split(',')
                }
            }
            firebaseCrashlytics {
                nativeSymbolUploadEnabled true
                unstrippedNativeLibsDir 'build/intermediates/merged_native_libs/release/out/lib'
            }
        }
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            firebaseCrashlytics {
                nativeSymbolUploadEnabled true
                unstrippedNativeLibsDir 'build/intermediates/merged_native_libs/release/out/lib'
            }
        }
    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/ASL2.0'
        exclude("META-INF/*.kotlin_module")

        pickFirst 'lib/armeabi-v7a/libfbjni.so'
        pickFirst 'lib/arm64-v8a/libc++_shared.so'
        pickFirst 'lib/arm64-v8a/libfbjni.so'
        pickFirst 'lib/x86_64/libfbjni.so'
        pickFirst 'lib/x86/libfbjni.so'
        pickFirst 'lib/x86/libc++_shared.so'
        pickFirst 'lib/x86_64/libc++_shared.so'
        pickFirst 'lib/armeabi-v7a/libc++_shared.so'

        pickFirst '**/armeabi-v7a/libc++_shared.so'
        pickFirst '**/x86/libc++_shared.so'
        pickFirst '**/x86_64/libc++_shared.so'
        pickFirst '**/arm64-v8a/libc++_shared.so'
        pickFirst '**/libjsc.so'
        pickFirst '**/libc++_shared.so'
        pickFirst '**/libgnustl_shared.so'
        exclude "**/libjsc.so"
    }

    // applicationVariants are e.g. debug, release
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            // For each separate APK per architecture, set a unique version code as described here:
            // https://developer.android.com/studio/build/configure-apk-splits.html
            // Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
            def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        defaultConfig.versionCode * 1000 + versionCodes.get(abi)
            }

        }
    }
}

dependencies {

    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation ("com.facebook.react:react-native") version {
        strictly "0.66.3"
    }
    implementation project(':react-native-share')

    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation 'androidx.recyclerview:recyclerview:1.3.0'

    implementation "com.google.android.gms:play-services-ads-identifier:18.0.1"

    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'

    implementation 'com.facebook.fresco:animated-base-support:1.3.0'

    // For animated GIF support
    implementation 'com.facebook.fresco:animated-gif:2.5.0'

    implementation 'com.facebook.soloader:soloader:0.10.5'
    implementation 'com.squareup.okhttp3:okhttp:4.9.1'

    // For WebP support, including animated WebP
    implementation 'com.facebook.fresco:animated-webp:2.5.0'
    implementation 'com.facebook.fresco:webpsupport:2.5.0'

    // For WebP support, without animations
    implementation 'com.facebook.fresco:webpsupport:2.5.0'

    implementation project(':@react-native-camera-roll_camera-roll')

    implementation 'com.applovin:applovin-sdk:11.10.1'
    implementation 'com.applovin.mediation:facebook-adapter:6.14.0.0'
    implementation 'com.applovin.mediation:inmobi-adapter:10.1.4.1'
    implementation 'com.applovin.mediation:ironsource-adapter:7.4.0.0.0'
    implementation 'com.applovin.mediation:unityads-adapter:4.8.0.0'

    implementation 'androidx.multidex:multidex:2.0.1'

    implementation project(path: ":@react-native-firebase_app")

    implementation ("androidx.appcompat:appcompat:1.3.1") {
        version {
            strictly '1.3.1'
        }
    }
    implementation 'com.google.android.material:material:1.5.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'

    if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }
}

task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.implementation
    into 'libs'
}

applovin {
    apiKey "your api key"
}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
thomasmso commented 1 year ago

Thanks, we'll check it out.

alhiwatan commented 1 year ago

@DevVibhor, I can't reproduce the issue. My build works fine with all my plugins, including ironsouce.

Your build.gradle looks good. So, can you try to build without the version number?

implementation 'com.applovin.mediation:ironsource-adapter:+'

If that works, then can you try 7.4.0.0.0 again?

DevVibhor commented 1 year ago

@DevVibhor, I can't reproduce the issue. My build works fine with all my plugins, including ironsouce.

Your build.gradle looks good. So, can you try to build without the version number?

implementation 'com.applovin.mediation:ironsource-adapter:+'

If that works, then can you try 7.4.0.0.0 again?

@alhiwatan I tried without the version number, getting the same error.

* What went wrong:
Execution failed for task ':app:checkReleaseAarMetadata'.
> Could not resolve all files for configuration ':app:releaseRuntimeClasspath'.
   > Could not find com.ironsource.sdk:mediationsdk:7.4.0.
     Searched in the following locations:
       - https://repo.maven.apache.org/maven2/com/ironsource/sdk/mediationsdk/7.4.0/mediationsdk-7.4.0.pom
       - file:/Users/user/.m2/repository/com/ironsource/sdk/mediationsdk/7.4.0/mediationsdk-7.4.0.pom
       - file:/Users/user/Test/app/node_modules/react-native/android/com/ironsource/sdk/mediationsdk/7.4.0/mediationsdk-7.4.0.pom
       - file:/Users/user/Test/app/node_modules/jsc-android/dist/com/ironsource/sdk/mediationsdk/7.4.0/mediationsdk-7.4.0.pom
       - https://dl.google.com/dl/android/maven2/com/ironsource/sdk/mediationsdk/7.4.0/mediationsdk-7.4.0.pom
       - https://www.jitpack.io/com/ironsource/sdk/mediationsdk/7.4.0/mediationsdk-7.4.0.pom
     Required by:
         project :app > com.applovin.mediation:ironsource-adapter:7.4.0.0.1

* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
alhiwatan commented 1 year ago

@DevVibhor, have you tried to clean the gradle cache? 7.4.0 might be cached somehow.

DevVibhor commented 1 year ago

@alhiwatan, I tried doing Clean Project, Rebuild Project, Sync Project with Gradle files, Invalidate Caches and then re-install the node modules but none of these seems to work, I am still getting the same error.

alhiwatan commented 1 year ago

@DevVibhor, not sure why you are still getting the same error.

Without setting the IS repository, I have the exact same eror. Can you double check you have this in the right place?

    repositories {
        maven {
            url 'https://android-sdk.is.com/' 
         }
    }
DevVibhor commented 1 year ago

Yes @alhiwatan I have this in the right place.

alhiwatan commented 1 year ago

@DevVibhor, it seems that there should be some network issues or something on your end. No similar issues have been reported with the other of our SDKs.

DevVibhor commented 1 year ago

Hi @alhiwatan thanks for your support. I am still facing this issue but if no one else has reported this issue or facing it, then you can close this bug report.