Describe your issue here
When taking release build in android I get the below issue
Task :app:transformClassesAndResourcesWithR8ForDevRelease FAILED
R8: Program type already present: io.invertase.firebase.analytics.BuildConfig
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformClassesAndResourcesWithR8ForDevRelease'.
> com.android.tools.r8.CompilationFailedException: Compilation failed to complete
Click To Expand
#### `package.json`:
{
"name": "project_name",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "react-native start",
"postinstall": "npx jetify",
"temp": "set PACKAGE_VERSION=$(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]') && git tag $PACKAGE_VERSION && git push --tags",
"test": "jest",
"lint": "eslint .",
"clean-android-dev": "cd android && gradlew clean && cd.. ",
"android-dev": "set ENVFILE=.env.dev && npx react-native run-android --no-jetifier --variant=devDebug --appId=com.project_name.app.dev",
"android-dev-release": "set ENVFILE=.env.dev && react-native run-android --variant=devRelease --appId=com.project_name.app.dev",
"android-preprod": "set ENVFILE=.env.preprod && react-native run-android --variant=preprodDebug --appId=com.project_name.app.preprod",
"android-preprod-release": "set ENVFILE=.env.preprod && react-native run-android --variant=preprodRelease --appId=com.project_name.app.preprod",
"android-prod": "set ENVFILE=.env.prod && react-native run-android --variant=prodDebug --appId=com.project_name.app",
"android-prod-release": "set ENVFILE=.env.prod && react-native run-android --variant=prodRelease --appId=com.project_name.app",
"clean-build": "rm -r android/app/src/main/assets/index.android.bundle",
"bundle-android": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle",
"android-build-dev": "set ENVFILE=.env.dev && cd android && gradlew clean && gradlew assembledevRelease",
"android-build-dev-ios": "export ENVFILE=.env.dev && cd android && ./gradlew clean && ./gradlew assembledevRelease",
"android-build-dev-debug-ios": "export ENVFILE=.env.dev && cd android && ./gradlew clean && ./gradlew assembledevDebug",
"android-build-preprod": "set ENVFILE=.env.preprod && cd android && gradlew clean && gradlew assemblepreprodRelease",
"android-build-preprod-ios": "export ENVFILE=.env.preprod && cd android && ./gradlew clean && ./gradlew assemblepreprodRelease",
"android-build-preprod-debug-ios": "export ENVFILE=.env.preprod && cd android && ./gradlew clean && ./gradlew assemblepreprodDebug",
"android-build-prod": "set ENVFILE=.env.prod && cd android && gradlew clean && gradlew assembleprodRelease",
"android-build-prod-ios": "export ENVFILE=.env.prod && cd android && ./gradlew clean && ./gradlew assembleprodRelease",
"android-build-prod-debug-ios": "export ENVFILE=.env.prod && cd android && ./gradlew clean && ./gradlew assembleprodDebug",
"ios-dev-device": "react-native run-ios --configuration Debug --device --scheme project_name-dev",
"ios-dev-release-device": "react-native run-ios --configuration Release --device --scheme project_name-dev",
"ios-preprod-device": "react-native run-ios --configuration Debug --device --scheme project_name-preprod",
"ios-prod-device": "react-native run-ios --configuration Debug --device --scheme project_name-prod",
"ios-generic-dev": "cd ios && xcodebuild -workspace project_name.xcworkspace -scheme project_name-dev -destination generic/platform=iOS build",
"ios-archive-dev": "cd ios && xcodebuild -workspace project_name.xcworkspace -scheme project_name-dev clean archive -configuration release -sdk iphoneos -archivePath $PWD/build/archives/project_name-dev/project_name-dev.xcarchive -UseModernBuildSystem=NO",
"ios-build-dev": "cd ios && xcodebuild -exportArchive -archivePath $PWD/build/archives/project_name-dev/project_name-dev.xcarchive -exportOptionsPlist project_name/build-config/dev/exportOptions.plist -exportPath $PWD/build/ipa/project_name-dev"
},
"dependencies": {
"@react-native-community/art": "^1.2.0",
"@react-native-community/async-storage": "^1.11.0",
"@react-native-community/cameraroll": "^1.3.0",
"@react-native-community/netinfo": "^5.9.2",
"@react-native-community/push-notification-ios": "^1.2.0",
"@react-native-community/slider": "^3.0.0",
"@react-native-firebase/analytics": "^7.1.3",
"@react-native-firebase/app": "^7.2.0",
"@react-native-firebase/auth": "^8.0.4",
"@react-native-firebase/crashlytics": "^7.1.4",
"@react-native-firebase/dynamic-links": "^7.1.3",
"@react-native-firebase/messaging": "^7.1.4",
"@react-native-firebase/remote-config": "^7.1.3",
"@react-native-firebase/storage": "^7.1.3",
"apisauce": "^1.1.1",
"async": "^3.2.0",
"deep-object-diff": "^1.1.0",
"dot-prop-immutable": "^2.1.0",
"getstream": "^4.5.1",
"lodash": "^4.17.15",
"moment": "^2.24.0",
"prop-types": "^15.7.2",
"query-string": "^6.12.1",
"ramda": "^0.26.1",
"react": "16.11.0",
"react-native": "0.62.2",
"react-native-activity-feed": "^0.9.1",
"react-native-add-calendar-event": "3.0.2",
"react-native-animatable": "^1.3.3",
"react-native-app-intro-slider": "^3.0.0",
"react-native-background-color": "0.0.8",
"react-native-base64": "0.0.2",
"react-native-calendar-events": "^1.7.3",
"react-native-calendars": "^1.269.0",
"react-native-collapsible": "^1.4.0",
"react-native-config": "github:luggit/react-native-config#master",
"react-native-contacts": "^5.2.0",
"react-native-create-thumbnail": "^1.2.1",
"react-native-dash": "0.0.11",
"react-native-datepicker": "^1.7.2",
"react-native-device-info": "^5.6.1",
"react-native-document-picker": "^3.4.0",
"react-native-elements": "^2.0.2",
"react-native-fast-image": "^8.1.5",
"react-native-gesture-handler": "^1.6.1",
"react-native-image-crop-picker": "^0.31.1",
"react-native-image-picker": "^2.3.1",
"react-native-image-placeholder": "^1.0.14",
"react-native-image-zoom-viewer": "^3.0.0",
"react-native-keyboard-aware-scroll-view": "^0.8.0",
"react-native-keyboard-spacer": "^0.4.1",
"react-native-linear-gradient": "^2.5.4",
"react-native-loading-spinner-overlay": "^1.0.1",
"react-native-localize": "^1.3.0",
"react-native-masked-text": "^1.12.4",
"react-native-modal": "^9.0.0",
"react-native-modalize": "^2.0.1",
"react-native-notifications": "^3.2.2",
"react-native-orientation": "^3.1.3",
"react-native-paper": "^3.10.1",
"react-native-parsed-text": "0.0.21",
"react-native-platform-stylesheet": "0.0.6",
"react-native-portalize": "^1.0.3",
"react-native-progress": "^4.1.2",
"react-native-push-notification": "^3.4.0",
"react-native-raw-bottom-sheet": "^2.0.2",
"react-native-reanimated": "^1.2.0",
"react-native-safe-area-view": "^0.14.5",
"react-native-screens": "^2.7.0",
"react-native-search-filter": "^0.1.5",
"react-native-simple-toast": "^0.1.1",
"react-native-snap-carousel": "^3.8.4",
"react-native-spinkit": "^1.5.0",
"react-native-splash-screen": "^3.2.0",
"react-native-status-bar-height": "^2.3.1",
"react-native-svg": "^12.1.0",
"react-native-tab-view": "^2.14.0",
"react-native-textinput-effects": "^0.5.1",
"react-native-thumbnail-grid": "^0.3.0",
"react-native-vector-icons": "^6.6.0",
"react-native-video": "v5.1.0-alpha5",
"react-native-video-controls": "^2.6.0",
"react-native-webview": "^7.4.2",
"react-navigation": "^4.0.10",
"react-navigation-redux-helpers": "^3.0.2",
"react-navigation-stack": "^1.10.2",
"react-navigation-tabs": "^2.8.13",
"react-redux": "^7.2.0",
"recompose": "^0.30.0",
"redux": "^4.0.5",
"redux-actions": "^2.6.5",
"redux-logger": "^3.0.6",
"redux-persist": "^5.10.0",
"redux-saga": "^1.1.3",
"redux-thunk": "^2.3.0",
"remote-redux-devtools": "^0.5.16",
"reselect": "^4.0.0",
"rn-fetch-blob": "^0.12.0"
},
"devDependencies": {
"@babel/core": "^7.9.6",
"@babel/runtime": "^7.9.6",
"@react-native-community/eslint-config": "^0.0.5",
"babel-jest": "^26.0.1",
"eslint": "^7.0.0",
"jest": "^26.0.1",
"jetifier": "^1.6.5",
"metro-react-native-babel-preset": "^0.59.0",
"react-native-schemes-manager": "^2.0.0",
"react-test-renderer": "16.11.0"
},
"jest": {
"preset": "react-native"
}
}
#### `firebase.json` for react-native-firebase v6:
{
"react-native": {
"analytics_auto_collection_enabled": true,
"messaging_auto_init_enabled": true,
"messaging_ios_auto_register_for_remote_messages":true
}
}
### Android
#### Have you converted to AndroidX? - [ ] my application is an AndroidX application? - [x] 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`:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
googlePlayServicesVersion = "16.0.0"
}
repositories {
google()
jcenter()
mavenCentral()
maven {
url 'https://maven.google.com'
}
maven {
url "https://www.jitpack.io"
}
maven {
url "https://jitpack.io"
}
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
classpath 'com.google.gms:google-services:4.2.0'
classpath 'com.google.firebase:firebase-plugins:2.0.0'
classpath 'io.fabric.tools:gradle:1.28.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
mavenLocal()
jcenter()
maven {
url "https://maven.google.com"
}
maven {
url "https://jitpack.io"
}
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
url("$rootDir/../node_modules/jsc-android/dist")
}
maven {
url("$rootDir/../node_modules/jsc-android/dist")
}
}
}
subprojects {
afterEvaluate {project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion rootProject.ext.compileSdkVersion
// buildToolsVersion rootProject.ext.buildToolsVersion
}
}
}
}
#### `android/app/build.gradle`:
project.ext.envConfigFiles = [
devdebug:".env.dev",
devrelease:".env.dev",
preprodrelease : ".env.preprod",
prodrelease:".env.prod",
]
apply plugin: "com.android.application"
apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"
apply plugin: 'io.fabric'
crashlytics {
enableNdk true
}
import com.android.build.OutputFile
//import com.google.gms.googleservices.GoogleServicesPlugin
/**
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
* and bundleReleaseJsAndAssets).
* These basically call `react-native bundle` with the correct arguments during the Android build
* cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
* bundle directly from the development server. Below you can see all the possible configurations
* and their defaults. If you decide to add a configuration block, make sure to add it before the
* `apply from: "../../node_modules/react-native/react.gradle"` line.
*
* project.ext.react = [
* // the name of the generated asset file containing your JS bundle
* bundleAssetName: "index.android.bundle",
*
* // the entry file for bundle generation. If none specified and
* // "index.android.js" exists, it will be used. Otherwise "index.js" is
* // default. Can be overridden with ENTRY_FILE environment variable.
* entryFile: "index.android.js",
*
* // whether to bundle JS and assets in debug mode
* bundleInDebug: false,
*
* // whether to bundle JS and assets in release mode
* bundleInRelease: true,
*
* // whether to bundle JS and assets in another build variant (if configured).
* // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
* // The configuration property can be in the following formats
* // 'bundleIn${productFlavor}${buildType}'
* // 'bundleIn${buildType}'
* // bundleInFreeDebug: true,
* // bundleInPaidRelease: true,
* // bundleInBeta: true,
*
* // whether to disable dev mode in custom build variants (by default only disabled in release)
* // for example: to disable dev mode in the staging build type (if configured)
* devDisabledInStaging: true,
* // The configuration property can be in the following formats
* // 'devDisabledIn${productFlavor}${buildType}'
* // 'devDisabledIn${buildType}'
*
* // the root of your project, i.e. where "package.json" lives
* root: "../../",
*
* // where to put the JS bundle asset in debug mode
* jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
*
* // where to put the JS bundle asset in release mode
* jsBundleDirRelease: "$buildDir/intermediates/assets/release",
*
* // where to put drawable resources / React Native assets, e.g. the ones you use via
* // require('./image.png')), in debug mode
* resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
*
* // where to put drawable resources / React Native assets, e.g. the ones you use via
* // require('./image.png')), in release mode
* resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
*
* // by default the gradle tasks are skipped if none of the JS files or assets change; this means
* // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
* // date; if you have any other folders that you want to ignore for performance reasons (gradle
* // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
* // for example, you might want to remove it from here.
* inputExcludes: ["android/**", "ios/**"],
*
* // override which node gets called and with what additional arguments
* nodeExecutableAndArgs: ["node"],
*
* // supply additional arguments to the packager
* extraPackagerArgs: []
* ]
*/
project.ext.react = [
entryFile: "index.js",
bundleAssetName: "index.android.bundle",
bundleInDebug: false,
bundleInDevDebug: false,
bundleInRelease: true,
bundleInDevRelease: true,
bundleInPreprodRelease: true,
bundleInProdRelease: true,
devDisabledInDevRelease: true,
devDisabledInPreprodRelease: true,
devDisabledInProdRelease: true,
enableHermes: false,
// jsBundleDirPreprodRelease: "$buildDir\\intermediates\\merged_assets\\preprodRelease\\mergePreprodReleaseAssets\\out",
// jsBundleDirProdRelease: "$buildDir\\intermediates\\merged_assets\\prodRelease\\mergeProdReleaseAssets\\out",
// jsBundleDirDevRelease: "$buildDir\\intermediates\\merged_assets\\devRelease\\mergeDevReleaseAssets\\out",
root: "../../"
]
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
apply from: "../../node_modules/react-native/react.gradle"
/**
* Set this to true to create two separate APKs instead of one:
* - An APK that only works on ARM devices
* - An APK that only works on x86 devices
* The advantage is the size of the APK is reduced by about 4MB.
* Upload all the APKs to the Play Store and people will download
* the correct one based on the CPU architecture of their device.
*/
def enableSeparateBuildPerCPUArchitecture = false
/**
* Run Proguard to shrink the Java bytecode in release builds.
*/
def enableProguardInReleaseBuilds = true
def jscFlavor = 'org.webkit:android-jsc:+'
def enableHermes = project.ext.react.get("enableHermes", false);
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
flavorDimensions "default"
dexOptions {
javaMaxHeapSize "6G"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "com.project_name.app"
resValue "string", "build_config_package", "com.project_name.app"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
if (project.env.get("APP_VERSION_CODE") != null) { // null for the universal-debug, universal-release variants
versionCode project.env.get("APP_VERSION_CODE").toInteger()
}
versionName project.env.get("APP_VERSION_NAME")
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
}
signingConfigs {
devRelease {
storeFile file(DEV_STORE_FILE)
storePassword DEV_STORE_PASSWORD
keyAlias DEV_KEY_ALIAS
keyPassword DEV_KEY_PASSWORD
}
preProdRelease {
storeFile file(PREPROD_STORE_FILE)
storePassword PREPROD_STORE_PASSWORD
keyAlias PREPROD_KEY_ALIAS
keyPassword PREPROD_KEY_PASSWORD
}
prodRelease {
storeFile file(PROD_STORE_FILE)
storePassword PROD_STORE_PASSWORD
keyAlias PROD_KEY_ALIAS
keyPassword PROD_KEY_PASSWORD
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
}
}
productFlavors {
dev {
dimension "default"
applicationIdSuffix project.env.get("APP_ID_SUFFIX")
productFlavors.dev.signingConfig signingConfigs.devRelease
}
preprod {
dimension "default"
applicationIdSuffix project.env.get("APP_ID_SUFFIX")
productFlavors.preprod.signingConfig signingConfigs.preProdRelease
}
prod {
dimension "default"
applicationIdSuffix project.env.get("APP_ID_SUFFIX")
productFlavors.prod.signingConfig signingConfigs.prodRelease
}
}
buildTypes {
debug {
debuggable true
minifyEnabled false
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
release {
debuggable false
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
packagingOptions {
pickFirst "lib/armeabi-v7a/libc++_shared.so"
pickFirst "lib/arm64-v8a/libc++_shared.so"
pickFirst "lib/x86/libc++_shared.so"
pickFirst "lib/x86_64/libc++_shared.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:
// 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 {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
// debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
// exclude group:'com.facebook.fbjni'
// }
// debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
// exclude group:'com.facebook.flipper'
// }
// debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
// exclude group:'com.facebook.flipper'
// }
implementation project(':react-native-image-crop-picker')
implementation project(':react-native-orientation')
implementation project(':react-native-background-color')
implementation project(':react-native-create-thumbnail')
implementation project(':@react-native-community_art')
implementation project(':react-native-fast-image')
implementation project(':react-native-push-notification')
implementation project(':react-native-reanimated')
implementation project(':react-native-config')
implementation project(':react-native-webview')
implementation 'com.facebook.android:facebook-android-sdk:5.15.3'
implementation project(':react-native-vector-icons')
implementation project(':react-native-gesture-handler')
implementation project(':react-native-contacts')
implementation project(':react-native-linear-gradient')
implementation project(':react-native-spinkit')
implementation project(':react-native-image-picker')
implementation project(':react-native-document-picker')
implementation project(':rn-fetch-blob')
implementation project(':react-native-community-netinfo')
implementation project(':react-native-device-info')
implementation project(':@react-native-community_async-storage')
implementation project(':react-native-splash-screen')
implementation project(':react-native-localize')
implementation project(':@react-native-community_cameraroll')
implementation project(':react-native-video')
implementation project(':react-native-add-calendar-event')
implementation project(':react-native-calendar-events')
implementation "com.facebook.react:react-native:+"
implementation project(':react-native-svg')
implementation "com.google.android.gms:play-services-base:17.3.0"
implementation 'com.facebook.fresco:animated-gif:1.11.0'
implementation 'me.leolin:ShortcutBadger:1.1.22@aar'
implementation('com.crashlytics.sdk.android:crashlytics:2.10.1@aar') {
transitive = true
}
implementation project(path: ":@react-native-firebase_app")
implementation project(path: ":@react-native-firebase_auth")
implementation project(path: ":@react-native-firebase_messaging")
implementation project(path: ":@react-native-firebase_dynamic-links")
implementation project(path: ":@react-native-firebase_config")
implementation project(path: ":@react-native-firebase_analytics")
implementation project(path: ":@react-native-firebase_crashlytics")
implementation project(path: ":@react-native-firebase_storage")
// implementation "com.google.firebase:firebase-invites:17.0.0"
// implementation "com.google.firebase:firebase-config:16.5.0"
implementation "androidx.appcompat:appcompat:1.1.0"
implementation "com.android.support:multidex:1.0.3"
//implementation 'androidx.multidex:multidex:2.0.1'
if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
implementation jscFlavor
}
}
// 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'
}
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
apply plugin: 'com.google.gms.google-services'
//GoogleServicesPlugin.config.disableVersionCheck = true
#### `android/settings.gradle`:
rootProject.name = 'project_name'
include ':react-native-orientation'
project(':react-native-orientation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-orientation/android')
include ':@react-native-community_slider'
project(':@react-native-community_slider').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/slider/android')
include ':react-native-background-color'
project(':react-native-background-color').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-background-color/android')
include ':react-native-video'
project(':react-native-video').projectDir = new File(rootProject.projectDir, '../../../Users/Digisenz11/AppData/Roaming/npm/node_modules/react-native-video/android')
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle");
applyNativeModulesSettingsGradle(settings)
include ':react-native-image-crop-picker'
project(':react-native-image-crop-picker').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-image-crop-picker/android')
include ':react-native-create-thumbnail'
project(':react-native-create-thumbnail').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-create-thumbnail/android')
include ':@react-native-community_art'
project(':@react-native-community_art').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/art/android')
include ':react-native-fast-image'
project(':react-native-fast-image').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fast-image/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-reanimated'
project(':react-native-reanimated').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-reanimated/android')
include ':react-native-config'
project(':react-native-config').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-config/android')
include ':react-native-webview'
project(':react-native-webview').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-webview/android')
include ':react-native-vector-icons'
project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/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-contacts'
project(':react-native-contacts').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-contacts/android')
include ':react-native-linear-gradient'
project(':react-native-linear-gradient').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-linear-gradient/android')
include ':react-native-spinkit'
project(':react-native-spinkit').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-spinkit/android')
include ':react-native-image-picker'
project(':react-native-image-picker').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-image-picker/android')
include ':rn-fetch-blob'
project(':rn-fetch-blob').projectDir = new File(rootProject.projectDir, '../node_modules/rn-fetch-blob/android')
include ':react-native-document-picker'
project(':react-native-document-picker').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-document-picker/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-device-info'
project(':react-native-device-info').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-device-info/android')
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-splash-screen'
project(':react-native-splash-screen').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-splash-screen/android')
include ':react-native-localize'
project(':react-native-localize').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-localize/android')
include ':@react-native-community_cameraroll'
project(':@react-native-community_cameraroll').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/cameraroll/android')
include ':react-native-video'
project(':react-native-video').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-video/android-exoplayer')
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-calendar-events'
project(':react-native-calendar-events').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-calendar-events/android')
include ':@react-native-firebase_app'
project(':@react-native-firebase_app').projectDir = new File(rootProject.projectDir, './../node_modules/@react-native-firebase/app/android')
include ':@react-native-firebase_auth'
project(':@react-native-firebase_auth').projectDir = new File(rootProject.projectDir, './../node_modules/@react-native-firebase/auth/android')
include ':@react-native-firebase_messaging'
project(':@react-native-firebase_messaging').projectDir = new File(rootProject.projectDir, './../node_modules/@react-native-firebase/messaging/android')
include ':@react-native-firebase_dynamic-links'
project(':@react-native-firebase_dynamic-links').projectDir = new File(rootProject.projectDir, './../node_modules/@react-native-firebase/dynamic-links/android')
include ':@react-native-firebase_config'
project(':@react-native-firebase_config').projectDir = new File(rootProject.projectDir, './../node_modules/@react-native-firebase/remote-config/android')
include ':@react-native-firebase_analytics'
project(':@react-native-firebase_analytics').projectDir = new File(rootProject.projectDir, './../node_modules/@react-native-firebase/analytics/android')
include ':@react-native-firebase_crashlytics'
project(':@react-native-firebase_crashlytics').projectDir = new File(rootProject.projectDir, './../node_modules/@react-native-firebase/crashlytics/android')
include ':@react-native-firebase_storage'
project(':@react-native-firebase_storage').projectDir = new File(rootProject.projectDir, './../node_modules/@react-native-firebase/storage/android')
include ':react-native-svg'
project(':react-native-svg').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-svg/android')
include ':app'
#### `MainApplication.java`:
package com.project_name.app;
import android.app.Application;
import android.content.Context;
import com.facebook.CallbackManager;
import com.facebook.react.ReactApplication;
import com.github.yamill.orientation.OrientationPackage;
import com.reactnativecommunity.slider.ReactSliderPackage;
import io.rado.backgroundcolor.BackgroundColorPackage;
import com.brentvatne.react.ReactVideoPackage;
import com.reactnative.ivpusic.imagepicker.PickerPackage;
import com.reactlibrary.createthumbnail.CreateThumbnailPackage;
import com.reactnativecommunity.art.ARTPackage;
import com.dylanvann.fastimage.FastImageViewPackage;
import com.dieam.reactnativepushnotification.ReactNativePushNotificationPackage;
import com.swmansion.reanimated.ReanimatedPackage;
import com.lugg.ReactNativeConfig.ReactNativeConfigPackage;
import com.reactnativecommunity.netinfo.NetInfoPackage;
import com.reactnativecommunity.webview.RNCWebViewPackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import com.oblador.vectoricons.VectorIconsPackage;
import com.rt2zz.reactnativecontacts.ReactNativeContacts;
import com.swmansion.gesturehandler.react.RNGestureHandlerPackage;
import com.facebook.react.ReactInstanceManager;
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
import java.util.List;
import com.react.rnspinkit.RNSpinkitPackage;
import com.BV.LinearGradient.LinearGradientPackage;
import com.imagepicker.ImagePickerPackage;
import com.RNFetchBlob.RNFetchBlobPackage;
import com.learnium.RNDeviceInfo.RNDeviceInfo;
import com.reactnativecommunity.asyncstorage.AsyncStoragePackage;
import com.crashlytics.android.Crashlytics;
import io.fabric.sdk.android.Fabric;
import org.devio.rn.splashscreen.SplashScreenReactPackage;
import com.reactcommunity.rnlocalize.RNLocalizePackage;
import com.reactnativecommunity.cameraroll.CameraRollPackage;
import com.vonovak.AddCalendarEventPackage;
import com.calendarevents.CalendarEventsPackage;
import com.facebook.FacebookSdk;
import com.facebook.appevents.AppEventsLogger;
import io.invertase.firebase.app.ReactNativeFirebaseAppPackage;
import io.invertase.firebase.auth.ReactNativeFirebaseAuthPackage;
import io.invertase.firebase.messaging.ReactNativeFirebaseMessagingPackage;
import io.invertase.firebase.dynamiclinks.ReactNativeFirebaseDynamicLinksPackage;
import io.invertase.firebase.config.ReactNativeFirebaseConfigPackage;
import io.invertase.firebase.analytics.ReactNativeFirebaseAnalyticsPackage;
import io.invertase.firebase.crashlytics.ReactNativeFirebaseCrashlyticsPackage;
import io.invertase.firebase.storage.ReactNativeFirebaseStoragePackage;
import com.horcrux.svg.SvgPackage;
import io.github.elyx0.reactnativedocumentpicker.DocumentPickerPackage;
import androidx.multidex.MultiDexApplication;
public class MainApplication extends MultiDexApplication implements ReactApplication {
private static CallbackManager mCallbackManager = CallbackManager.Factory.create();
protected static CallbackManager getCallbackManager() {
return mCallbackManager;
}
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new OrientationPackage(),
new ReactSliderPackage(),
new BackgroundColorPackage(),
new ReactVideoPackage(),
new PickerPackage(),
new CreateThumbnailPackage(),
new ARTPackage(),
new FastImageViewPackage(),
new ReactNativePushNotificationPackage(),
new ReanimatedPackage(),
new AddCalendarEventPackage(),
new ReactNativeConfigPackage(),
new RNCWebViewPackage(),
new NetInfoPackage(),
new CalendarEventsPackage(),
new RNSpinkitPackage(),
new LinearGradientPackage(),
new ReactNativeFirebaseAppPackage(),
new ReactNativeFirebaseAuthPackage(),
new ReactNativeFirebaseMessagingPackage(),
new ReactNativeFirebaseDynamicLinksPackage(),
new ReactNativeFirebaseConfigPackage(),
new ReactNativeFirebaseAnalyticsPackage(),
new ReactNativeFirebaseCrashlyticsPackage(),
new ReactNativeFirebaseStoragePackage(),
new VectorIconsPackage(),
new RNGestureHandlerPackage(),
new ReactNativeContacts(),
new ImagePickerPackage(),
new RNDeviceInfo(),
new RNFetchBlobPackage(),
new AsyncStoragePackage(),
new RNLocalizePackage(),
new SplashScreenReactPackage(),
new CameraRollPackage(),
new SvgPackage()
);
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
FacebookSdk.sdkInitialize(getApplicationContext());
AppEventsLogger.activateApp(this);
Fabric.with(this, new Crashlytics());
SoLoader.init(this, /* native exopackage */ false);
// initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
}
// private static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
// if (BuildConfig.DEBUG) {
// try {
// /*
// We use reflection here to pick up the class that initializes Flipper,
// since Flipper library is not available in release mode
// */
// Class<?> aClass = Class.forName("com.project_name.app.ReactNativeFlipper");
// aClass.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class).invoke(null, context, reactInstanceManager);
// } catch (ClassNotFoundException e) {
// e.printStackTrace();
// } catch (NoSuchMethodException e) {
// } catch (IllegalAccessException e) {
// } catch (InvocationTargetException e) {
// e.printStackTrace();
// }
// }
// }
}
#### `AndroidManifest.xml`:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.bublenet.app">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION" />
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<application
android:name=".MainApplication"
android:allowBackup="false"
android:exported="true"
android:largeHeap="true"
android:usesCleartextTraffic="true"
android:icon="@mipmap/ic_launcher_round"
android:label="@string/app_name"
android:launchMode="singleTop"
android:roundIcon="@mipmap/ic_launcher_round"
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
<service android:name="io.invertase.firebase.messaging.RNFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:host="app.bublenet.com" android:scheme="http" />
<data android:host="app.bublenet.com" android:scheme="https" />
<data android:host="bublenet.com" android:scheme="http" />
<data android:host="bublenet.com" android:scheme="https" />
<data android:host="devbublenet.page.link" android:scheme="http" />
<data android:host="devbublenet.page.link" android:scheme="https" />
<data android:host="links.bublenet.com" android:scheme="http" />
<data android:host="links.bublenet.com" android:scheme="https" />
<data android:host="bublenet.page.link" android:scheme="http" />
<data android:host="bublenet.page.link" android:scheme="https" />
</intent-filter>
</service>
<service android:name="io.invertase.firebase.messaging.RNFirebaseInstanceIdService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>
<service android:name="io.invertase.firebase.messaging.RNFirebaseBackgroundMessagingService" />
<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" />
<action android:name="android.intent.action.DOWNLOAD_COMPLETE"/>
</intent-filter>
</receiver>
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="@string/facebook_app_id" />
<!-- <meta-data android:name="com.google.firebase.messaging.default_notification_channel_name"
android:value="@string/default_notification_channel_name"/>
<meta-data
android:name="com.google.firebase.messaging.default_notification_channel_id"
android:value="@string/default_notification_channel_id"/>
<meta-data android:name="com.google.firebase.messaging.default_notification_channel_description"
android:value="@string/default_notification_channel_desc"/>
-->
<meta-data android:name="com.dieam.reactnativepushnotification.notification_channel_name"
android:value="@string/default_notification_channel_name"/>
<meta-data android:name="com.dieam.reactnativepushnotification.notification_channel_description"
android:value="@string/default_notification_channel_desc"/>
<meta-data android:name="com.dieam.reactnativepushnotification.notification_color"
android:resource="@android:color/white"/>
<meta-data
tools:replace="android:value"
android:name="com.google.firebase.messaging.default_notification_channel_id"
android:value="@string/default_notification_channel_id"/>
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/logo" />
<meta-data
android:name="io.fabric.ApiKey"
android:value="d8e0449e009dbcfef495b34c385f61fa7c0e3894" />
<activity android:name="com.facebook.FacebookActivity"
android:configChanges=
"keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="@string/app_name" />
<activity
android:name="com.facebook.CustomTabActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="@string/fb_login_protocol_scheme" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize|uiMode"
android:label="@string/app_name"
android:launchMode="singleTask"
android:screenOrientation="sensor"
android:windowSoftInputMode="adjustPan">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
</manifest>
Click To Expand
**`react-native info` output:**
info Fetching system and libraries information...
(node:22119) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
System:
OS: macOS 10.15.5
CPU: (4) x64 Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
Memory: 222.84 MB / 16.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 14.0.0 - /usr/local/bin/node
Yarn: Not Found
npm: 6.14.5 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.9.3 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 13.5, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
Android SDK:
API Levels: 28, 29
Build Tools: 28.0.3, 29.0.2, 29.0.3
System Images: android-28 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom, android-29 | Intel x86 Atom_64, android-29 | Google APIs Intel x86 Atom
Android NDK: Not Found
IDEs:
Android Studio: 4.0 AI-193.6911.18.40.6514223
Xcode: 11.5/11E608c - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_242 - /usr/bin/javac
Python: 2.7.16 - /usr/bin/python
npmPackages:
@react-native-community/cli: Not Found
react: 16.11.0 => 16.11.0
react-native: 0.62.2 => 0.62.2
npmGlobalPackages:
*react-native*: Not Found
- **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:**
- `react-native-firebase/app": "^7.2.0`
- **`Firebase` module(s) you're using that has the issue:**
- `react-native-firebase/analytics`
- **Are you using `TypeScript`?**
- `N`
Your react-native upgrade across the 0.59 / 0.60 line leaves much to be desired - those gradle files and Java files are littered with pre-auto-linking items that should be removed, the problem will come from that
Only careful inspection and performance of the transition from manual linking to auto-linking will get you clear
This for instance, is effectively a duplicate of https://github.com/invertase/react-native-firebase/issues/2775
@mikehardy if i remove firebase module from android files i get error that its not linked in android files
Something about your auto-linking conversion is incorrect. If it is that you need those things in gradle to build on android, then gradle auto-link conversion is incorrect specifically. You are most likely missing the lines in gradle that pull in the react-native CLI and apply it so it can do the auto-linking work.
Examine https://react-native-community.github.io/upgrade-helper/?from=0.59.10&to=0.60.0 file android/app/build.gradle line 185
@mikehardy Thanks for your guidelines. I have already added those lines in my android/app/build.gradle, you can see that in my issue description itself i have attached my build.gradle file.
Then why is all the pre-auto-linking stuff there? I can't get through it and say with any certainty what your problem is when your app is RN60+ but is configured like an RN59 app. As stated first:
Your react-native upgrade across the 0.59 / 0.60 line leaves much to be desired - those gradle files and Java files are littered with pre-auto-linking items that should be removed, the problem will come from that
Then if you say
if i remove firebase module from android files i get error that its not linked in android files
That means your Android setup is effectively broken. And it is project specific, it is not related to react-native-firebase. Argue that if you like but your files provide the evidence, I'm just trying to focus your effort so you can move forward
In my case for env:
"@react-native-firebase/app": "^6.0.2",
"@react-native-firebase/messaging": "^6.0.2",
"react": "16.12.0",
"react-native": "0.61.5",
I resolved it by:
implementation project(path: ":@react-native-firebase_messaging")include ':@react-native-firebase_messaging'
project(':@react-native-firebase_messaging').projectDir = new File(rootProject.projectDir, './../node_modules/@react-native-firebase/messaging/android')
gradlew clean@mikehardy I freshly installed @react-native-firebase/app and @react-native-firebase/messaging on RN - 0.62 project, but still getting this error.
Since both of them were autolinked, I dont have any implementation of any of these 2 packages.
Clone this repo, alter this script to reproduce, commit the reproduction and share it here @jsjain https://github.com/mikehardy/rnfbdemo/blob/master/make-demo-v6.sh
Thanks for your kind response, I ran demo.sh, since it fetched latest rn version 0.63, surprisingly its working fine 馃帀 on it.
Thanks for your time and this great library.
You can specify versions like this https://github.com/mikehardy/rnfbdemo/blob/master/make-demo-rn59.sh#L8
I'd put $1 on it working fine with 0.62.2 (what I'm still using and what worked fine until yesterday when 0.63 came out) - I'm pretty sure there is no problem with the module
I never meant to say something is wrong with module,
I tried with version 0.62.2, it seems to be working fine with fresh install, something seems to be wrong in my work folder. not sure why, but for now I have migrated my code to the new folder.
Then why is all the pre-auto-linking stuff there? I can't get through it and say with any certainty what your problem is when your app is RN60+ but is configured like an RN59 app. As stated first:
Your react-native upgrade across the 0.59 / 0.60 line leaves much to be desired - those gradle files and Java files are littered with pre-auto-linking items that should be removed, the problem will come from that
Then if you say
if i remove firebase module from android files i get error that its not linked in android files
That means your Android setup is effectively broken. And it is project specific, it is not related to react-native-firebase. Argue that if you like but your files provide the evidence, I'm just trying to focus your effort so you can move forward
This is indeed true. We have just upgrade our RnFirebase from v5 to v6, the "pre auto-linking" does broken the project setting as we failed to build APK and face the exact same issue. R8: Program type already present: io.invertase.firebase.analytics.BuildConfig
We removed the "pre auto-linking" based on this doc here which guiding you how to do manual linking. LOL, so vice versa it. Hope it helps other who face the same.