React-native-screens: [Android] compileDebugJavaWithJavac

Created on 8 Jul 2019  路  12Comments  路  Source: software-mansion/react-native-screens

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 Starting JS server...
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 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 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 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.```

Most helpful comment

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.

All 12 comments

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

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

thank's a lot, it worked for me. you save my day 馃拑

jetifier is no solution for RN0.59.10, only RN0.60.+ :-(

jetifier is no solution for RN0.59.10, only RN0.60.+ :-(

i use rn version 0.58.6, and it's work..

jetifier is no solution for RN0.59.10, only RN0.60.+ :-(

i use rn version 0.58.6, and it's work..

That doesn't make sense to me. Only RN0.60+ supports AndroidX. Jetifier updates all your node modules to support AndroidX if the modules don't already do so. If it works for you with RN.59.x, I think it will be a "lucky bad workaround". In my opinion the best solution is to try to update the whole project to RN0.60.+.

See also https://github.com/kmagiera/react-native-screens/issues/126#issuecomment-510955622

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

Thanks a lot !! 馃憤

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

This really helped ! Thank you so much !

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.

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.

thank you so much it worked

It looks like the problem has been solved, so I am closing this issue. Feel free to comment if any other problems occur or if I am wrong.

I have this same problem
`> Task :react-native-screens:generateReleaseRFile FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':react-native-screens:generateReleaseRFile'.
    > Could not resolve all files for configuration ':react-native-screens:releaseRuntimeClasspath'.
    > Failed to transform artifact 'material.aar (com.google.android.material:material:1.1.0)' to match attributes {artifactType=android-symbol-with-package-name}.`

@anjara-itendro can you provide a repo with the configuration needed to reproduce it? Also, since no one else submitted such a problem, please make sure it is not a wrong project configuration on your side.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chengsokdara picture chengsokdara  路  3Comments

jeveloper picture jeveloper  路  5Comments

ukasiu picture ukasiu  路  4Comments

beetlebum picture beetlebum  路  5Comments

joshua-augustinus picture joshua-augustinus  路  4Comments