invertase / react-native-firebase

🔥 A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
https://rnfirebase.io
Other
11.68k stars 2.21k forks source link

🔥 app.utils(...).checkPlayServicesAvailability is not a function #2380

Closed Subway19 closed 5 years ago

Subway19 commented 5 years ago

Issue

Screenshot_2019-07-19-12-20-03-324_com orowealth orowealthv11


Project Files

android/build.gradle


buildscript {
    ext {
    googlePlayServicesVersion = "16.+" // default: "+"
    firebaseVersion = "17.3.4" // default: "+"

    // Other settings
    compileSdkVersion = 28 // default: 23
    //buildToolsVersion = "27.0.3" // default: "23.0.1"
    buildToolsVersion = "28.0.3"
    minSdkVersion = 16
    targetSdkVersion = 28 //26 // default: 23
    supportLibVersion = "28.0.0"  //"23.1.1" // default: 23.1.1
    }

    repositories {
        mavenCentral()
        google()
        jcenter()
        maven { url 'https://maven.fabric.io/public' }

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.1'
        classpath 'com.google.gms:google-services:4.2.0'  //changed for codepush from 4.0.1
        classpath 'io.fabric.tools:gradle:1.30.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenLocal()
        google()
        maven {
             url 'https://maven.google.com'
        }
        maven { url 'https://maven.zohodl.com' }
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }

    }
}

subprojects {
    afterEvaluate {project ->
        if (project.hasProperty("android")) {
            android {
                compileSdkVersion 28
                buildToolsVersion "27.0.3"
            }
        }
    }
     if (project.name.contains('react-native-image-picker')) {
        buildscript {
            repositories {
                jcenter()
                maven { url "https://dl.bintray.com/android/android-tools/"  }
            }
        }
    }
    if (project.name.contains('react-native-vector-icons')) {
        buildscript {
            repositories {
                jcenter()
                maven { url "https://dl.bintray.com/android/android-tools/"  }
            }
        }
    }
}

android/app/build.gradle


apply plugin: "com.android.application"
apply plugin: 'io.fabric'

import com.android.build.OutputFile

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

apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"

def enableSeparateBuildPerCPUArchitecture = false

def enableProguardInReleaseBuilds = false

repositories {
  mavenCentral()
  maven { url 'https://maven.fabric.io/public' }
}

android {
    compileSdkVersion 28
    buildToolsVersion "27.0.3"

    //compileSdkVersion rootProject.ext.compileSdkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        applicationId "com.orowealth.orowealthv11"
        minSdkVersion 23
        targetSdkVersion 28
        versionCode 62
        versionName "4.17"
        // ndk {
        //     abiFilters "armeabi-v7a", "x86"
        // }
        multiDexEnabled true
    }

    dexOptions {
       javaMaxHeapSize "4g"
   }
    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.release
            debuggable false
        }
    }
    // 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:
            // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
            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
            }
        }
    }
}

dependencies {
    compile project(':bugsnag-react-native')
    compile project(':react-native-fbsdk')
    compile project(':react-native-referrer')
    compile project(':react-native-cookies')
    compile project(':react-native-mixpanel')
    compile project(':react-native-image-picker')
    compile project(':react-native-signature-capture')
    compile project(':react-native-google-signin')
    compile project(':react-native-prompt-android')
    compile project(':react-native-version-number')
    compile project(':react-native-vector-icons')
    compile project(':react-native-svg')
    compile project(':react-native-restart')
    compile project(':react-native-linear-gradient')
    compile project(':react-native-push-notification')
    compile project(':react-native-intercom')
    compile project(':react-native-image-picker')
    compile project(':react-native-fetch-blob')
    compile project(':react-native-exception-handler')
    compile project(':react-native-document-picker')
    compile project(':react-native-blur')
    compile project(':react-native-intercom')
    compile project(':react-native-version-number')
    compile project(':react-native-restart')
    compile project(':react-native-exception-handler')
    compile project(':react-native-fbsdk')
    compile project(':react-native-blur')
    compile project(':react-native-fetch-blob')
    compile project(':react-native-document-picker')
    compile project(':react-native-linear-gradient')
    compile project(':react-native-image-picker')
    compile project(':react-native-svg')
    compile project(':react-native-share')
    compile project(':react-native-code-push')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.mixpanel.android:mixpanel-android:5.+"
    compile "com.google.android.gms:play-services-gcm:16.1.0"
    //implementation "com.android.support:appcompat-v7:25.4.0"
    compile "com.facebook.react:react-native:+"  // From node_modules
    compile 'io.intercom.android:intercom-sdk-base:5.+'
    compile('com.crashlytics.sdk.android:crashlytics:2.9.9@aar') {
    transitive = true;
  }
    implementation project(':react-native-firebase')
    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" // remote config

    // Add the In-App Messaging dependency:
    implementation 'com.google.firebase:firebase-inappmessaging-display:17.1.1'

    implementation "com.google.firebase:firebase-messaging:18.0.0"
    implementation 'me.leolin:ShortcutBadger:1.1.21@aar' // <-- Add this line if you wish to use badge on Android

    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:28+"
    implementation "com.facebook.react:react-native:+"
    implementation(project(":react-native-google-signin")){
        exclude group: "com.google.android.gms" // very important
    }
    implementation 'com.google.android.gms:play-services-auth:16.0.1' // should be at least 15.0.0 to work with the most recent APIs
    compile project(':react-native-appsflyer')

    //fbsdk dependencies // latest is 4.40.0
    implementation 'com.facebook.android:facebook-android-sdk:4.39.0'
    //implementation 'com.zoho.salesiq:mobilisten:1.4'
    implementation project(':react-native-contacts')
    compile project(':clevertap-react-native')
    compile 'com.android.support:multidex:1.0.0'

}

apply plugin: 'com.google.gms.google-services' 

com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}

AndroidManifest.xml <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.orowealth.orowealthv11">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<!-- Recommended so that CleverTap knows when to attempt a network call -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-feature android:name="android.permission.BLUETOOTH" android:required="false"/>
<uses-feature android:name="android.hardware.camera" android:required="false" />

<!-- < Only if you're using GCM or localNotificationSchedule() > -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<permission
    android:name="com.orowealth.orowealthv11.permission.C2D_MESSAGE"
    android:protectionLevel="signature" />
<uses-permission android:name="com.orowealth.orowealthv11.permission.C2D_MESSAGE" />
<!-- < Only if you're using GCM or localNotificationSchedule() > -->

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

<application
  android:name=".MainApplication"
  android:allowBackup="false"
  android:label="@string/app_name"
  android:icon="@mipmap/ic_launcher"
  android:roundIcon="@mipmap/ic_launcher_round"
  android:theme="@style/AppTheme"
  android:usesCleartextTraffic="true"
    xmlns:tools="http://schemas.android.com/tools">

    <provider
      android:name="android.support.v4.content.FileProvider"
      android:authorities="com.orowealth.orowealthv11.provider"
      android:grantUriPermissions="true"
      android:exported="false">
      <meta-data
        android:name="android.support.FILE_PROVIDER_PATHS"
        android:resource="@xml/filepaths" />
    </provider>

  <meta-data  android:name="com.dieam.reactnativepushnotification.notification_channel_name"
              android:value="YOUR NOTIFICATION CHANNEL NAME"/>
  <meta-data  android:name="com.dieam.reactnativepushnotification.notification_channel_description"
              android:value="YOUR NOTIFICATION CHANNEL DESCRIPTION"/>
  <!-- Change the resource name to your App's accent color - or any other color you want -->
  <meta-data  android:name="com.dieam.reactnativepushnotification.notification_color"
              android:resource="@android:color/white"/>

    <!-- IMPORTANT: To force use Google AD ID to uniquely identify  users, use the following meta tag. GDPR mandates that if you are using this tag, there is prominent disclousure to your end customer in their application. Read more about GDPR here - https://clevertap.com/blog/in-preparation-of-gdpr-compliance/ -->

  <receiver
      android:name="com.google.android.gms.gcm.GcmReceiver"
      android:exported="true"
      android:permission="com.google.android.c2dm.permission.SEND" >
      <intent-filter>
          <action android:name="com.google.android.c2dm.intent.RECEIVE" />
          <category android:name="com.orowealth.orowealthv11" />
      </intent-filter>
  </receiver>

  <receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationPublisher" />
    <receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationBootEventReceiver">
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />
        </intent-filter>
    </receiver>
  <service android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationRegistrationService"/>

  <!-- < Only if you're using GCM or localNotificationSchedule() > -->
  <service
      android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerServiceGcm"
      android:exported="false" >
      <intent-filter>
          <action android:name="com.google.android.c2dm.intent.RECEIVE" />
      </intent-filter>
  </service>

   <!-- </ Only if you're using GCM or localNotificationSchedule() > -->

   <service
        android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerService"
        android:exported="false" >
        <intent-filter>
            <action android:name="com.google.firebase.MESSAGING_EVENT" />
        </intent-filter>
    </service>

    <service android:name="io.invertase.firebase.messaging.RNFirebaseMessagingService">
      <intent-filter>
        <action android:name="com.google.firebase.MESSAGING_EVENT" />
      </intent-filter>
    </service>

    <service android:name="io.invertase.firebase.messaging.RNFirebaseBackgroundMessagingService" />

    <meta-data
      android:name="com.google.firebase.messaging.default_notification_icon"
      android:resource="@drawable/ic_launcher" />
      <!-- Set color used with incoming notification messages. This is used when no color is set for the incoming
    notification message. See README(https://goo.gl/6BKBk7) for more. -->
    <meta-data
      android:name="com.google.firebase.messaging.default_notification_color"
      android:resource="@color/notificationColor" />

    <meta-data
      android:name="com.google.firebase.messaging.default_notification_channel_id"
      android:value="@string/default_notification_channel_id"/>

  <receiver android:name="io.invertase.firebase.notifications.RNFirebaseNotificationReceiver"/>
    <receiver android:enabled="true" android:exported="true"  android:name="io.invertase.firebase.notifications.RNFirebaseNotificationsRebootReceiver">
      <intent-filter>
        <action android:name="android.intent.action.BOOT_COMPLETED"/>
        <action android:name="android.intent.action.QUICKBOOT_POWERON"/>
        <action android:name="com.htc.intent.action.QUICKBOOT_POWERON"/>
        <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
  </receiver>

  <!-- WAS THIS REPEATED IN FBSDK ? -->
  <meta-data android:name="com.facebook.sdk.ApplicationId"
        android:value="@string/facebook_app_id"/>

  <activity
    android:name=".MainActivity"
    android:label="@string/app_name"
    android:launchMode="singleTop"
    android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
    android:windowSoftInputMode="adjustResize">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
 <action android:name="android.intent.action.DOWNLOAD_COMPLETE"/>
    </intent-filter>
    <intent-filter android:label="@string/app_name">
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <!-- Accepts URIs that begin with "example://gizmos” -->
    <data android:scheme="https"
          android:host="www.orowealth.com"
          android:pathPrefix="/auth/verify" />
</intent-filter>
  </activity>

  <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
  <service
  android:name="com.robinpowered.react.Intercom.IntercomIntentService"
  android:exported="false">
  <intent-filter
    android:priority="999">
      <action android:name="com.google.android.c2dm.intent.RECEIVE"/>
  </intent-filter>
</service>
<receiver
  android:name="io.intercom.android.sdk.push.IntercomPushBroadcastReceiver"
  tools:replace="android:exported"
  android:exported="true" />
<receiver android:name="com.appsflyer.SingleInstallBroadcastReceiver" android:exported="true">
  <intent-filter>
    <action android:name="com.android.vending.INSTALL_REFERRER" />
  </intent-filter>
</receiver>
<receiver android:name="com.jdc.reactlibrary.ReferrerReceiver" android:exported="true">
  <intent-filter>
    <action android:name="com.android.vending.INSTALL_REFERRER" />
  </intent-filter>
</receiver>
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
</application>

gradle-wrapper.properties


distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip

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? ## Environment

Click To Expand

**`react-native info` output:** React Native Environment Info: ``` System: OS: Linux 4.15 Ubuntu 18.04.1 LTS (Bionic Beaver) CPU: (4) x64 Intel(R) Core(TM) i3-3217U CPU @ 1.80GHz Memory: 131.39 MB / 7.69 GB Shell: 4.4.19 - /bin/bash Binaries: Node: 8.3.0 - ~/.nvm/versions/node/v8.3.0/bin/node npm: 5.3.0 - ~/.nvm/versions/node/v8.3.0/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: Android SDK: API Levels: 23, 25, 26, 27, 28 Build Tools: 23.0.1, 24.0.1, 26.0.3, 27.0.3, 28.0.2, 28.0.3 System Images: android-23 | Intel x86 Atom_64, android-23 | Google APIs Intel x86 Atom_64 npmPackages: react: ^16.8.3 => 16.8.6 react-native: ^0.59.10 => 0.59.10 ``` - **Platform that you're experiencing the issue on**: - [ ] iOS - [x] Android - [ ] **iOS** but have not tested behavior on Android - [x] **Android** but have not tested behavior on iOS - [ ] Both - **`react-native-firebase` version you're using that has this issue:** - `e.g. 5.5.5` - **`Firebase` module(s) you're using that has the issue:** - `Push Notification, Analytics, Remote Config` - **Are you using `TypeScript`?** - `N`

Subway19 commented 5 years ago

react-native-firebase/dist/modules/utils/index.js:27:checkPlayServicesAvailability
react-native-firebase/dist/modules/utils/index.js.flow:39:checkPlayServicesAvailability
react-native-firebase/dist/utils/apps.js:70:checkPlayServicesAvailability
react-native-firebase/dist/utils/apps.js.flow:99:checkPlayServicesAvailability

These are references of checkPlayServicesAvailability in react-native-firebase

stale[bot] commented 5 years ago

Hello đź‘‹, to help manage issues we automatically close stale issues. This issue has been automatically marked as stale because it has not had activity for quite some time. Has this issue been fixed, or does it still require the community's attention?

This issue will be closed in 15 days if no further activity occurs. Thank you for your contributions.

stale[bot] commented 5 years ago

Closing this issue after a prolonged period of inactivity. If this is still present in the latest release, please feel free to create a new issue with up-to-date information.