React-native-firebase: 馃敟 Android build fails after upgrading from 5.5.4 to 5.5.5 - rewardedVideo.setCustomData(customData)

Created on 5 Sep 2019  路  7Comments  路  Source: invertase/react-native-firebase

Issue

I upgraded our version of react-native-firebase to version 5.5.4 and it builds fine, following this guide:
https://rnfirebase.io/docs/v5.x.x/releases/v5.5.x

When I upgrade to version 5.5.5 I get a build error, presumably related to this change:
https://github.com/invertase/react-native-firebase/pull/2333

The error is:

Task :react-native-firebase:compileDebugJavaWithJavac FAILED
/Users/user/Dev/paym-native-app/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/admob/RNFirebaseAdMobRewardedVideo.java:91: error: cannot find symbol
           rewardedVideo.setCustomData(customData);
                        ^
  symbol:   method setCustomData(String)
  location: variable rewardedVideo of type RewardedVideoAd
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error

Note that we are not using the Admob module within this project.
I have included the contents of our build.gradle files etc below.
The framework versions should be correct as per the release notes for v5.5.x.

Let me know if you need any additional info and thank you for any help in advance.


Project Files

iOS

Click To Expand

#### `ios/Podfile`: - [x] I'm not using Pods - [ ] I'm using Pods and my Podfile looks like:

# N/A
#### `AppDelegate.m`:
// N/A


Android

Click To Expand

#### Have you converted to AndroidX? - [ ] my application is an AndroidX application? - [ ] I am using `android/gradle.settings` `jetifier=true` for Android compatibility? - [ ] I am using the NPM package `jetifier` for react-native compatibility? #### `android/build.gradle`:

buildscript {
    ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 18
        compileSdkVersion = 28
        targetSdkVersion = 28
        supportLibVersion = "28.0.0"
    }
    repositories {
        google()
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.2'
        classpath 'com.google.gms:google-services:4.2.0'
        classpath 'com.google.firebase:perf-plugin:1.2.1'
    }
}

def googlePlayServicesVersion = '15.0.1'

subprojects {
    afterEvaluate {project ->
        if (project.hasProperty("android")) {
            android {
                compileSdkVersion 28
                buildToolsVersion "28.0.3"
            }
        }
    }
}


allprojects {
    repositories {
        mavenLocal()
        google()
        jcenter()
        maven {
            url "$rootDir/../node_modules/react-native/android"
        }
        maven {
            url 'https://maven.google.com'
            name 'Google'
        }

        configurations.all {
            resolutionStrategy {
                force "com.google.android.gms:play-services-ads:$googlePlayServicesVersion"
                force "com.google.android.gms:play-services-gcm:$googlePlayServicesVersion"
                force "com.google.android.gms:play-services-analytics:$googlePlayServicesVersion"
                force "com.google.android.gms:play-services-location:$googlePlayServicesVersion"
            }
        }
    }
}
#### `android/app/build.gradle`:
apply plugin: "com.android.application"
apply plugin: "io.fabric"
apply plugin: "com.google.firebase.firebase-perf"

repositories {
    maven { url 'https://maven.fabric.io/public' }
    maven {
        url 'https://maven.google.com/'
        name 'Google'
    }
}

import com.android.build.OutputFile

project.ext.react = [
    entryFile: "index.js",
    bundleInProdRelease: true,
    devDisabledInStaging: false
]

apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"

def enableSeparateBuildPerCPUArchitecture = false

def enableProguardInReleaseBuilds = true

android {
    signingConfigs {
        debugSigning {
            keyAlias 'androiddebugkey'
            keyPassword 'android'
            storeFile file('../debug.keystore')
            storePassword 'android'
        }
    }
    compileSdkVersion rootProject.ext.compileSdkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    flavorDimensions "default"
    defaultConfig {
        applicationId "com.ovo.energy"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "9.11.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"
        }
    }
    buildTypes {
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            signingConfig signingConfigs.debugSigning
        }
    }
    productFlavors {
        prod {}
        uat {
            applicationIdSuffix ".uat"
        }
    }

    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            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 =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }
        }
        configurations.all {
            resolutionStrategy.force 'com.google.code.findbugs:jsr305:3.0.0'
        }
    }

    packagingOptions {
       pickFirst 'lib/x86/libc++_shared.so'
       pickFirst 'lib/x86_64/libjsc.so'
       pickFirst 'lib/arm64-v8a/libjsc.so'
       pickFirst 'lib/arm64-v8a/libc++_shared.so'
       pickFirst 'lib/x86_64/libc++_shared.so'
       pickFirst 'lib/armeabi-v7a/libc++_shared.so'
    }
}

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.25.4'
    }
}

dependencies {
    implementation project(':@react-native-community_async-storage')
    implementation project(':@react-native-community_netinfo')
    implementation project(':react-native-webview')
    implementation project(':react-native-gesture-handler')
    implementation project(':react-native-splash-screen')
    implementation project(':react-native-webview-android')
    implementation project(':react-native-touch-id')
    implementation (project(':react-native-share')) {
        exclude group: "com.android.support"
    } 
    implementation project(':rn-fetch-blob')
    implementation project(':react-native-svg')
    implementation project(':react-native-cookies')
    implementation project(':react-native-push-notification')
    implementation project(':react-native-add-calendar-event')
    implementation project(':react-native-pdf')
    implementation project(':react-native-fabric')
    implementation project(':react-native-restart')
    implementation project(':react-native-code-push')
    implementation project(':react-native-torch')
    implementation project(':react-native-secure-key-store')
    implementation project(':react-native-mixpanel')
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "com.android.support:appcompat-v7:$supportLibraryVersion"
    implementation 'com.facebook.react:react-native:+'

    implementation('com.crashlytics.sdk.android:crashlytics:2.9.3@aar') {
        transitive = true;
    }
    implementation project(':react-native-device-info')

    implementation(project(':react-native-firebase')) {
        transitive = false
    }

    implementation "com.google.android.gms:play-services-base:16.1.0"
    implementation "com.google.firebase:firebase-core:16.0.9"
    implementation "com.google.firebase:firebase-config:17.0.0"
    implementation "com.google.firebase:firebase-database:17.0.0"
    implementation "com.google.firebase:firebase-perf:17.0.2"
    implementation "com.google.firebase:firebase-firestore:19.0.0"
}

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

apply plugin: 'com.google.gms.google-services'
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
#### `android/settings.gradle`:
rootProject.name = 'OvoEnergyApp'
include ':@react-native-community_async-storage'
project(':@react-native-community_async-storage').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/async-storage/android')
include ':@react-native-community_netinfo'
project(':@react-native-community_netinfo').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/netinfo/android')
include ':react-native-webview'
project(':react-native-webview').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-webview/android')
include ':react-native-gesture-handler'
project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-gesture-handler/android')
include ':react-native-splash-screen'
project(':react-native-splash-screen').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-splash-screen/android')
include ':react-native-webview-android'
project(':react-native-webview-android').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-webview-android/android')
include ':react-native-touch-id'
project(':react-native-touch-id').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-touch-id/android')
include ':react-native-share'
project(':react-native-share').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-share/android')
include ':rn-fetch-blob'
project(':rn-fetch-blob').projectDir = new File(rootProject.projectDir, '../node_modules/rn-fetch-blob/android')
include ':react-native-svg'
project(':react-native-svg').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-svg/android')
include ':react-native-cookies'
project(':react-native-cookies').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-cookies/android')
include ':react-native-push-notification'
project(':react-native-push-notification').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-push-notification/android')
include ':react-native-add-calendar-event'
project(':react-native-add-calendar-event').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-add-calendar-event/android')
include ':react-native-pdf'
project(':react-native-pdf').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-pdf/android')
include ':react-native-fabric'
project(':react-native-fabric').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fabric/android')
include ':react-native-restart'
project(':react-native-restart').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-restart/android')
include ':react-native-code-push'
project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app')

include ':react-native-secure-key-store'
project(':react-native-secure-key-store').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-secure-key-store/android')
include ':react-native-device-info'
project(':react-native-device-info').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-device-info/android')

include ':react-native-mixpanel'
project(':react-native-mixpanel').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-mixpanel/android')

include ':react-native-torch'
project(':react-native-torch').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-torch/android')

include ':react-native-firebase'
project(':react-native-firebase').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-firebase/android')

include ':app'
#### `MainApplication.java`:
// N/A
#### `AndroidManifest.xml`:
<!-- N/A -->


Environment

Click To Expand

**`react-native info` output:**

  React Native Environment Info:
    System:
      OS: macOS High Sierra 10.13.6
      CPU: (4) x64 Intel(R) Core(TM) i7-7660U CPU @ 2.50GHz
      Memory: 153.12 MB / 16.00 GB
      Shell: 5.3 - /bin/zsh
    Binaries:
      Node: 8.12.0 - /usr/local/bin/node
      Yarn: 1.16.0 - /usr/local/bin/yarn
      npm: 6.9.0 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.0, macOS 10.14, tvOS 12.0, watchOS 5.0
      Android SDK:
        API Levels: 23, 24, 26, 27, 28
        Build Tools: 26.0.3, 27.0.3, 28.0.3
        System Images: android-24 | Google APIs Intel x86 Atom, android-26 | Google APIs Intel x86 Atom, android-26 | Google APIs Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom_64, android-28 | Google Play Intel x86 Atom, android-28 | Google Play Intel x86 Atom_64
    IDEs:
      Android Studio: 3.2 AI-181.5540.7.32.5056338
      Xcode: 10.0/10A255 - /usr/bin/xcodebuild
    npmPackages:
      react: ^16.8.3 => 16.8.6
      react-native: 0.59.3 => 0.59.3
    npmGlobalPackages:
      react-native-cli: 2.0.1
      react-native-git-upgrade: 0.2.7
- **Platform that you're experiencing the issue on**: - [ ] iOS - [x] Android - [ ] **iOS** but have not tested behavior on Android - [ ] **Android** but have not tested behavior on iOS - [ ] Both - **`react-native-firebase` version you're using that has this issue:** - `5.5.5` - **`Firebase` module(s) you're using that has the issue:** - `Core, Config, Database, Perf, Firestore` - **Are you using `TypeScript`?** - `Y`

Most helpful comment

I found the issue on our side.
It was not related to mobile-ads-sdk, but on android/build.gradle we were resolving com.google.android.gms:play-services-ads without using it, which seems to be the cause of importing the admob code. Everything started to work fine after removing that.

All 7 comments

Strange, you indicate you are not using admob, but admob is being compiled. Why?

That said you've got a tangle of old dependencies and it seems a waste of time to even try to troubleshoot some compile error if you're not current (rn60, current firebase sdk release etc)

and this com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true gives me the shivers 馃槺

We're having this same issue on our project, and also not using any admob.
@mikehardy , why did you mention That said you've got a tangle of old dependencies ? Trying to figure if that's the case for our repo and narrow down the problem
As for the configuration we're on react-native 60.5 and using the latest react-native-firebase 5.5.6

I say that because the original reporter has non-current versions of everything. I have a personal aversion to troubleshooting non-current versions. If you spend a bunch of time troubleshooting something only to find it was solved in a future release (a very frequent occurrence) it's a total waste. So the first thing I do usually is check people's versions when they log issues and if they're not current, I note it. It is not always the solution to upgrade, but it frequently helps.

Sounds like you're current if you are on RNFB5.5.6 and RN0.60.5. If you are experiencing the same thing it makes me think it has to be the SDK versions then.

And in fact we've seen this before - #2363 #2287 #2226 and it smells like this one https://github.com/expo/expo/issues/5242

I wouldn't be so sure of it, we're not using expo either. Let me know if you'd like to see any configuration or specific part of the code and I'll help as much as possible

the underlying google sdk appears to have a semver violation in their release, and my guess is something is pinning it to a prior version. I don't want to troubleshoot further myself - https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh shows that it builds fine if dependencies are correct - but if I were troubleshooting I'd be looking very closely at ./gradlew :app:dependencies and seeing what version the mobile-ads-sdk came in at, making sure it was the most recent release per whatever release notes google publishes

I found the issue on our side.
It was not related to mobile-ads-sdk, but on android/build.gradle we were resolving com.google.android.gms:play-services-ads without using it, which seems to be the cause of importing the admob code. Everything started to work fine after removing that.

I found the issue on our side.
It was not related to mobile-ads-sdk, but on android/build.gradle we were resolving com.google.android.gms:play-services-ads without using it, which seems to be the cause of importing the admob code. Everything started to work fine after removing that.

This also fixed the issue for me! Thank you both for your help, it's much appreciated 馃憤

Was this page helpful?
0 / 5 - 0 ratings