Skip to content

Execution failed for task ':react-native-firebase:verifyReleaseResources' #1988

Closed

Description

@mattmajedi

Issue

Hi all, I am new to React Native and React Native Firebase. I manage to develop a simple app which works fine on the emulator for both Android and IOS, I manage to deploy the app onto Apple test flight and test it on couple of IOS devices with no problem. However when I try to release the APK for android using:
./gradlew assembleRelease
I get the error:
Execution failed for task ':react-native-firebase:verifyReleaseResources'.

12:17:34.651 [DEBUG] [org.gradle.execution.taskgraph.DefaultTaskPlanExecutor] Task worker [Thread[Daemon worker Thread 4,5,main]] finished, busy: 0.0 secs, idle: 1 mins 36.223 secs
12:17:34.651 [DEBUG] [org.gradle.execution.taskgraph.DefaultTaskPlanExecutor] Task worker [Thread[Task worker for ':' Thread 5,5,main]] finished, busy: 0.0 secs, idle: 1 mins 36.223 secs
12:17:34.652 [DEBUG] [org.gradle.internal.progress.DefaultBuildOperationExecutor] Completing Build operation 'Run tasks'12:17:34.654 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
12:17:34.654 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
12:17:34.654 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
12:17:34.654 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
12:17:34.654 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Execution failed for task ':react-native-firebase:verifyReleaseResources'.
12:17:34.654 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
12:17:34.654 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   Output:  E:\Users\Matt Majedi\Documents\Dev\ReactNative\scoresafeapprn\node_modules\react-native-firebase\android\build\intermediates\res\merged\release\values-v28\values-v28.xml:7: error: resource android:attr/dialogCornerRadius not found.
12:17:34.654 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   E:\Users\Matt Majedi\Documents\Dev\ReactNative\scoresafeapprn\node_modules\react-native-firebase\android\build\intermediates\res\merged\release\values-v28\values-v28.xml:11: error: resource android:attr/dialogCornerRadius not found.
12:17:34.655 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   E:\Users\Matt Majedi\Documents\Dev\ReactNative\scoresafeapprn\node_modules\react-native-firebase\android\build\intermediates\res\merged\release\values\values.xml:958: error: resource android:attr/fontVariationSettings not found.
12:17:34.655 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   E:\Users\Matt Majedi\Documents\Dev\ReactNative\scoresafeapprn\node_modules\react-native-firebase\android\build\intermediates\res\merged\release\values\values.xml:959: error: resource android:attr/ttcIndex not found.
12:17:34.655 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   error: failed linking references.
12:17:34.687 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   Daemon:  AAPT2 aapt2-3.2.0-4818971-windows Daemon #0
12:17:34.687 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
12:17:34.687 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Try:
12:17:34.687 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Run with --stacktrace option to get the stack trace.  Run with --scan to get full insights.
12:17:34.687 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
12:17:34.687 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Get more help at https://help.gradle.org12:17:34.687 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger]
12:17:34.687 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger] BUILD FAILED in 1m 38s
12:17:34.687 [LIFECYCLE] [org.gradle.internal.buildevents.BuildResultLogger] 56 actionable tasks: 53 executed, 3 up-to-date
12:17:34.687 [INFO] [org.gradle.api.Project] AAPT2 aapt2-3.2.0-4818971-windows Daemon #0: shutdown
12:17:34.688 [DEBUG] [org.gradle.internal.work.DefaultWorkerLeaseService] Worker lease root.1 completed (0 worker(s) in use)
12:17:34.688 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Daemon worker Thread 4: released lock on root.1
12:17:34.688 [DEBUG] [org.gradle.internal.progress.DefaultBuildOperationExecutor] Completing Build operation 'Run build'12:17:34.692 [INFO] [org.gradle.api.Project] AAPT2 aapt2-3.2.0-4818971-windows Daemon #1: shutdown
12:17:34.692 [DEBUG] [org.gradle.cache.internal.LockOnDemandCrossProcessCacheAccess] Releasing file lock for file content cache (E:\Users\Matt Majedi\Documents\Dev\ReactNative\scoresafeapprn\android\.gradle\4.6\fileContent)
12:17:34.692 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on file content cache (E:\Users\Matt Majedi\Documents\Dev\ReactNative\scoresafeapprn\android\.gradle\4.6\fileContent).
12:17:34.695 [DEBUG] [org.gradle.cache.internal.LockOnDemandCrossProcessCacheAccess] Releasing file lock for task history cache (E:\Users\Matt Majedi\Documents\Dev\ReactNative\scoresafeapprn\android\.gradle\4.6\taskHistory)
12:17:34.695 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Closing cache taskHistory.bin (E:\Users\Matt Majedi\Documents\Dev\ReactNative\scoresafeapprn\android\.gradle\4.6\taskHistory\taskHistory.bin)
12:17:34.696 [INFO] [org.gradle.api.Project] AAPT2 aapt2-3.2.0-4818971-windows Daemon #2: shutdown
12:17:34.700 [INFO] [org.gradle.api.Project] AAPT2 aapt2-3.2.0-4818971-windows Daemon #3: shutdown
12:17:34.701 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on task history cache (E:\Users\Matt Majedi\Documents\Dev\ReactNative\scoresafeapprn\android\.gradle\4.6\taskHistory).
12:17:34.703 [INFO] [org.gradle.api.Project] AAPT2 aapt2-3.2.0-4818971-windows Daemon #4: shutdown
12:17:34.705 [DEBUG] [org.gradle.cache.internal.LockOnDemandCrossProcessCacheAccess] Releasing file lock for Build Output Cleanup Cache (E:\Users\Matt Majedi\Documents\Dev\ReactNative\scoresafeapprn\android\.gradle\buildOutputCleanup)
12:17:34.706 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Closing cache outputFiles.bin (E:\Users\Matt Majedi\Documents\Dev\ReactNative\scoresafeapprn\android\.gradle\buildOutputCleanup\outputFiles.bin)
12:17:34.707 [INFO] [org.gradle.api.Project] AAPT2 aapt2-3.2.0-4818971-windows Daemon #5: shutdown
12:17:34.710 [INFO] [org.gradle.api.Project] AAPT2 aapt2-3.2.0-4818971-windows Daemon #6: shutdown
12:17:34.711 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on Build Output Cleanup Cache (E:\Users\Matt Majedi\Documents\Dev\ReactNative\scoresafeapprn\android\.gradle\buildOutputCleanup).
12:17:34.716 [DEBUG] [org.gradle.cache.internal.LockOnDemandCrossProcessCacheAccess] Releasing file lock for Java compile cache (E:\Users\Matt Majedi\Documents\Dev\ReactNative\scoresafeapprn\android\.gradle\4.6\javaCompile)
12:17:34.716 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Closing cache taskJars.bin (E:\Users\Matt Majedi\Documents\Dev\ReactNative\scoresafeapprn\android\.gradle\4.6\javaCompile\taskJars.bin)
12:17:34.733 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Closing cache taskHistory.bin (E:\Users\Matt Majedi\Documents\Dev\ReactNative\scoresafeapprn\android\.gradle\4.6\javaCompile\taskHistory.bin)
12:17:34.736 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Closing cache jarAnalysis.bin (E:\Users\Matt Majedi\Documents\Dev\ReactNative\scoresafeapprn\android\.gradle\4.6\javaCompile\jarAnalysis.bin)
12:17:34.736 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Closing cache classAnalysis.bin (E:\Users\Matt Majedi\Documents\Dev\ReactNative\scoresafeapprn\android\.gradle\4.6\javaCompile\classAnalysis.bin)
12:17:34.736 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on Java compile cache (E:\Users\Matt Majedi\Documents\Dev\ReactNative\scoresafeapprn\android\.gradle\4.6\javaCompile).
12:17:34.751 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.store.CachedStoreFactory] Resolution result cache closed. Cache reads: 0, disk reads: 0 (avg: 0.0 secs, total: 0.0 secs)
12:17:34.752 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.store.CachedStoreFactory] Resolution result cache closed. Cache reads: 27, disk reads: 27 (avg: 0.0 secs, total: 0.0 secs)
12:17:34.752 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.store.ResolutionResultsStoreFactory] Deleted 4 resolution results binary files in 0.002 secs
12:17:34.753 [DEBUG] [org.gradle.deployment.internal.DefaultDeploymentRegistry] Stopping 0 deployment handles
12:17:34.753 [DEBUG] [org.gradle.deployment.internal.DefaultDeploymentRegistry] Stopped deployment handles
12:17:34.753 [INFO] [org.gradle.cache.internal.DefaultPersistentDirectoryCache] VCS Checkout Cache (E:\Users\Matt Majedi\Documents\Dev\ReactNative\scoresafeapprn\android\.gradle\vcsWorkingDirs) has not been cleaned up in 0 days
12:17:34.753 [DEBUG] [org.gradle.cache.internal.DefaultCacheAccess] Cache VCS Checkout Cache (E:\Users\Matt Majedi\Documents\Dev\ReactNative\scoresafeapprn\android\.gradle\vcsWorkingDirs) was closed 0 times.
12:17:34.754 [DEBUG] [org.gradle.cache.internal.LockOnDemandCrossProcessCacheAccess] Releasing file lock for Artifact transforms cache (C:\Users\mattm\.gradle\caches\transforms-1)
12:17:34.754 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Closing cache results.bin (C:\Users\mattm\.gradle\caches\transforms-1\metadata-1.1\results.bin)
12:17:34.754 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on Artifact transforms cache (C:\Users\mattm\.gradle\caches\transforms-1).
12:17:34.758 [DEBUG] [org.gradle.cache.internal.LockOnDemandCrossProcessCacheAccess] Releasing file lock for file hash cache (E:\Users\Matt Majedi\Documents\Dev\ReactNative\scoresafeapprn\android\.gradle\4.6\fileHashes)
12:17:34.758 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Closing cache fileHashes.bin (E:\Users\Matt Majedi\Documents\Dev\ReactNative\scoresafeapprn\android\.gradle\4.6\fileHashes\fileHashes.bin)
12:17:34.769 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Closing cache resourceHashesCache.bin (E:\Users\Matt Majedi\Documents\Dev\ReactNative\scoresafeapprn\android\.gradle\4.6\fileHashes\resourceHashesCache.bin)
12:17:34.769 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on file hash cache (E:\Users\Matt Majedi\Documents\Dev\ReactNative\scoresafeapprn\android\.gradle\4.6\fileHashes).
12:17:34.772 [DEBUG] [org.gradle.cache.internal.DefaultCacheAccess] Cache Generated Gradle JARs cache (C:\Users\mattm\.gradle\caches\4.6\generated-gradle-jars) was closed 0 times.
12:17:34.773 [DEBUG] [org.gradle.cache.internal.LockOnDemandCrossProcessCacheAccess] Releasing file lock for artifact cache (C:\Users\mattm\.gradle\caches\modules-2)
12:17:34.773 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Closing cache module-metadata.bin (C:\Users\mattm\.gradle\caches\modules-2\metadata-2.53\module-metadata.bin)
12:17:34.773 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Closing cache module-artifact.bin (C:\Users\mattm\.gradle\caches\modules-2\metadata-2.53\module-artifact.bin)
12:17:34.773 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Closing cache module-artifacts.bin (C:\Users\mattm\.gradle\caches\modules-2\metadata-2.53\module-artifacts.bin)
12:17:34.773 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Closing cache module-versions.bin (C:\Users\mattm\.gradle\caches\modules-2\metadata-2.53\module-versions.bin)
12:17:34.773 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on artifact cache (C:\Users\mattm\.gradle\caches\modules-2).
12:17:34.776 [DEBUG] [org.gradle.launcher.daemon.server.exec.ExecuteBuild] The daemon has finished executing the build.
12:17:34.827 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientInputForwarder] Dispatching close input message: org.gradle.launcher.daemon.protocol.CloseInput@4d8c9558
12:17:34.827 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 15: dispatching class org.gradle.launcher.daemon.protocol.CloseInput
12:17:34.827 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClient] Received result Failure[value=org.gradle.initialization.ReportedException: org.gradle.internal.exceptions.LocationAwareException: Execution failed for task ':react-native-firebase:verifyReleaseResources'.] from daemon DaemonInfo{pid=2776, address=[ed35cb90-daf7-4002-8a74-07e793a9b082 port:50914, addresses:[/127.0.0.1, /0:0:0:0:0:0:0:1]], state=Idle, lastBusy=1552910423041, context=DefaultDaemonContext[uid=e5e8886a-60a1-43b7-b0fe-d1327c8a32c3,javaHome=C:\Program Files\Java\jdk1.8.0_181,daemonRegistryDir=C:\Users\mattm\.gradle\daemon,pid=2776,idleTimeout=10800000,daemonOpts=-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=windows-1252,-Duser.country=GB,-Duser.language=en,-Duser.variant]} (build should be done).
12:17:34.827 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 1: dispatching class org.gradle.launcher.daemon.protocol.Finished
12:17:34.828 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 1: connection stop

Project Files

iOS

ios/Podfile:

  • I'm not using Pods
  • I'm using Pods and my Podfile looks like:
# N/A

AppDelegate.m:

// N/A

Android

android/build.gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "27.0.3"
        minSdkVersion = 16
        compileSdkVersion = 27
        targetSdkVersion = 26
        supportLibVersion = "27.1.1"
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.0'
        classpath 'com.google.gms:google-services:4.0.1'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

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


task wrapper(type: Wrapper) {
    gradleVersion = '4.4'
    distributionUrl = distributionUrl.replace("bin", "all")
}

android/app/build.gradle:

apply plugin: "com.android.application"

import com.android.build.OutputFile

project.ext.react = [
    entryFile: "index.js"
]

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

def enableSeparateBuildPerCPUArchitecture = false

/**
 * Run Proguard to shrink the Java bytecode in release builds.
 */
def enableProguardInReleaseBuilds = false

android {
    compileSdkVersion 28
    //buildToolsVersion '28.0.3'
    buildToolsVersion '28.0.3'

    defaultConfig {
        applicationId "com.scoresafeapprn"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
    signingConfigs {
        release {
            //if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
                storeFile file("my-release-key.keystore")
                storePassword ""
                keyAlias "my-key-alias"
                keyPassword ""
            //}
        }
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86"
        }
    }
    buildTypes {
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            signingConfig signingConfigs.release
        }
    }
    // 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]
            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
            }
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_6
        targetCompatibility JavaVersion.VERSION_1_6
    }
}

dependencies {
    implementation project(':react-native-firebase')
    implementation project(':react-native-firebase')
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:+'
    implementation 'com.facebook.react:react-native:+'
    // From node_modules
    // Firebase dependencies
    implementation project(':react-native-firebase')
    implementation 'com.google.android.gms:play-services-base:16.0.1'
    implementation 'com.google.firebase:firebase-core:16.0.4'
    implementation 'com.google.firebase:firebase-messaging:17.3.4'
}

// 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 plugin: 'com.google.gms.google-services'

android/settings.gradle:

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

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

include ':app'

MainApplication.java:

package com.scoresafeapprn;

import android.app.Application;

import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;

import com.facebook.react.ReactApplication;
import io.invertase.firebase.RNFirebasePackage;

import io.invertase.firebase.RNFirebasePackage;
import io.invertase.firebase.messaging.RNFirebaseMessagingPackage; // <-- Add this line
import io.invertase.firebase.notifications.RNFirebaseNotificationsPackage; // <-- Add this line

import java.util.Arrays;
import java.util.List;

public class MainApplication extends Application implements ReactApplication {

  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 RNFirebasePackage(),
          new RNFirebaseMessagingPackage(),
          new RNFirebaseNotificationsPackage()
      );
    }

    @Override
    protected String getJSMainModuleName() {
      return "index";
    }
  };

  @Override
  public ReactNativeHost getReactNativeHost() {
    return mReactNativeHost;
  }

  @Override
  public void onCreate() {
    super.onCreate();
    SoLoader.init(this, /* native exopackage */ false);
  }
}

AndroidManifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.scoresafeapprn">

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

    <application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:allowBackup="false"
      android:theme="@style/AppTheme">
      <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" />
        </intent-filter>
      </activity>
      <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
      
  <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.RNFirebaseInstanceIdService">
    <intent-filter>
      <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
    </intent-filter>
  </service>
  <service android:name="io.invertase.firebase.messaging.RNFirebaseBackgroundMessagingService" />

    </application>
</manifest>

Environment

  • Platform that you're experiencing the issue on:
    • Android
  • If known, the version of the platform are you experiencing the issue on:
    • Android API 28
    • Build tool 28.0.3
  • Operating System:
    • Windows, version: 10
  • Build Tools:
    • Android Studio 3.2.1
    • Visual Studio Code
  • React Native version:
    • 0.59.1
  • React Native Firebase library version:
    • 5.2.3
  • Are you using TypeScript?
    • [ X] No
  • Are you using Expo, e.g. ExpoKit?
    • No

Think react-native-firebase is great? Please consider supporting the project with any of the below:

Activity

  1. mattmajedi commented on Mar 24, 2019

    @mattmajedi
    Author

    Any help on this would be much appreciated!

  2. davidwadge commented on Apr 3, 2019

    @davidwadge

    Does removing the duplicate implementation/include in the build.gradle and settings.gradle file make any difference?

    I don't think you need any of that in the settings.gradle file either. You should only need the implementation project(':react-native-firebase') once in the build.gradle to include the dependency (it's included 3 times).

    If that fails, try forcing the version of appcompat to your compiled sdk version rather than using +, e.g:

    implementation 'com.android.support:appcompat-v7:27.0.0'

  3. mattmajedi commented on Apr 3, 2019

    @mattmajedi
    Author

    Thanks @davidwadge , I managed to resolve this. the problem was the inconsistency of compileSdkVersion and buildToolsVersion between the main gradle file and the firebase one. Apparently, this was introduced as part of an upgrade.

    But thanks for your post.

  4. dinesh-fareye commented on Sep 8, 2021

    @dinesh-fareye

    Hi am getting this error.
    Task:@react-native-firebase_messaging:compileDebugJavaWithJavac

        compileSdkVersion = 31
        buildToolsVersion = "30.0.2"
        minSdkVersion = 21
        targetSdkVersion = 31
    
  5. mikehardy commented on Sep 8, 2021

    @mikehardy
    Collaborator

    @dinesh-fareye - commenting on old closed issues (from 2019!) will have no positive result for you. Check our integration demonstrator script https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh for how to integrate the module (and what versions can work...) and if it still is not working please post a new issue with requested details. Thanks!

  6. dev-daud commented on Sep 28, 2021

    @dev-daud

    Hey @dinesh-fareye
    Did you solve this error??
    I've facing this error two

    Hi am getting this error. Task:@react-native-firebase_messaging:compileDebugJavaWithJavac

        compileSdkVersion = 31
        buildToolsVersion = "30.0.2"
        minSdkVersion = 21
        targetSdkVersion = 31
    

    Hi @dinesh-fareye
    Did you solve this error
    i'm facing this error two

  7. mikehardy commented on Sep 28, 2021

    @mikehardy
    Collaborator

    This is a really really old issue @shykhddaud but even if it were on a new issue it would be difficult to help without the full text of the error. A compile failure is usually some sort of inconsistency in the versions either way - if you look at the tests directory here (that's our e2e react-native app) you can see the versions we have in use, perhaps that will help you.

  8. MaheshGawhane11 commented on Jan 14, 2022

    @MaheshGawhane11

    @mikehardy I am getting the same error "Execution failed for task ':react-native-firebase_messaging:compileDebugJavaWithJavac'" after updating the targetSdkVersion =30 to 31.

  9. mikehardy commented on Jan 14, 2022

    @mikehardy
    Collaborator

    If things used to work and you move to API 31 and then android fails, switch to jdk11. Just a guess though, my above comment stands. Old issue here and you don't provide any specific info on your problem.

  10. droplessjordan commented on Jan 31, 2022

    @droplessjordan

    @mikehardy I am getting the same error "Execution failed for task ':react-native-firebase_messaging:compileDebugJavaWithJavac'" after updating the targetSdkVersion =30 to 31.

    Did you manage to fix this? I'm having the same issue

  11. droplessjordan commented on Jan 31, 2022

    @droplessjordan

    Hi am getting this error. Task:@react-native-firebase_messaging:compileDebugJavaWithJavac

        compileSdkVersion = 31
        buildToolsVersion = "30.0.2"
        minSdkVersion = 21
        targetSdkVersion = 31
    

    I'm having the same issue, did you ever manage to fix this?

  12. mikehardy commented on Jan 31, 2022

    @mikehardy
    Collaborator

    Hey @droplessjordan - if you use compile and target SDK version 30, you can use JDK8 and things will work. If you use compile or target SDK version 31 you must upgrade your tools to JDK11 everywhere. It happens frequently that people think they have done that but their gradle build is using an unexpected version of the JDK and still getting 8. All I can say is: update all places to JDK11 and make sure it is actually in use, and in combination with a compile SDK of 31 and a target SDK of 30 (I can't recommend 31 yet unless you test it thoroughly! many modules are still working ot support it) things should work

  13. ARIPRASATH4664 commented on Feb 1, 2022

    @ARIPRASATH4664

    Thanks @mikehardy that was right we can change the compilesdkversion = 30 to 31, and I have made this command run

    brew install --cask adoptopenjdk/openjdk/adoptopenjdk11

    once after this I found issue was resolved.

  14. mikehardy commented on Feb 1, 2022

    @mikehardy
    Collaborator

    Glad that worked!only one wrinkle is that temurin is the cask you want, adoptopenjdk is discontinued and the work continues under temurin name. React-native docs have a PR to update it officially, everything will work the same

  15. 2 remaining items

  16. mikehardy commented on Feb 2, 2022

    @mikehardy
    Collaborator

    Sorry, I don't reproduce anything like this, and my demo script works fine in release mode.

  17. droplessjake commented on Feb 2, 2022

    @droplessjake

    @mikehardy Our solution turned out to be requiring us running the script react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle
    As we found mentioned by someone who was clearly a few days deeper into and more frustrated by the same issue as us.

    This is apparently something that is required by gradle versions > 5 ? Either way no worries, thanks for the help thus far!

  18. mikehardy commented on Feb 2, 2022

    @mikehardy
    Collaborator

    that is not required by gradle > 5, I've been using all versions of gradle v6 through v7 and I do not have to manually run the bundle command, it is not expected that is necessary. I'm on 7.3.3 now for gradle, android gradle plugin 7.1.0

  19. droplessjordan commented on Feb 2, 2022

    @droplessjordan

    @mikehardy that is strange, we're on 7.3.3 and 7.1.0 also. Running the bundle command was the only way we could get a working release version that didn't crash on opening

  20. mikehardy commented on Feb 2, 2022

    @mikehardy
    Collaborator

    @droplessjake my make-demo script actually does a release build of android if you'll check it. Way back during gradle 5 to 6 transition there was some manual bundling needed sometimes (if you search react-native issues list or PRs for "react-native bundle" and mikehardy you'll probably see me in there). So I'm familiar with it sometimes being needed in edge cases etc, but I'm not aware of it being needed at present even for android builds with flavors / dimensions

  21. mikehardy commented on Feb 18, 2022

    @mikehardy
    Collaborator

    @droplessjake / @droplessjordan well dang if I did not bump against your secondary issue myself just now! I was "luckily" building in release mode because I had not altered the template android gradle plugin from it's current default (v7.0.x) to current stable (v7.1.x) and when I tried to do that I received the same "can't load script" crash on app boot where react-native cannot find the bundle in release mode.

    I read through the issue you logged in react-native issues list, and this PR seems to be the ticket to resolve it: react/react-native#33057

    Hopefully it is picked to 0.68 stable prior to launch, but until then it appears android gradle plugin needs to be pinned to the v7.0.x release stream for react-native projects, I do have successful release builds with AGPv7.0.x

  22. narmistar commented on Feb 24, 2022

    @narmistar

    Hi am getting this error. Task:@react-native-firebase_messaging:compileDebugJavaWithJavac

        compileSdkVersion = 31
        buildToolsVersion = "30.0.2"
        minSdkVersion = 21
        targetSdkVersion = 31
    

    Make sure you'r using new jdk version, v11 and above solve the probleme.
    may this be helpful for you and others facing same issue.

  23. hungvu193 commented on Mar 17, 2022

    @hungvu193

    Thanks @mikehardy that was right we can change the compilesdkversion = 30 to 31, and I have made this command run

    brew install --cask adoptopenjdk/openjdk/adoptopenjdk11

    once after this I found issue was resolved.

    I can confirm that this worked for me 👍

  24. mikehardy commented on Mar 17, 2022

    @mikehardy
    Collaborator

    Of course just to make things a little more irritating for everyone (sorry! it is not my fault I swear), "adoptopenjdk" is no longer a live project. But no fear! The same group (Adoptium) is still working hard, they just changed the name, now it's "temurin".

    You don't have to do this now but if you're just updating to 11 now, skip adoptopenjdk and go right to temurin

    The docs on reactnative.dev will be updated soon, but just be aware that you won't get updates for adoptopenjdk anymore and the currently recommended way to install it is:

        brew tap homebrew/cask-versions
        brew install --cask temurin11

    I do the whole "switch from adoptopenjdk to temurin" thing via a script (so my colleagues may run it) and it looks like this:

      export JDK_VERSION_WANTED=11
      export JDK_VERSION_WANTED_FULL=11.0.14
      if [ "$(uname)" == "Darwin" ]; then
        echo "Uninstalling old JDK versions as needed. May generate up to 4 'Error' lines, they are safe to ignore."
        brew uninstall adoptopenjdk8 || true
        brew uninstall adoptopenjdk11 || true
        brew untap adoptopenjdk/openjdk || true
        brew untap AdoptOpenJDK/openjdk || true
        brew cleanup
    
        echo "Installing openjdk$JDK_VERSION_WANTED_FULL via brew on macOS"
        brew tap homebrew/cask-versions
        brew install --cask temurin$JDK_VERSION_WANTED
        if grep adoptopenjdk "$HOME/.bash_profile" > /dev/null 2>&1; then
          sed -i -e s'/adoptopenjdk/temurin/' "$HOME/.bash_profile"
          rm -f "$HOME/.bash_profile??"
        else
          # shellcheck disable=SC2129
          echo "# --- Add JAVA_HOME items" >> "$HOME/.bash_profile"
          echo "JAVA_HOME=/Library/Java/JavaVirtualMachines/temurin-$JDK_VERSION_WANTED.jdk/Contents/Home" >> "$HOME/.bash_profile"
          echo "export JAVA_HOME" >> "$HOME/.bash_profile"
          echo "PATH=\$JAVA_HOME/bin:\$PATH" >> "$HOME/.bash_profile"
          echo "export PATH" >> "$HOME/.bash_profile"
          echo "# --- End add JAVA_HOME items" >> "$HOME/.bash_profile"
        fi
        echo "!!! You will need to start a new Terminal session for $JDK_VERSION_WANTED to be in effect."
        echo "!!! Exit this Terminal, open a new one, and run doctor again..."
        exit 1
      else
        echo "You appear to not have openjdk full version $JDK_VERSION_WANTED_FULL installed, but it is required. Cannot proceed"
        exit 1
      fi
  25. alexander01202 commented on Sep 30, 2022

    @alexander01202

    Hello @mikehardy I am getting the same error:

    Hi am getting this error. Task:@react-native-firebase_messaging:compileDebugJavaWithJavac

        compileSdkVersion = 31
        buildToolsVersion = "30.0.2"
        minSdkVersion = 21
        targetSdkVersion = 31
    

    I already have installed jdk 11 and can verify when I run java -version

    openjdk version "11.0.15" 2022-04-19 LTS
    OpenJDK Runtime Environment Zulu11.56+19-CA (build 11.0.15+10-LTS)
    OpenJDK 64-Bit Server VM Zulu11.56+19-CA (build 11.0.15+10-LTS, mixed mode)
    

    I have equally set the path to my java installation as my environment variable and can verify when I run echo %JAVA_HOME%

    I have been on this error for days now and I don't know what's wrong. I have even given a more detailed question on stackoverflow but no one seems to know the answer ):

    By the way I am using eas (expo) to build the app. I have read your solution and checked my compileSdkversion and targetSdkversion and they are 31 and 30 respectively which falls in line with your solution but it still doesn't work.

  26. alexander01202 commented on Sep 30, 2022

    @alexander01202

    I also do not use brew. Do I need to install it ?

  27. mikehardy commented on Sep 30, 2022

    @mikehardy
    Collaborator

    By the way I am using eas (expo) to build the app

    I don't support Expo, because I do not use Expo myself so I have no idea. I understand from other posts that you have to make sure you specify the correct Expo build image though, or it may or may not have the correct dependencies for you.

    JAVA_HOME environment variable may be correct in your Terminal but may still not be the JDK actually used to compile, depending on tool chain (again, no idea how Expo does it)

    It's clear from your stackoverflow post that you are not using the JDK you think you are using:

    [stderr] An exception has occurred in the compiler (1.8.0_342). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program and the following diagnostic in your report. Thank you.
    

    So you need to figure out how to get the eas build command to use JDK11. That's got to be a common Expo thing, I'd search their forums

  28. alexander01202 commented on Sep 30, 2022

    @alexander01202

    OMG Thank you so much!!!!! I could give you a big hug now if I can. The direction you pointed out totally helped me solve it. With a single google search I found the answer. Although I had already solved it in development mode, I didn't state the fix in production mode in my eas.json.

    Solution:
    I needed to add

    "production": {
      "android": {
        "image" : "ubuntu-18.04-jdk-11-ndk-r19c"
      }
     }
    

    to my eas.json. This is the correct build image. By default, eas uses jdk 8, so it has to specified. Thank you!!!!

  29. Ashishpal438 commented on Dec 5, 2022

    @Ashishpal438

    Updating to adoptopenjdk11 does the task for me.
    I had to update the android/gradle.properties file with : org.gradle.java.home=/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home

  30. mikehardy commented on Dec 5, 2022

    @mikehardy
    Collaborator

    @Ashishpal438

    I had to update the android/gradle.properties file with : org.gradle.java.home=/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home

    This should not be necessary and will cause problems on non-macOS machines. The java you want should be the first java in your PATH - set in the environment and gradle will simply use it. I set JAVA_HOME then on macOS machines pre-pend $JAVA_HOME/Contents/home to my $PATH and that works well, with no operating-system-specific items in gradle.properties

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions