React-native-code-push: Android build fails on 0.46.0

Created on 21 Jun 2017  路  4Comments  路  Source: microsoft/react-native-code-push

Hey there..

I'm trying to figure why my build fails on Android.
Here's the error I receive:

 :react-native-code-push:compileReleaseJavaWithJavac

 :react-native-code-push:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).

 /node_modules/react-native-code-push/android/app/src/main/java/com/microsoft/codepush/react/CodePushNativeModule.java:9: error: cannot find symbol

 import com.facebook.react.ReactApplication;

                          ^

   symbol:   class ReactApplication

   location: package com.facebook.react

 /node_modules/react-native-code-push/android/app/src/main/java/com/microsoft/codepush/react/CodePushNativeModule.java:19: error: cannot find symbol

 import com.facebook.react.modules.core.ChoreographerCompat;

                                       ^

   symbol:   class ChoreographerCompat

   location: package com.facebook.react.modules.core

 /node_modules/react-native-code-push/android/app/src/main/java/com/microsoft/codepush/react/CodePushNativeModule.java:21: error: cannot find symbol

 import com.facebook.react.modules.core.ReactChoreographer;

                                       ^

   symbol:   class ReactChoreographer

   location: package com.facebook.react.modules.core

 /node_modules/react-native-code-push/android/app/src/main/java/com/microsoft/codepush/react/CodePushNativeModule.java:160: error: cannot find symbol

                         instanceManager.recreateReactContextInBackground();

                                        ^

   symbol:   method recreateReactContextInBackground()

   location: variable instanceManager of type ReactInstanceManager

 /node_modules/react-native-code-push/android/app/src/main/java/com/microsoft/codepush/react/CodePushNativeModule.java:197: error: cannot find symbol

         ReactApplication reactApplication = (ReactApplication) currentActivity.getApplication();

         ^

   symbol:   class ReactApplication

   location: class CodePushNativeModule

 /node_modules/react-native-code-push/android/app/src/main/java/com/microsoft/codepush/react/CodePushNativeModule.java:197: error: cannot find symbol

         ReactApplication reactApplication = (ReactApplication) currentActivity.getApplication();

                                              ^

   symbol:   class ReactApplication

   location: class CodePushNativeModule

 /node_modules/react-native-code-push/android/app/src/main/java/com/microsoft/codepush/react/CodePushNativeModule.java:236: error: package ReactChoreographer does not exist

                                     ReactChoreographer.getInstance().postFrameCallback(ReactChoreographer.CallbackType.TIMERS_EVENTS, new ChoreographerCompat.FrameCallback() {

                                                                                                          ^

 /node_modules/react-native-code-push/android/app/src/main/java/com/microsoft/codepush/react/CodePushNativeModule.java:236: error: package ChoreographerCompat does not exist

                                     ReactChoreographer.getInstance().postFrameCallback(ReactChoreographer.CallbackType.TIMERS_EVENTS, new ChoreographerCompat.FrameCallback() {

                                                                                                                                                              ^
 /node_modules/react-native-code-push/android/app/src/main/java/com/microsoft/codepush/react/CodePushNativeModule.java:236: error: cannot find symbol

                                     ReactChoreographer.getInstance().postFrameCallback(ReactChoreographer.CallbackType.TIMERS_EVENTS, new ChoreographerCompat.FrameCallback() {

                                     ^

   symbol: variable ReactChoreographer

 9 errors

 :react-native-code-push:compileReleaseJavaWithJavac FAILED

 FAILURE: Build failed with an exception.

 * What went wrong:

 Execution failed for task ':react-native-code-push:compileReleaseJavaWithJavac'.

 > Compilation failed; see the compiler error output for details.

 BUILD FAILED

 Total time: 20.244 secs

react-native-code-push: 2.1.0.beta
react-native: 0.46.0.rc2

Any ideas would be appreciated.

android compatibility no-repro

Most helpful comment

I had the same problem,

for me, adding the following snippet to codepushs build.gradle fixed it.

allprojects {
    repositories {
        mavenLocal()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
    }
}

All 4 comments

Hi @SudoPlz, thanks for reaching us. Looks weird - this issue has been resolved a long time ago in https://github.com/Microsoft/react-native-code-push/releases/tag/v2.0.1-beta and I can not reproduce it.
I've experienced another compatibility issue and fixed it in https://github.com/Microsoft/react-native-code-push/pull/905

Could you please try to setup fresh project (or remove and reinstall node_modules) and let me know if the issue is still reproduces for you?

Nevermind I think this has to do with the fact that I'm building directly from react-native source (0.46.x) instead of using an npm version of react-native. I now have problems on my local android project as well, so I'm closing this issue for the time being.

I had the same problem,

for me, adding the following snippet to codepushs build.gradle fixed it.

allprojects {
    repositories {
        mavenLocal()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
    }
}

@tizzyapunkt bro, you save my life (y)

Was this page helpful?
0 / 5 - 0 ratings