question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Android] compileDebugJavaWithJavac

See original GitHub issue

Trying to run react-native run-android I get the error below.

I am running react native version 0.59.9.

I have no problems running react-native run-ios.

Any ideas?

info Building and installing the app on the device (cd android && ./gradlew app:installDebug)...

> Configure project :app
Reading env from: .env

> Task :@adobe_react-native-acpaudience:compileDebugJavaWithJavac
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

> Task :@adobe_react-native-acpcampaign:compileDebugJavaWithJavac
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

> Task :@adobe_react-native-acpcore:compileDebugJavaWithJavac
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

> Task :@adobe_react-native-acptarget:compileDebugJavaWithJavac
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

> Task :react-native-device-info:compileDebugJavaWithJavac
Note: /Users/tjung/Dev2/companion-v2-rn/companion/node_modules/react-native-device-info/android/src/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

> Task :react-native-gesture-handler:compileDebugJavaWithJavac
Note: /Users/tjung/Dev2/companion-v2-rn/companion/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

> Task :react-native-screens:compileDebugJavaWithJavac FAILED
/Users/tjung/Dev2/companion-v2-rn/companion/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/ScreenContainer.java:3: error: cannot find symbol
import androidx.annotation.Nullable;
                          ^
  symbol:   class Nullable
  location: package androidx.annotation
/Users/tjung/Dev2/companion-v2-rn/companion/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/ScreenContainer.java:4: error: package androidx.fragment.app does not exist
import androidx.fragment.app.Fragment;
                            ^
/Users/tjung/Dev2/companion-v2-rn/companion/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/ScreenContainer.java:5: error: package androidx.fragment.app does not exist
import androidx.fragment.app.FragmentActivity;
                            ^
/Users/tjung/Dev2/companion-v2-rn/companion/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/ScreenContainer.java:6: error: package androidx.fragment.app does not exist
import androidx.fragment.app.FragmentTransaction;
                            ^
/Users/tjung/Dev2/companion-v2-rn/companion/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/Screen.java:3: error: cannot find symbol
import androidx.annotation.Nullable;
                          ^
  symbol:   class Nullable
  location: package androidx.annotation
/Users/tjung/Dev2/companion-v2-rn/companion/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/Screen.java:4: error: package androidx.fragment.app does not exist
import androidx.fragment.app.Fragment;
                            ^
/Users/tjung/Dev2/companion-v2-rn/companion/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/ScreenContainer.java:27: error: cannot find symbol
  private @Nullable FragmentTransaction mCurrentTransaction;
                    ^
  symbol:   class FragmentTransaction
  location: class ScreenContainer
/Users/tjung/Dev2/companion-v2-rn/companion/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/ScreenContainer.java:82: error: cannot find symbol
  private FragmentActivity findRootFragmentActivity() {
          ^
  symbol:   class FragmentActivity
  location: class ScreenContainer
/Users/tjung/Dev2/companion-v2-rn/companion/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/ScreenContainer.java:108: error: cannot find symbol
  private FragmentTransaction getOrCreateTransaction() {
          ^
  symbol:   class FragmentTransaction
  location: class ScreenContainer
/Users/tjung/Dev2/companion-v2-rn/companion/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/Screen.java:41: error: cannot find symbol
  private final Fragment mFragment;
                ^
  symbol:   class Fragment
  location: class Screen
/Users/tjung/Dev2/companion-v2-rn/companion/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/Screen.java:96: error: cannot find symbol
  protected Fragment getFragment() {
            ^
  symbol:   class Fragment
  location: class Screen
/Users/tjung/Dev2/companion-v2-rn/companion/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/LifecycleHelper.java:3: error: package androidx.lifecycle does not exist
import androidx.lifecycle.Lifecycle;
                         ^
/Users/tjung/Dev2/companion-v2-rn/companion/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/LifecycleHelper.java:4: error: package androidx.lifecycle does not exist
import androidx.lifecycle.LifecycleObserver;
                         ^
/Users/tjung/Dev2/companion-v2-rn/companion/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/LifecycleHelper.java:5: error: package androidx.fragment.app does not exist
import androidx.fragment.app.Fragment;
                            ^
/Users/tjung/Dev2/companion-v2-rn/companion/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/LifecycleHelper.java:17: error: cannot find symbol
  public static @Nullable Fragment findNearestScreenFragmentAncestor(View view) {
                          ^
  symbol:   class Fragment
  location: class LifecycleHelper
/Users/tjung/Dev2/companion-v2-rn/companion/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/LifecycleHelper.java:28: error: cannot find symbol
  private Map<View, Lifecycle> mViewToLifecycleMap = new HashMap<>();
                    ^
  symbol:   class Lifecycle
  location: class LifecycleHelper
/Users/tjung/Dev2/companion-v2-rn/companion/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/LifecycleHelper.java:46: error: cannot find symbol
  public <T extends View & LifecycleObserver> void register(T view) {
                           ^
  symbol:   class LifecycleObserver
  location: class LifecycleHelper
/Users/tjung/Dev2/companion-v2-rn/companion/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/LifecycleHelper.java:55: error: cannot find symbol
  public <T extends View & LifecycleObserver> void unregister(T view) {
                           ^
  symbol:   class LifecycleObserver
  location: class LifecycleHelper
/Users/tjung/Dev2/companion-v2-rn/companion/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/Screen.java:19: error: cannot find symbol
  public static class ScreenFragment extends Fragment {
                                             ^
  symbol:   class Fragment
  location: class Screen
/Users/tjung/Dev2/companion-v2-rn/companion/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/ScreenContainer.java:27: error: cannot find symbol
  private @Nullable FragmentTransaction mCurrentTransaction;
           ^
  symbol:   class Nullable
  location: class ScreenContainer
/Users/tjung/Dev2/companion-v2-rn/companion/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/Screen.java:42: error: cannot find symbol
  private @Nullable ScreenContainer mContainer;
           ^
  symbol:   class Nullable
  location: class Screen
/Users/tjung/Dev2/companion-v2-rn/companion/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/Screen.java:80: error: cannot find symbol
  public void setLayerType(int layerType, @Nullable Paint paint) {
                                           ^
  symbol:   class Nullable
  location: class Screen
/Users/tjung/Dev2/companion-v2-rn/companion/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/Screen.java:88: error: cannot find symbol
  protected void setContainer(@Nullable ScreenContainer mContainer) {
                               ^
  symbol:   class Nullable
  location: class Screen
/Users/tjung/Dev2/companion-v2-rn/companion/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/Screen.java:92: error: cannot find symbol
  protected @Nullable ScreenContainer getContainer() {
             ^
  symbol:   class Nullable
  location: class Screen
/Users/tjung/Dev2/companion-v2-rn/companion/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/Screen.java:35: error: cannot find symbol
                             @Nullable ViewGroup container,
                              ^
  symbol:   class Nullable
  location: class ScreenFragment
/Users/tjung/Dev2/companion-v2-rn/companion/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/Screen.java:36: error: cannot find symbol
                             @Nullable Bundle savedInstanceState) {
                              ^
  symbol:   class Nullable
  location: class ScreenFragment
/Users/tjung/Dev2/companion-v2-rn/companion/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/ScreenContainer.java:98: error: cannot find symbol
    while (!(context instanceof FragmentActivity) && context instanceof ContextWrapper) {
                                ^
  symbol:   class FragmentActivity
  location: class ScreenContainer
/Users/tjung/Dev2/companion-v2-rn/companion/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/ScreenContainer.java:101: error: cannot find symbol
    if (!(context instanceof FragmentActivity)) {
                             ^
  symbol:   class FragmentActivity
  location: class ScreenContainer
/Users/tjung/Dev2/companion-v2-rn/companion/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/ScreenContainer.java:105: error: cannot find symbol
    return (FragmentActivity) context;
            ^
  symbol:   class FragmentActivity
  location: class ScreenContainer
/Users/tjung/Dev2/companion-v2-rn/companion/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/ScreenContainer.java:129: error: cannot find symbol
    FragmentTransaction transaction = getOrCreateTransaction();
    ^
  symbol:   class FragmentTransaction
  location: class ScreenContainer
/Users/tjung/Dev2/companion-v2-rn/companion/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/ScreenContainer.java:130: error: cannot find symbol
    Fragment fragment = screen.getFragment();
    ^
  symbol:   class Fragment
  location: class ScreenContainer
/Users/tjung/Dev2/companion-v2-rn/companion/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/Screen.java:33: error: method does not override or implement a method from a supertype
    @Override
    ^
/Users/tjung/Dev2/companion-v2-rn/companion/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/LifecycleHelper.java:38: error: cannot find symbol
    Fragment parent = findNearestScreenFragmentAncestor(view);
    ^
  symbol:   class Fragment
  location: class LifecycleHelper
/Users/tjung/Dev2/companion-v2-rn/companion/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/LifecycleHelper.java:39: error: cannot find symbol
    if (parent != null && view instanceof LifecycleObserver) {
                                          ^
  symbol:   class LifecycleObserver
  location: class LifecycleHelper
/Users/tjung/Dev2/companion-v2-rn/companion/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/LifecycleHelper.java:40: error: cannot find symbol
      Lifecycle lifecycle = parent.getLifecycle();
      ^
  symbol:   class Lifecycle
  location: class LifecycleHelper
/Users/tjung/Dev2/companion-v2-rn/companion/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/LifecycleHelper.java:41: error: cannot find symbol
      lifecycle.addObserver((LifecycleObserver) view);
                             ^
  symbol:   class LifecycleObserver
  location: class LifecycleHelper
/Users/tjung/Dev2/companion-v2-rn/companion/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/LifecycleHelper.java:56: error: cannot find symbol
    Lifecycle lifecycle = mViewToLifecycleMap.get(view);
    ^
  symbol:   class Lifecycle
  location: class LifecycleHelper
37 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-screens:compileDebugJavaWithJavac'.
> 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 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 8s
103 actionable tasks: 103 executed
error Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
error Command failed: ./gradlew app:installDebug. Run CLI with --verbose flag for more details.```

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:10
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
kennethpdevcommented, Mar 19, 2020

today I encountered this problem with react-native: 0.61.5 with react-native-screens: 2.3.0 and the solution is to upgrade the gradle version to 3.5.2

android/build.gradle

...

dependencies {
  classpath("com.android.tools.build:gradle:3.5.2")
...

The changes were found in the react-native v0.62.0-rc.5. It did work for me after a few hours of finding a solution.

4reactions
Warmachine13commented, Jul 9, 2019

I have this same problem I resolve this using jetifier you can use this tutorial https://github.com/mikehardy/jetifier and everthing will be ok

Read more comments on GitHub >

github_iconTop Results From Across the Web

Execution Failed for task :app:compileDebugJavaWithJavac in ...
Execution Failed for task :app:compileDebugJavaWithJavac in Android Studio · Go to Run -> Edit Configuration -> Gradle -> + Gradle -> Tasks:build, Script ......
Read more >
Fix "Execution Failed for task :app ... - GeeksforGeeks
Fix “Execution Failed for task :app:compileDebugJavaWithJavac” in Android Studio · Method: #1 Try updating your buildToolsVersion to “23.0.
Read more >
Task :app:compileDebugJavaWithJavac FAILED - Cannot run ...
Expected results: Run app on Android emulator (works fine on iOS) Actual results: Error : Task :app:compileDebugJavaWithJavac FAILED Logs ...
Read more >
Execution Failed for task app compileDebugJavaWithJavac in ...
I am developing an Android App in Android Studio. Not quite sure what went wrong. I was successfully building a few days ago....
Read more >
Execution Failed for task :app:compileDebugJavaWithJavac in ...
I was trying to develop an Android app using an Android studio. But it is throwing an error: Error:Execution failed for task ':app:compileDebugJavaWithJavac'....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found