wix / react-native-navigation

A complete native navigation solution for React Native
https://wix.github.io/react-native-navigation/
MIT License
13.04k stars 2.67k forks source link

[v2][Android] Gradle build failed with ./gradlew assembleDebug (all RNN lib flavors ->reactNative51, reactNative55 are build no matter that we have missingDimensionStrategy defined) #3388

Closed sytolk closed 6 years ago

sytolk commented 6 years ago

I have in my defaultConfig missingDimensionStrategy "RNN.reactNativeVersion", "reactNative55" but its appears that in debug build its have both Gradle tasks: generateReactNative55DebugRFile and generateReactNative51DebugRFile

:react-native-navigation:generateReactNative55DebugRFile
:react-native-navigation:generateReactNative55DebugSources
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
:react-native-navigation:compileReactNative55DebugJavaWithJavac
:react-native-navigation:transformClassesAndResourcesWithPrepareIntermediateJarsForReactNative55Debug
:react-native-navigation:generateReactNative51DebugRFile
:react-native-navigation:generateReactNative51DebugSources
/home/stanimir/structmedia/fuelapp/FuelApp/node_modules/react-native-navigation/lib/android/app/src/reactNative51/java/com/reactnativenavigation/react/SyncUiImplementation.java:8: error: cannot find symbol
import com.facebook.react.uimanager.MeasureSpecProvider;
                                   ^

If I start react-native run-android --variant debug build success too. build failed only with:

cd /android
./gradlew assembleDebug
guyca commented 6 years ago

Hey @sytolk Did you add missingDimensionStrategy as described in step 3 in the installation guide?

sytolk commented 6 years ago

Yes I have missingDimensionStrategy I have applicationIdSuffix ".debug" in my project. Maybe this is the reason..

buildTypes {
        debug {
            minifyEnabled false
            applicationIdSuffix ".debug"
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro", "proguard-devsupport.pro"
            testProguardFile 'proguard-debug.pro'
        }

"dependencies": { "react": "16.3.2", "react-native": "0.56.0-rc.2", "react-native-navigation": "^2.0.2359",

sytolk commented 6 years ago

@guyca adding variantFilter to project dir build.gradle fix Gradle build. Maybe its good idea to write this in Documentation ?

If you have in package.json RN 0.56 it's need to exclude reactNative51 and reactNative55 flavors like:

subprojects { subproject ->
    afterEvaluate {
        if ((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
            android {
                variantFilter { variant ->
                    def names = variant.flavors*.name
                    // To check for a certain build type, use variant.buildType.name == "<buildType>"
                    if (names.contains("reactNative51") || names.contains("reactNative55")) {
                        // Gradle ignores any variants that satisfy the conditions above.
                        setIgnore(true)
                    }
                }
            }
        }
    }
}
traxx10 commented 6 years ago

@sytolk Please show me your gradle.build file

sytolk commented 6 years ago

https://pastebin.com/a1LpwSLF

gabrielvcbessa commented 6 years ago

Mine is fails on ./gradlew assembleRelease, as discribed on #3317, but succeds with react-native run-android --variant=release.

I am using RNN 2.0.2377 with react-native 0.55.4.

BurnedChris commented 6 years ago

having this problem too on;

"react-native": "0.56.0-rc.3",
"react-native-navigation": "^2.0.2380"
gabrielvcbessa commented 6 years ago

@Burnsy Follow this https://github.com/wix/react-native-navigation/issues/3388#issuecomment-399071604

jonasmedeiros commented 6 years ago

I had this error and the problem is at this line

missingDimensionStrategy "RNN.reactNativeVersion", "reactNative51" // <- See note below for further instruction regarding compatibility with other React Native versions

For you @gabrielvcbessa should be reactNative55 so need to fix the version of react native to fix the error

sytolk commented 6 years ago

:) For you @jonasmedeiros there is not reactNative56 in flavors: https://github.com/wix/react-native-navigation/tree/v2/lib/android/app/src

reactNative55 build variant means after RN v.55+ versions

jonasmedeiros commented 6 years ago

@sytolk just fixed my answer

sytolk commented 6 years ago

@jonasmedeiros under certain circumstances like additional Gradle buildTypes applicationIdSuffix.. if you run ./gradlew assembleRelease all RNN lib flavors (reactNative51, reactNative55) are build no matter that we have missingDimensionStrategy defined.

phdang commented 6 years ago

@sytolk It works but I have no idea why. Thank you. Hope RRN will update their docs soon.

gabrielhpugliese commented 6 years ago

Where exactly should I add the snippet that @sytolk posted? I added to app/build.gradle but I don't think it's there.

gabrielhpugliese commented 6 years ago

Oh it's in the android/build.gradle file, got it. Still had to add to ignore reactNative56: if (names.contains("reactNative51") || names.contains("reactNative56")) { Otherwise:

*What went wrong:
Execution failed for task ':react-native-navigation:compileReactNative56DebugJavaWithJavac'
mths0x5f commented 6 years ago

Well, thank you for the snippet, @sytolk!

This really should be in the documentation.

billel-boudchicha commented 6 years ago

thank you @sytolk

herarya commented 6 years ago

1+ same still not work @sytolk

"react-native": "0.56.0", "react-native-navigation": "alpha"

sytolk commented 6 years ago

@herarya have you read this: https://github.com/wix/react-native-navigation/blob/v2/docs/docs/Installing.md#23-compiling-the-correct-build-flavor

herarya commented 6 years ago

@sytolk thanks work after downgrade

"react-native": "0.56.0",
"react-native-navigation": "^2.0.2427",
steve-allan commented 6 years ago

I've tried to install RNN several times now on a Mac and 2 windows machines. Currently running react-native 0.56.1 RNN 2.0.2427

Whether I use 55 or 56, and change the files appropriately, I always get a version of "compileReactNative55DebugJavaWithJavac".

I've checked all paths to make sure they're correct. Is there a definitive answer for this? I getting pretty down on RNN at this point (many hours wasted).

traxx10 commented 6 years ago

i had the same issue too, i had to downgrade to version 51

On Tue, Sep 11, 2018 at 4:40 AM steve-allan notifications@github.com wrote:

I've tried to install RNN several times now on a Mac and 2 windows machines. Currently running react-native 0.56.1 RNN 2.0.2427

Whether I use 55 or 56, and change the files appropriately, I always get a version of "compileReactNative55DebugJavaWithJavac".

I've checked all paths to make sure they're correct. Is there a definitive answer for this? I getting pretty down on RNN at this point (many hours wasted).

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/wix/react-native-navigation/issues/3388#issuecomment-420136005, or mute the thread https://github.com/notifications/unsubscribe-auth/AeGnxG6AixpkPXUYqNb5ysI4mRWBGc52ks5uZzCQgaJpZM4UthBQ .

steve-allan commented 6 years ago

Thanks Traxx10, But still no luck. Don't mean to sound bitter Wix but I'm out, way too much time wasted.

bhaveshrao96 commented 5 years ago

I have in my defaultConfig missingDimensionStrategy "RNN.reactNativeVersion", "reactNative55" but its appears that in debug build its have both Gradle tasks: generateReactNative55DebugRFile and generateReactNative51DebugRFile

:react-native-navigation:generateReactNative55DebugRFile
:react-native-navigation:generateReactNative55DebugSources
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
:react-native-navigation:compileReactNative55DebugJavaWithJavac
:react-native-navigation:transformClassesAndResourcesWithPrepareIntermediateJarsForReactNative55Debug
:react-native-navigation:generateReactNative51DebugRFile
:react-native-navigation:generateReactNative51DebugSources
/home/stanimir/structmedia/fuelapp/FuelApp/node_modules/react-native-navigation/lib/android/app/src/reactNative51/java/com/reactnativenavigation/react/SyncUiImplementation.java:8: error: cannot find symbol
import com.facebook.react.uimanager.MeasureSpecProvider;
                                   ^

If I start react-native run-android --variant debug build success too. build failed only with:

cd /android
./gradlew assembleDebug

A problem occurred evaluating project ':app'. > Could not find method missingDimensionStrategy() for arguments [RNN.reactNativ eVersion, reactNative56] on ProductFlavor_Decorated{name=main, dimension=null, m inSdkVersion=DefaultApiVersion{mApiLevel=19, mCodename='null'}, targetSdkVersion =DefaultApiVersion{mApiLevel=26, mCodename='null'}, renderscriptTargetApi=null, renderscriptSupportModeEnabled=null, renderscriptSupportModeBlasEnabled=null, re nderscriptNdkModeEnabled=null, versionCode=null, versionName=null, applicationId =com.newproject, testApplicationId=null, testInstrumentationRunner=null, testIns trumentationRunnerArguments={}, testHandleProfiling=null, testFunctionalTest=nul l, signingConfig=null, resConfig=null, mBuildConfigFields={}, mResValues={}, mPr oguardFiles=[], mConsumerProguardFiles=[], mManifestPlaceholders={}, mWearAppUnb undled=null} of type com.android.build.gradle.internal.dsl.ProductFlavor. * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output

Please slove this error

bhaveshrao96 commented 5 years ago

A problem occurred evaluating project ':app'. > Could not find method missingDimensionStrategy() for arguments [RNN.reactNativ eVersion, reactNative56] on ProductFlavor_Decorated{name=main, dimension=null, m inSdkVersion=DefaultApiVersion{mApiLevel=19, mCodename='null'}, targetSdkVersion =DefaultApiVersion{mApiLevel=26, mCodename='null'}, renderscriptTargetApi=null, renderscriptSupportModeEnabled=null, renderscriptSupportModeBlasEnabled=null, re nderscriptNdkModeEnabled=null, versionCode=null, versionName=null, applicationId =com.newproject, testApplicationId=null, testInstrumentationRunner=null, testIns trumentationRunnerArguments={}, testHandleProfiling=null, testFunctionalTest=nul l, signingConfig=null, resConfig=null, mBuildConfigFields={}, mResValues={}, mPr oguardFiles=[], mConsumerProguardFiles=[], mManifestPlaceholders={}, mWearAppUnb undled=null} of type com.android.build.gradle.internal.dsl.ProductFlavor. * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output

Plz Help me with this error