React-native-navigation: problem in create release apk.

Created on 30 Nov 2018  路  10Comments  路  Source: wix/react-native-navigation

Issue Description

I have a problem in creating release apk . when I use npm run android and react-native run-android
I don't have any problem and simulator run my app but when I use ./gradlew assembleRelease I have a problem. I install step by step from installation guide as far as I know!!
It seems that I have a error on Task :react-native-navigation:compileReactNative51ReleaseJavaWithJavac FAILED.

Steps to Reproduce / Code Snippets / Screenshots

`PS C:\personal\project\dobord\app\challenge-2\Challenge\android> ./gradlew assembleRelease

Configure project :app
WARNING: The option 'android.enableAapt2' is deprecated and should not be used anymore.
Use 'android.enableAapt2=true' to remove this warning.
It will be removed at the end of 2018..
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

Configure project :react-native-navigation
WARNING: The option 'android.enableAapt2' is deprecated and should not be used anymore.
Use 'android.enableAapt2=true' to remove this warning.
It will be removed at the end of 2018..
downloadRobolectricDependencies into C:\personal\project\dobord\app\challenge-2\Challenge\androidbuild\robolectric-3.5.1-dependencies

Configure project :react-native-video
WARNING: The option 'android.enableAapt2' is deprecated and should not be used anymore.
Use 'android.enableAapt2=true' to remove this warning.
It will be removed at the end of 2018..

Task :app:bundleReleaseJsAndAssets
warning: the transform cache was reset.
Loading dependency graph, done.
bundle: Writing bundle output to: C:\personal\project\dobord\app\challenge-2\Challenge\android\appbuild\generated\assets\react\release\index.android.bundle
bundle: Done writing bundle output
bundle: Copying 33 asset files
bundle: Done copying assets

Task :react-native-navigation:compileReactNative57ReleaseJavaWithJavac
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

Task :react-native-video:compileReleaseJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

Task :react-native-navigation:compileReactNative51ReleaseJavaWithJavac FAILED
C:\personal\project\dobord\app\challenge-2\Challengenode_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;
^
symbol: class MeasureSpecProvider
location: package com.facebook.react.uimanager
C:\personal\project\dobord\app\challenge-2\Challengenode_modules\react-native-navigation\lib\android\app\src\reactNative51\java\com\reactnativenavigation\react\SyncUiImplementation.java:9: error: cannot find symbol
import com.facebook.react.uimanager.SizeMonitoringFrameLayout;
^
symbol: class SizeMonitoringFrameLayout
location: package com.facebook.react.uimanager
C:\personal\project\dobord\app\challenge-2\Challengenode_modules\react-native-navigation\lib\android\app\src\reactNative51\java\com\reactnativenavigation\react\SyncUiImplementation.java:12: error: cannot find symbol
import com.facebook.react.uimanager.UIImplementationProvider;
^
symbol: class UIImplementationProvider
location: package com.facebook.react.uimanager
C:\personal\project\dobord\app\challenge-2\Challengenode_modules\react-native-navigation\lib\android\app\src\reactNative51\java\com\reactnativenavigation\react\SyncUiImplementation.java:78: error: cannot find symbol
public void registerRootView(T rootView, int tag, ThemedReactContext context) {
^
symbol: class SizeMonitoringFrameLayout
location: class SyncUiImplementation
C:\personal\project\dobord\app\challenge-2\Challengenode_modules\react-native-navigation\lib\android\app\src\reactNative51\java\com\reactnativenavigation\react\SyncUiImplementation.java:78: error: cannot find symbol
public void registerRootView(T rootView, int tag, ThemedReactContext context) {
^
symbol: class MeasureSpecProvider
location: class SyncUiImplementation
C:\personal\project\dobord\app\challenge-2\Challengenode_modules\react-native-navigation\lib\android\app\src\reactNative51\java\com\reactnativenavigation\react\SyncUiImplementation.java:23: error: cannot find symbol
public static class Provider extends UIImplementationProvider {
^
symbol: class UIImplementationProvider
location: class SyncUiImplementation
C:\personal\project\dobord\app\challenge-2\Challengenode_modules\react-native-navigation\lib\android\app\src\reactNative51\java\com\reactnativenavigation\react\JsDevReloadHandlerFacade.java:7: error: JsDevReloadHandlerFacade is not abstract and does not override abstract method onSuccess(NativeDeltaClient) in DevBundleDownloadListener
public class JsDevReloadHandlerFacade implements DevBundleDownloadListener, NavigationDevBundleDownloadListener {
^
C:\personal\project\dobord\app\challenge-2\Challengenode_modules\react-native-navigation\lib\android\app\src\reactNative51\java\com\reactnativenavigation\react\ReloadHandlerFacade.java:8: error: method does not override or implement a method from a supertype
@Override
^
C:\personal\project\dobord\app\challenge-2\Challengenode_modules\react-native-navigation\lib\android\app\src\main\java\com\reactnativenavigation\react\ReloadHandler.java:3: error: ReloadHandler is not abstract and does not override abstract method onSuccess(NativeDeltaClient) in DevBundleDownloadListener
public class ReloadHandler extends ReloadHandlerFacade implements JsDevReloadHandler.ReloadListener {
^
C:\personal\project\dobord\app\challenge-2\Challengenode_modules\react-native-navigation\lib\android\app\src\reactNative51\java\com\reactnativenavigation\react\DevBundleDownloadListenerAdapter.java:7: error: DevBundleDownloadListenerAdapter is not abstract and does not override abstract method onSuccess(NativeDeltaClient) in DevBundleDownloadListener
public class DevBundleDownloadListenerAdapter implements DevBundleDownloadListener {
^
C:\personal\project\dobord\app\challenge-2\Challengenode_modules\react-native-navigation\lib\android\app\src\reactNative51\java\com\reactnativenavigation\react\DevBundleDownloadListenerAdapter.java:8: error: method does not override or implement a method from a supertype
@Override
^
C:\personal\project\dobord\app\challenge-2\Challengenode_modules\react-native-navigation\lib\android\app\src\reactNative51\java\com\reactnativenavigation\react\NavigationReactNativeHost.java:86: error: cannot find symbol
.setUIImplementationProvider(getUIImplementationProvider())
^
symbol: method getUIImplementationProvider()
location: class NavigationReactNativeHost
C:\personal\project\dobord\app\challenge-2\Challengenode_modules\react-native-navigation\lib\android\app\src\reactNative51\java\com\reactnativenavigation\react\SyncUiImplementation.java:24: error: method does not override or implement a method from a supertype
@Override
^
C:\personal\project\dobord\app\challenge-2\Challengenode_modules\react-native-navigation\lib\android\app\src\reactNative51\java\com\reactnativenavigation\react\SyncUiImplementation.java:29: error: method does not override or implement a method from a supertype
@Override
^
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
14 errors

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':react-native-navigation:compileReactNative51ReleaseJavaWithJavac'.

    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

BUILD FAILED in 2m 34s
79 actionable tasks: 74 executed, 5 up-to-date`


Environment

  • React Native Navigation version: ^2.1.3
  • React Native version: 0.57.4
  • Platform(s) (iOS, Android, or both?): Android

Most helpful comment

@AE0011 added ./gradlew app:assembleRelease instead of ./gradlew assembleRelease. This is working fine for now!

Can anybody explain me what's the difference and why it's working now?

_A little bit context: building my staging app using ./gradlew assembleReleaseStaging worked, however ./gradlew assembleRelease failed. Through Google I stumbled upon this issue_

All 10 comments

this code help me solve my problem.

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") || names.contains("reactNative56") || names.contains("reactNative57WixFork")) {
                        setIgnore(true)
                    }
                }
            }
        }
    }
}

@mahdi-gh1373 , I just ran into the same issue, where did you add this code to? Thanks!

@JohnSmith0602 if you check installation guide https://wix.github.io/react-native-navigation/#/docs/Installing?id=_72-ignore-other-rnn-flavors you should add this code to android/build.gradle. but you should add my code that I write in pre comment.

awesome mahdi...,solved my problem too..:)

Add this in package.json:

"scripts": {
...
    "androidRelease": "cd ./android && ./gradlew app:assembleRelease"
}

then run :
npm run androidRelease

  • Thanx to @bobmulder it should be "androidRelease": "cd ./android && ./gradlew assembleRelease"

@AE0011 I get "outdated" builds with this - anyone else ?

@hugows I'm not sure about your problem however maybe this could help you

First delete these two file from android/app/src/main/assets

index.android.bundle
index.android.bundle.meta

Then run this command: ( It create a new js bundle )

react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res

Then get release

@AE0011 added ./gradlew app:assembleRelease instead of ./gradlew assembleRelease. This is working fine for now!

Can anybody explain me what's the difference and why it's working now?

_A little bit context: building my staging app using ./gradlew assembleReleaseStaging worked, however ./gradlew assembleRelease failed. Through Google I stumbled upon this issue_

@AE0011 added ./gradlew app:assembleRelease instead of ./gradlew assembleRelease. This is working fine for now!

Can anybody explain me what's the difference and why it's working now?

_A little bit context: building my staging app using ./gradlew assembleReleaseStaging worked, however ./gradlew assembleRelease failed. Through Google I stumbled upon this issue_

This worked for me too

Add this in package.json:

"scripts": {
...
    "androidRelease": "cd ./android && ./gradlew app:assembleRelease"
}

then run :
npm run androidRelease

  • Thanx to @bobmulder it should be "androidRelease": "cd ./android && ./gradlew assembleRelease"

Solved my issue as well. Thanks.

Was this page helpful?
0 / 5 - 0 ratings