Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using forked version of react-native 0.43.3 with code-push 2.0.2-beta is causing errors #858

Closed
shrutic opened this issue May 24, 2017 · 15 comments
Assignees

Comments

@shrutic
Copy link

shrutic commented May 24, 2017

Description

I am using a forked version of react-native 0.43.3 with 2.0.2-beta with my project. I have recently started developing on Android and I have started seeing the errors reported in this issue #792 even though I am on RN 43 ( albiet a forked version)

Reproduction

Additional Information

  • react-native-code-push version: 2.0.2-beta
  • react-native version: 0.43.3 ( with some custom fixes inside my fork) . Entry in my package.json
    "react-native": "git://github.com/shrutic/react-native.git#AppExtensionSafe-ReactNative",
  • iOS/Android/Windows version: Android 6.0 on emulator
  • Does this reproduce on a debug build or release build? debug build
  • Does this reproduce on a simulator, or only on a physical device? repros on emulator .

(The more info the faster we will be able to address it!)

@chirag04
Copy link

in our RN fork, we publish the archives for android. It should work then. eg: facebook/react-native@master...4Catalyzer:17_4_6

@shrutic
Copy link
Author

shrutic commented May 24, 2017

Thanks for your response, Chirag.

When I remove the /android/ entry from .gitignore, I don't get any other files added. Seems like I need to compile react-native somehow to generate the archives. Could you let me know how I can do that?


From this link https://facebook.github.io/react-native/docs/android-building-from-source.html , it seems like I need to build react-native from source (as I am using a fork branch of react-native with fixes that are yet to be part of react-native release). So I tried the steps described in the link and got the following error.
image

From this link facebook/react-native#11677, it seems like @chirag04 were able to get the react-native to build from source. Could you let me know why I am hitting this error? I installed NDK using my android studio instead of downloading from the zip file included in the link https://facebook.github.io/react-native/docs/android-building-from-source.html here. I followed your guidance in the facebook/react-native#11677, but still hitting the same error as above.


UPDATE:

Turns out I have to indeed use the older version of Android-NDK listed in the link https://facebook.github.io/react-native/docs/android-building-from-source.html instead of the one that gets installed from Android Studio. That fixed the issues of react-native compilation. Unfortunately, the Code push issues still exist and I have for now removed Code push from our project

@sergey-akhalkov
Copy link
Contributor

Hi @shrutic, thanks for reaching us. I've just tried to set up clean project that uses react-native@0.43.3 and react-native-code-push@2.0.2-beta and it works well for me. So I don't sure about your fork, but official version of RN compiles well with CodePush and I can not see any issues. So could you please try to install official version of react-native@0.43.3 and verify if the issue still reproduces?

@sergey-akhalkov sergey-akhalkov self-assigned this May 25, 2017
@shrutic
Copy link
Author

shrutic commented May 25, 2017

Code push works just fine upon pointing to 0.43.3 version directly but fails with my forked version.

Upon further investigation, I hit similar errors ( Unable to locate symbol ) even after removing codepush from my android project.

Then I found out that as per the react-native documentation, there are additional steps to be followed for android when using a forked version of react-native here Building React native from source for android.

Upon following the above steps, all the "Unable to locate symbol" errors without codepush were resolved. But upon adding codepush, the react-native errors still showed up. So for now, I have removed codepush from our project. I will continue to investigate why these errors are still happening

@sergey-akhalkov
Copy link
Contributor

@shrutic, got it, thanks for the clarification, please let me know if you have any questions.

@sergey-akhalkov
Copy link
Contributor

sergey-akhalkov commented May 31, 2017

@shrutic, closing this for now, please let me know if any changes.

@shrutic
Copy link
Author

shrutic commented Jun 6, 2017

@chirag04 could you help me with how to publish archives from React native fork. I could not find any instructions on how to do that in a fork. All the instructions I can find are how to compile React native android from source.

Would really appreciate your help as this is blocking me from using many third party libraries in Android.

@chirag04
Copy link

chirag04 commented Jun 6, 2017

I don't remember the exact steps but ./gradlew :ReactAndroid:installArchives should do it.

Just follow the steps in this script: https://github.com/facebook/react-native/blob/master/scripts/publish-npm.js

@shrutic
Copy link
Author

shrutic commented Jun 6, 2017

Thanks @chirag04 for the quick response. I tried the command and was able to generate the jar files. I created a new branch in my fork with these jar files checked in and updated my package.json to point to my new file. After "npm install", I still get the "Unable to locate the symbol" errors. I looked at the publish-npm.js and I did not see any additional steps except npm publish. Do I have to do a npm publish against my fork? I am not sure how that would work.

this is the commit I did to my react-native fork shrutic/react-native@b4b0949

image

@chirag04
Copy link

chirag04 commented Jun 6, 2017

@shrutic your fork looks good to me. make sure you are not building from source when switching to your fork. also double check you are install react native from your fork. No need to publish your fork to npm.

@shrutic
Copy link
Author

shrutic commented Jun 6, 2017

@chirag04 I was indeed building from the source in my project where I was using my fork of react-native.
I updated my project to no longer build react-native from source. I also made sure that the react-native installed in node_modules is indeed from my fork ( my iOS version of project does not compile if the code isnt from my fork). But I still get the errors I showed in my earlier message.

Should I make sure that that generated android archive files are also downloaded correctly? Where would they be present in the node_modules?

@chirag04
Copy link

chirag04 commented Jun 6, 2017

somewhere inside: node_modules/react-native/android directory. Also double check this line in your build.gradle: https://github.com/facebook/react-native/blob/master/local-cli/templates/HelloWorld/android/build.gradle#L21

Worst case: i would say it's best to just create a new project and try to replicate the problem with minimum changes. then switch to your fork and see how it goes.

@shrutic
Copy link
Author

shrutic commented Jun 6, 2017

I could not find the android directory under react-native in node_modules. The relevant path that I did find is ... node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react. But I did not find the react-native directory under it where all the generated archives seemed to get placed when I created the PR shrutic/react-native@b4b0949. Does this mean the fork was not correctly downloaded?

I made sure I had the line you specified in my build.gradle.. :( As I mentioned before, I dont get this problem if I point to the facebook's react-native version directly. It happens only when I switch to my fork. I will try to create a new project with my specific third party libraries against my fork and see if that gives any insights.

I had one more question. How come all the archives you generated had a version of 10000 while mine has 0.43.3 ( the react-native version that I made a fork of )?

@chirag04
Copy link

chirag04 commented Jun 6, 2017

you should have files like these in your node_modules/react-native/android/com/facebook/react/react-native.

screen shot 2017-06-06 at 5 14 12 pm

@shrutic
Copy link
Author

shrutic commented Jun 6, 2017

I do not have the directory android in my node_modules/react-native.
This is how I reference my forked branch in my package.json

"react-native": "git://github.com/shrutic/react-native.git#AndroidWorkingTrial",

Am I missing something? Maybe this mode of referencing forks does not download everything?


UPDATE:
Turns out the issue was the package-lock.json that was instroduced in npm 5. I deleted my existing lock file and regenerated it. That downloaded the files as expected. And now my project is also compiling fine.. Thanks a ton for your help @chirag04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants