React-native-navigation: Task :react-native-navigation:compileReactNative57_5DebugJavaWithJavac FAILED

Created on 9 Jul 2019  ·  24Comments  ·  Source: wix/react-native-navigation

Issue Description

Getting this error while running 'react-native run-android'
image

Android Studio compiler output:
image

running with 'npm run android':
image

running with 'gradlew app:assembleDebug and gradlew installDegug':
image

I have tried almost everything and not able to set things up, Please someone help.

🏚 stale

Most helpful comment

Try adding

missingDimensionStrategy "RNN.reactNativeVersion", "reactNative60"

subprojects { subproject ->
    afterEvaluate {
        if ((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
            android {
                compileSdkVersion rootProject.ext.compileSdkVersion
                buildToolsVersion rootProject.ext.buildToolsVersion

                variantFilter { variant ->
                    def names = variant.flavors*.name
                    if (
                        names.contains("reactNative51") || 
                        names.contains("reactNative55") || 
                        names.contains("reactNative56") ||
                        names.contains("reactNative57") ||
                        names.contains("reactNative57_5") 
                    ) {
                        setIgnore(true)
                    }
                }
            }
        }
    }
}

All 24 comments

Have you followed installation steps 5 and/or 5.2 correctly? Those are described here:
https://wix.github.io/react-native-navigation/#/docs/Installing?id=android

If you already have done that, can you post here your android/app/build.gradle defaultConfigs android/build.gradle subprojects files?

What's your RN version?

default configs:

def useIntlJsc = false

android {
compileSdkVersion rootProject.ext.compileSdkVersion

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

defaultConfig {
    applicationId "com.project"
    minSdkVersion rootProject.ext.minSdkVersion
    targetSdkVersion rootProject.ext.targetSdkVersion
    missingDimensionStrategy "RNN.reactNativeVersion", "reactNative57_5"
    versionCode 1
    versionName "1.0"
}

image

subprojects file:

subprojects { subproject ->
afterEvaluate {
if ((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
android {
variantFilter { variant ->
def names = variant.flavors*.name
if (names.contains("reactNative51") || names.contains("reactNative55")) {
setIgnore(true)
}
}
}
}
}
}
image

I'm using RN 0.60.0
minsdk = 19
targetsdk = 28

image

image

I don't believe that your currently RNN version supports React Native 0.60.
If you want to use RNN I would recommend downgrade to React Native 0.59.10.
You can also check #5228 issue about RNN V3 that will support RN 0.60

that can be the very problem, I'm trying v3 now.

On Wed, Jul 10, 2019 at 2:48 AM Igor Tupini notifications@github.com
wrote:

I don't believe that your currently RNN version supports React Native
0.60.
If you want to use RNN I would recommend downgrade to React Native 0.59.10
.
You can also check #5228
https://github.com/wix/react-native-navigation/issues/5228 issue about
RNN V3 that will support RN 0.60


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/wix/react-native-navigation/issues/5273?email_source=notifications&email_token=ALAPVJAR7PEL4HWDWTH3EOTP6UBS3A5CNFSM4H7ILGC2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZRUL4A#issuecomment-509822448,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ALAPVJGFAZTVEAFQE5RCRSDP6UBS3ANCNFSM4H7ILGCQ
.

problem is still there bro. I think, I should downgrade.
They must release a stable version of RNN for RN 0.6.0, its frustrating that I haven't got any solution for 3 days. well thanks for your support.

problem is still there bro. I think, I should downgrade.
They must release a stable version of RNN for RN 0.6.0, its frustrating that I haven't got any solution for 3 days. well thanks for your support.

V3 still on alpha, so you should expect bugs and other issues.
RN 0.60 was released less than 2 weeks ago, and has changed quite a few things so most libraries still undergoing upgrade process.

Unless you have some real problem that only RN 0.60 will help you I really suggest waiting a little more before upgrading.

Try adding

missingDimensionStrategy "RNN.reactNativeVersion", "reactNative60"

subprojects { subproject ->
    afterEvaluate {
        if ((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
            android {
                compileSdkVersion rootProject.ext.compileSdkVersion
                buildToolsVersion rootProject.ext.buildToolsVersion

                variantFilter { variant ->
                    def names = variant.flavors*.name
                    if (
                        names.contains("reactNative51") || 
                        names.contains("reactNative55") || 
                        names.contains("reactNative56") ||
                        names.contains("reactNative57") ||
                        names.contains("reactNative57_5") 
                    ) {
                        setIgnore(true)
                    }
                }
            }
        }
    }
}

This problem can be solved after removing androidX supporting in gradle.properties:

# Project-wide Gradle settings.

# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.

# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

#android.useAndroidX=true
#android.enableJetifier=true

just remove the two lines :

android.useAndroidX=true
#android.enableJetifier=true

I removed AndroidX, it did not work for me :(

AwesomeScreenshot-Desktop-screenshot-2019-07-11-12-07-18

Have you config the defaultConfig in the build.gradle, may be you should ignore more variants like @jinshin1013 ? And the build variants need to be 57_5 @amdrade

@Frank17, if you look at V3 commits guyca added a new installation instruction which tells us to add 0.60.0 as the build variants if you are using [email protected].. Also shouldn't be removing below I reckon:

android.useAndroidX=true
#android.enableJetifier=true

@jinshin1013 Yeah, I think it will support AndroidX, but if I install react-native-navigation from npm, I can't get the lib like v3, so I removed it.

Try adding

missingDimensionStrategy "RNN.reactNativeVersion", "reactNative60"

subprojects { subproject ->
    afterEvaluate {
        if ((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
            android {
                compileSdkVersion rootProject.ext.compileSdkVersion
                buildToolsVersion rootProject.ext.buildToolsVersion

                variantFilter { variant ->
                    def names = variant.flavors*.name
                    if (
                        names.contains("reactNative51") || 
                        names.contains("reactNative55") || 
                        names.contains("reactNative56") ||
                        names.contains("reactNative57") ||
                        names.contains("reactNative57_5") 
                    ) {
                        setIgnore(true)
                    }
                }
            }
        }
    }
}

For brevity you can do something like : if(variant.flavors*.name.any{it.contains('reactNative5')}){ setIgnore(true) }

most alpha versions don't include reactNative60 directory. Seems like the only one which works on android is v3 alpha.4
I get the same error messages with newer/older alpha versions.

Try adding

missingDimensionStrategy "RNN.reactNativeVersion", "reactNative60"

subprojects { subproject ->
    afterEvaluate {
        if ((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
            android {
                compileSdkVersion rootProject.ext.compileSdkVersion
                buildToolsVersion rootProject.ext.buildToolsVersion

                variantFilter { variant ->
                    def names = variant.flavors*.name
                    if (
                        names.contains("reactNative51") || 
                        names.contains("reactNative55") || 
                        names.contains("reactNative56") ||
                        names.contains("reactNative57") ||
                        names.contains("reactNative57_5") 
                    ) {
                        setIgnore(true)
                    }
                }
            }
        }
    }
}

not getting error with this, but Metro Bundler not starting and manually started Metro Bundler is not connecting to app.

not getting error with this, but Metro Bundler not starting and manually started Metro Bundler is not connecting to app.

downgrade node.js to 12.4

The first bunch of errors you got @bunny100 you can fix them by going to node_modules/react-native-navigation and changing the imports to the AndroidX ones. For example: import android.support.v4.view.ViewPager; to import androidx.viewpager.widget.ViewPager;
Doing this I managed to get the number of errors down. I still haven´t fixed all of the errors, but here are a lot of imports ones.

Its kinda boring to have to fix so many of those errors by hand but this should be fixed on the new version of RNN.

You can try using jetify.

First, install the jetifier using the command yarn add -D jetifier or npm install -D jetifier and then you can run the command npx jetify .

For me, that solved this problem

I did that but it didn´t solve anything, still got those errors.

@cschaffr alpha 8 was working for me, now 11 isn't

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest Detox and report back. Thank you for your contributions.

The issue has been closed for inactivity.

did anyone find a fix for this? Where do i put `subprojects { subproject ->
afterEvaluate {
if ((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion

            variantFilter { variant ->
                def names = variant.flavors*.name
                if (
                    names.contains("reactNative51") || 
                    names.contains("reactNative55") || 
                    names.contains("reactNative56") ||
                    names.contains("reactNative57") ||
                    names.contains("reactNative57_5") 
                ) {
                    setIgnore(true)
                }
            }
        }
    }
}

}`

The variantFilter block logic goes inside android/build.gradle file

The missingDimensionStrategy "RNN.reactNativeVersion", "reactNative60" inside android/app/build.gradle file

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yusufyildirim picture yusufyildirim  ·  53Comments

dozoisch picture dozoisch  ·  35Comments

perrosnk picture perrosnk  ·  36Comments

gtchance picture gtchance  ·  57Comments

diennguyentien picture diennguyentien  ·  59Comments