Gradle Task :react-native-flipper:compileReleaseJavaWithJavac FAILED after update to RN 0.62.2
See original GitHub issueDescription
I upgraded my app from react native 0.59.9 to 0.62.2, and everything seemed to be working fine until I tried to create a release
build of my app for Android. See Gradle output below. To be clear, the debug build for Android works perfectly and I can use Flipper with it. Only the release
build doesn’t work.
I double-checked the Flipper related patches for the 0.59.9 to 0.62.2 using the upgrade-helper and it all matches. I included my MainApplication.java
and android/app/build.gradle
files.
I searched high-and-low for an issue like this involving flipper, but I can’t find anything. Please let me know if you need any additional information. Hopefully one of you can spot the problem.
React Native version:
info Fetching system and libraries information...
System:
OS: macOS 10.15.7
CPU: (8) x64 Intel(R) Core(TM) i7-8559U CPU @ 2.70GHz
Memory: 741.10 MB / 16.00 GB
Shell: 5.8 - /usr/local/bin/zsh
Binaries:
Node: 14.5.0 - ~/.nvm/versions/node/v14.5.0/bin/node
Yarn: Not Found
npm: 6.14.8 - ~/.nvm/versions/node/v14.5.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.9.3 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 14.0, DriverKit 19.0, macOS 10.15, tvOS 14.0, watchOS 7.0
Android SDK:
API Levels: 23, 24, 25, 26, 27, 28, 29
Build Tools: 23.0.1, 25.0.0, 25.0.1, 25.0.2, 26.0.1, 26.0.2, 27.0.3, 28.0.2, 28.0.3, 29.0.0, 29.0.2, 29.0.3, 30.0.1, 30.0.2
System Images: android-19 | Google APIs Intel x86 Atom, android-22 | Google APIs Intel x86 Atom_64, android-23 | Google APIs Intel x86 Atom, android-23 | Google APIs Intel x86 Atom_64, android-25 | Google APIs Intel x86 Atom, android-25 | Google APIs Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom, android-29 | Google APIs Intel x86 Atom, android-30 | Google APIs Intel x86 Atom
Android NDK: Not Found
IDEs:
Android Studio: 4.0 AI-193.6911.18.40.6626763
Xcode: 12.0.1/12A7300 - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_181 - /usr/bin/javac
Python: Not Found
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
Gradle Error and output:
☻ ./gradlew assembleRelease
Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details
> Task :react-native-flipper:compileReleaseJavaWithJavac FAILED
/my-react-native-project/node_modules/react-native-flipper/android/src/main/java/com/facebook/flipper/reactnative/FlipperReactNativeJavaScriptPluginManager.java:10: error: package com.facebook.flipper.android does not exist
import com.facebook.flipper.android.AndroidFlipperClient;
^
/my-react-native-project/node_modules/react-native-flipper/android/src/main/java/com/facebook/flipper/reactnative/FlipperReactNativeJavaScriptPluginManager.java:11: error: package com.facebook.flipper.core does not exist
import com.facebook.flipper.core.FlipperArray;
^
/my-react-native-project/node_modules/react-native-flipper/android/src/main/java/com/facebook/flipper/reactnative/FlipperReactNativeJavaScriptPluginManager.java:12: error: package com.facebook.flipper.core does not exist
import com.facebook.flipper.core.FlipperClient;
^
/my-react-native-project/node_modules/react-native-flipper/android/src/main/java/com/facebook/flipper/reactnative/FlipperReactNativeJavaScriptPluginManager.java:13: error: package com.facebook.flipper.core does not exist
import com.facebook.flipper.core.FlipperObject;
^
/my-react-native-project/node_modules/react-native-flipper/android/src/main/java/com/facebook/flipper/reactnative/FlipperReactNativeJavaScriptPluginManager.java:14: error: package com.facebook.flipper.core does not exist
import com.facebook.flipper.core.FlipperPlugin;
^
/my-react-native-project/node_modules/react-native-flipper/android/src/main/java/com/facebook/flipper/reactnative/FlipperReactNativeJavaScriptPluginManager.java:15: error: package com.facebook.flipper.core does not exist
import com.facebook.flipper.core.FlipperResponder;
^
/my-react-native-project/node_modules/react-native-flipper/android/src/main/java/com/facebook/flipper/reactnative/FlipperReactNativeJavaScriptPluginManager.java:43: error: cannot find symbol
private final FlipperClient mFlipperClient;
^
symbol: class FlipperClient
location: class FlipperReactNativeJavaScriptPluginManager
/my-react-native-project/node_modules/react-native-flipper/android/src/main/java/com/facebook/flipper/reactnative/FlipperReactNativeJavaScriptPluginManager.java:46: error: cannot find symbol
private final Map<String, FlipperResponder> mResponders = new ConcurrentHashMap<>();
^
symbol: class FlipperResponder
location: class FlipperReactNativeJavaScriptPluginManager
/my-react-native-project/node_modules/react-native-flipper/android/src/main/java/com/facebook/flipper/reactnative/FlipperReactNativeJavaScriptPlugin.java:10: error: package com.facebook.flipper.core does not exist
import com.facebook.flipper.core.FlipperConnection;
^
/my-react-native-project/node_modules/react-native-flipper/android/src/main/java/com/facebook/flipper/reactnative/FlipperReactNativeJavaScriptPlugin.java:11: error: package com.facebook.flipper.core does not exist
import com.facebook.flipper.core.FlipperPlugin;
^
/my-react-native-project/node_modules/react-native-flipper/android/src/main/java/com/facebook/flipper/reactnative/FlipperReactNativeJavaScriptPlugin.java:28: error: cannot find symbol
public abstract class FlipperReactNativeJavaScriptPlugin implements FlipperPlugin {
^
symbol: class FlipperPlugin
/my-react-native-project/node_modules/react-native-flipper/android/src/main/java/com/facebook/flipper/reactnative/FlipperReactNativeJavaScriptPluginManager.java:144: error: cannot find symbol
String createResponderId(FlipperResponder responder) {
^
symbol: class FlipperResponder
location: class FlipperReactNativeJavaScriptPluginManager
/my-react-native-project/node_modules/react-native-flipper/android/src/main/java/com/facebook/flipper/reactnative/FlipperReactNativeJavaScriptPlugin.java:31: error: cannot find symbol
private FlipperConnection mConnection;
^
symbol: class FlipperConnection
location: class FlipperReactNativeJavaScriptPlugin
/my-react-native-project/node_modules/react-native-flipper/android/src/main/java/com/facebook/flipper/reactnative/FlipperReactNativeJavaScriptPlugin.java:46: error: cannot find symbol
public void onConnect(FlipperConnection connection) {
^
symbol: class FlipperConnection
location: class FlipperReactNativeJavaScriptPlugin
/my-react-native-project/node_modules/react-native-flipper/android/src/main/java/com/facebook/flipper/reactnative/FlipperReactNativeJavaScriptPlugin.java:73: error: cannot find symbol
FlipperConnection getConnection() {
^
symbol: class FlipperConnection
location: class FlipperReactNativeJavaScriptPlugin
/my-react-native-project/node_modules/react-native-flipper/android/src/main/java/com/facebook/flipper/reactnative/FlipperReactNativeJavaScriptReceiver.java:10: error: package com.facebook.flipper.core does not exist
import com.facebook.flipper.core.FlipperObject;
^
/my-react-native-project/node_modules/react-native-flipper/android/src/main/java/com/facebook/flipper/reactnative/FlipperReactNativeJavaScriptReceiver.java:11: error: package com.facebook.flipper.core does not exist
import com.facebook.flipper.core.FlipperReceiver;
^
/my-react-native-project/node_modules/react-native-flipper/android/src/main/java/com/facebook/flipper/reactnative/FlipperReactNativeJavaScriptReceiver.java:12: error: package com.facebook.flipper.core does not exist
import com.facebook.flipper.core.FlipperResponder;
^
/my-react-native-project/node_modules/react-native-flipper/android/src/main/java/com/facebook/flipper/reactnative/FlipperReactNativeJavaScriptReceiver.java:16: error: cannot find symbol
public class FlipperReactNativeJavaScriptReceiver implements FlipperReceiver {
^
symbol: class FlipperReceiver
/my-react-native-project/node_modules/react-native-flipper/android/src/main/java/com/facebook/flipper/reactnative/FlipperReactNativeJavaScriptReceiver.java:34: error: cannot find symbol
public void onReceive(FlipperObject params, FlipperResponder responder) {
^
symbol: class FlipperObject
location: class FlipperReactNativeJavaScriptReceiver
/my-react-native-project/node_modules/react-native-flipper/android/src/main/java/com/facebook/flipper/reactnative/FlipperReactNativeJavaScriptReceiver.java:34: error: cannot find symbol
public void onReceive(FlipperObject params, FlipperResponder responder) {
^
symbol: class FlipperResponder
location: class FlipperReactNativeJavaScriptReceiver
/my-react-native-project/node_modules/react-native-flipper/android/src/main/java/com/facebook/flipper/reactnative/FlipperReactNativeJavaScriptPluginManager.java:51: error: cannot find symbol
mFlipperClient = AndroidFlipperClient.getInstanceIfInitialized();
^
symbol: variable AndroidFlipperClient
location: class FlipperReactNativeJavaScriptPluginManager
/my-react-native-project/node_modules/react-native-flipper/android/src/main/java/com/facebook/flipper/reactnative/FlipperReactNativeJavaScriptPluginManager.java:77: error: cannot find symbol
final FlipperPlugin plugin =
^
symbol: class FlipperPlugin
location: class FlipperReactNativeJavaScriptPluginManager
/my-react-native-project/node_modules/react-native-flipper/android/src/main/java/com/facebook/flipper/reactnative/FlipperReactNativeJavaScriptPlugin.java:40: error: method does not override or implement a method from a supertype
@Override
^
/my-react-native-project/node_modules/react-native-flipper/android/src/main/java/com/facebook/flipper/reactnative/FlipperReactNativeJavaScriptPlugin.java:45: error: method does not override or implement a method from a supertype
@Override
^
/my-react-native-project/node_modules/react-native-flipper/android/src/main/java/com/facebook/flipper/reactnative/FlipperReactNativeJavaScriptPlugin.java:58: error: method does not override or implement a method from a supertype
@Override
^
/my-react-native-project/node_modules/react-native-flipper/android/src/main/java/com/facebook/flipper/reactnative/FlipperReactNativeJavaScriptPlugin.java:64: error: method does not override or implement a method from a supertype
@Override
^
/my-react-native-project/node_modules/react-native-flipper/android/src/main/java/com/facebook/flipper/reactnative/FlipperReactNativeJavaScriptPluginManager.java:88: error: cannot find symbol
plugin.getConnection().send(method, (FlipperObject) null);
^
symbol: class FlipperObject
location: class FlipperReactNativeJavaScriptPluginManager
/my-react-native-project/node_modules/react-native-flipper/android/src/main/java/com/facebook/flipper/reactnative/FlipperReactNativeJavaScriptPluginManager.java:94: error: cannot find symbol
if (parsedData instanceof FlipperArray) {
^
symbol: class FlipperArray
location: class FlipperReactNativeJavaScriptPluginManager
/my-react-native-project/node_modules/react-native-flipper/android/src/main/java/com/facebook/flipper/reactnative/FlipperReactNativeJavaScriptPluginManager.java:95: error: cannot find symbol
plugin.getConnection().send(method, (FlipperArray) parsedData);
^
symbol: class FlipperArray
location: class FlipperReactNativeJavaScriptPluginManager
/my-react-native-project/node_modules/react-native-flipper/android/src/main/java/com/facebook/flipper/reactnative/FlipperReactNativeJavaScriptPluginManager.java:97: error: cannot find symbol
plugin.getConnection().send(method, (FlipperObject) parsedData);
^
symbol: class FlipperObject
location: class FlipperReactNativeJavaScriptPluginManager
/my-react-native-project/node_modules/react-native-flipper/android/src/main/java/com/facebook/flipper/reactnative/FlipperReactNativeJavaScriptPluginManager.java:117: error: cannot find symbol
final FlipperResponder responder = mResponders.remove(responderId);
^
symbol: class FlipperResponder
location: class FlipperReactNativeJavaScriptPluginManager
/my-react-native-project/node_modules/react-native-flipper/android/src/main/java/com/facebook/flipper/reactnative/FlipperReactNativeJavaScriptPluginManager.java:122: error: cannot find symbol
if (parsedData instanceof FlipperArray) {
^
symbol: class FlipperArray
location: class FlipperReactNativeJavaScriptPluginManager
/my-react-native-project/node_modules/react-native-flipper/android/src/main/java/com/facebook/flipper/reactnative/FlipperReactNativeJavaScriptPluginManager.java:123: error: cannot find symbol
responder.success((FlipperArray) parsedData);
^
symbol: class FlipperArray
location: class FlipperReactNativeJavaScriptPluginManager
/my-react-native-project/node_modules/react-native-flipper/android/src/main/java/com/facebook/flipper/reactnative/FlipperReactNativeJavaScriptPluginManager.java:125: error: cannot find symbol
responder.success((FlipperObject) parsedData);
^
symbol: class FlipperObject
location: class FlipperReactNativeJavaScriptPluginManager
/my-react-native-project/node_modules/react-native-flipper/android/src/main/java/com/facebook/flipper/reactnative/FlipperReactNativeJavaScriptPluginManager.java:131: error: cannot find symbol
final FlipperResponder responder = mResponders.remove(responderId);
^
symbol: class FlipperResponder
location: class FlipperReactNativeJavaScriptPluginManager
/my-react-native-project/node_modules/react-native-flipper/android/src/main/java/com/facebook/flipper/reactnative/FlipperReactNativeJavaScriptPluginManager.java:133: error: cannot find symbol
if (parsedData instanceof FlipperArray) {
^
symbol: class FlipperArray
location: class FlipperReactNativeJavaScriptPluginManager
/my-react-native-project/node_modules/react-native-flipper/android/src/main/java/com/facebook/flipper/reactnative/FlipperReactNativeJavaScriptPluginManager.java:134: error: cannot find symbol
responder.success((FlipperArray) parsedData);
^
symbol: class FlipperArray
location: class FlipperReactNativeJavaScriptPluginManager
/my-react-native-project/node_modules/react-native-flipper/android/src/main/java/com/facebook/flipper/reactnative/FlipperReactNativeJavaScriptPluginManager.java:136: error: cannot find symbol
responder.success((FlipperObject) parsedData);
^
symbol: class FlipperObject
location: class FlipperReactNativeJavaScriptPluginManager
/my-react-native-project/node_modules/react-native-flipper/android/src/main/java/com/facebook/flipper/reactnative/FlipperReactNativeJavaScriptPluginManager.java:160: error: cannot find symbol
return new FlipperArray(new JSONArray(tokener));
^
symbol: class FlipperArray
location: class FlipperReactNativeJavaScriptPluginManager
/my-react-native-project/node_modules/react-native-flipper/android/src/main/java/com/facebook/flipper/reactnative/FlipperReactNativeJavaScriptPluginManager.java:162: error: cannot find symbol
return new FlipperObject(new JSONObject(tokener));
^
symbol: class FlipperObject
location: class FlipperReactNativeJavaScriptPluginManager
/my-react-native-project/node_modules/react-native-flipper/android/src/main/java/com/facebook/flipper/reactnative/FlipperReactNativeJavaScriptReceiver.java:33: error: method does not override or implement a method from a supertype
@Override
^
42 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-flipper:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.0.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 15s
73 actionable tasks: 3 executed, 70 up-to-date
android/app/build.gradle
apply plugin: "com.android.application"
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
import com.android.build.OutputFile
project.ext.react = [
enableHermes: false, // clean and rebuild if changing
]
apply from: "../../node_modules/react-native/react.gradle"
def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false
def jscFlavor = 'org.webkit:android-jsc:+'
def enableHermes = project.ext.react.get("enableHermes", false);
android {
compileSdkVersion rootProject.ext.compileSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "com.nativedigitalmedicmobileapp"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 2
versionName "1.6.0"
multiDexEnabled true
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
}
}
signingConfigs {
debug {
storeFile file('debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
// Caution! In production, you need to generate your own keystore file.
// see https://facebook.github.io/react-native/docs/signed-apk-android.
signingConfig signingConfigs.debug
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:
// https://developer.android.com/studio/build/configure-apk-splits.html
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"])
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+" // From node_modules
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'
}
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)
MainApplication.java
package com.myapp;
import android.app.Application;
import android.content.Context;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
import java.lang.reflect.InvocationTargetException;
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() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
return packages;
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
}
/**
* Loads Flipper in React Native templates. Call this in the onCreate method with something like
* initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
*
* @param context
* @param reactInstanceManager
*/
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.nativedigitalmedicmobileapp.ReactNativeFlipper");
aClass
.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
.invoke(null, context, reactInstanceManager);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Gradle build not working for React Native project after ...
After doing this, I somehow managed to update the Android Gradle Plugin Version to 4.1.3 and Gradle Version to 6.9 under File >...
Read more >Upgrading your build from Gradle 7.x to the latest
When configuring an executable explicitly for JavaCompile or Test tasks, Gradle will now emit an error if this executable does not exist. In...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I believe I ran into the same issue. Did you create a
ReactNativeFlipper.java
file?If so, make sure that file is located in the
project_root/android/app/src/debug
folder and not inproject_root/android/app/src/main
. Flipper should only exist in the debug build not release.I ended up just updating to the latest version at the time (0.63). I find it’s best to just start over with a clean project, install react-native packages one at a time, then copy over the javascript code and debug / test. It’s a pain but works.