realm / realm-js

Realm is a mobile database: an alternative to SQLite & key-value stores
https://realm.io
Apache License 2.0
5.62k stars 558 forks source link

[React Native] Add 64 bit support for Android #2221

Closed kneth closed 5 years ago

kneth commented 5 years ago

From August 1, 2019 Google Play will not accept apps with 32 bit only .so files. Currently, we only compile our React Native (Android) .so for ARMv7 and x86, but we should in good time provide 64 bit .so files too.

React Native (Android) added support for ARM64-v8a and x86-64 recently: https://github.com/facebook/react-native/pull/18754.

Reference: https://android-developers.googleblog.com/2019/01/get-your-apps-ready-for-64-bit.html

roberhofer commented 5 years ago

Thanks for raising this, appreciated.

radeno commented 5 years ago

@kneth i do not force to anyone but i think this should be priority. 3 months after first React Native RC version we get support for 0.58 what was big step forward and i really appreciate it and i can says many developers like it and we are thank you for it ♥️. But it was just partial support of RN 0.58 because it brings support for Android ARM 64bit app variations.

And version 0.59 is behind door. This version should be compatible with Realm which will be great, but again, it enabling support even for x86_64. Android platform is involving in RN very quick.

But another great change for RN0.60 (probability is very high) is that it replaces very unfriendly import Xcode libs with Cocoapods. And it will be default for all new projects.

Do you have any plan how to be complatible with RN in very close time when new RN version will be released?

kneth commented 5 years ago

@radeno Thanks for giving us the executive summary of RN roadmap. Every RN version seems to break something, so it is hard to stay on top of it.

We are currently refactoring our code base and upgrading the Android NDK. Once those two tasks are completed, we can begin to look forward. Adding 64 bit support for Android should be trivial. Better Cocoapods support sounds great.

bmunkholm commented 5 years ago

I would also add, that we are very appreciative of PR's :-) and encourage the community to help in any way possible. Even if that's not a PR, making issues with details of upcoming breaking changes is also helpful.

cmelchior commented 5 years ago

Marking as blocked as we are waiting for React Native 0.59 before we can enable this: https://github.com/facebook/react-native/issues/2814#issuecomment-457688789

radeno commented 5 years ago

@cmelchior 0.59-rc3 release is one day old. It is probably last RC before production or will be rc4 with some small fixes. If this commit https://github.com/facebook/react-native/commit/f3e5cce4745c0ad9a5c697be772757a03e15edc5 will not be merged into 0.59 (i hope not, it is too big change for current state) then rc3 is quite solid stable without such big changes before release production.

radeno commented 5 years ago

@cmelchior my mistake. It is already in 0.59. So all big changes with JSI/JNI for Android looks like done.

kneth commented 5 years ago

In https://github.com/facebook/react-native/commit/f3e5cce4745c0ad9a5c697be772757a03e15edc5 React Native is changing to clang and libc++, I suggest that we wait until we have upgraded to a recent Android NDK.

zaguiini commented 5 years ago

RN is already at 0.59. It's stable!

diegolmello commented 5 years ago

Can we get more attention on this? Realm just released support for RN 0.58 and became outdated two weeks after that with RN 0.59.

Mscynol commented 5 years ago

realm is not support 0.59(RN) now

IamStephan commented 5 years ago

realm is not support 0.59(RN) now

I'm confused... Are you saying that it does work or not?

kneth commented 5 years ago

I believe that RN 0.59 requires some changes that we haven't had time for yet.

FunkyLambda commented 5 years ago

I think people are getting a bit off-topic here. The original issue was support for 64-bit, not RN 0.59. I realise they are very closely related, but at the same time, as @cmelchior stated in https://github.com/realm/realm-js/issues/2282:

64 bit support seems to require changes to https://github.com/realm/realm-js/blob/master/react-native/android/src/main/jni/Application.mk#L3 and https://github.com/realm/realm-js/blob/master/react-native/android/build.gradle#L230, but this does not need to be part of the same PR as 0.59 support

diegolmello commented 5 years ago

@FunkyLambda I feel you, but one of the bigger new features of RN 0.59 is 64-bit support. Of course we can change build.gradle architectures to support 32-bit only, but I think you'll agree this is not what RN 0.59 support means.

radeno commented 5 years ago

@diegolmello 64bit arrived with RN 0.58, 0.59 brings new JSI and compiler. So i think this topic is about 64-bit support only. RealmJS works with RN 0.59.

diegolmello commented 5 years ago

@radeno http://facebook.github.io/react-native/blog/2019/03/12/releasing-react-native-059#updated-jsc-means-performance-gains-and-64-bit-support-on-android 🤔

radeno commented 5 years ago

@diegolmello https://github.com/facebook/react-native/blob/0.58-stable/local-cli/templates/HelloWorld/android/app/build.gradle branch 0.58

diegolmello commented 5 years ago

@diegolmello https://github.com/facebook/react-native/blob/0.58-stable/local-cli/templates/HelloWorld/android/app/build.gradle branch 0.58

@radeno x86_64 is missing, but I don't want to argue about it.

radeno commented 5 years ago

@diegolmello x86_64 is intel/amd processor. AMR7/8 is 99,9% all mobile devices.

PanRada commented 5 years ago

any one can give complete solution how use realm 2.26.0 . with react-native 0.59.x on android app is immanently crash on start any one can help ?

theus-brz commented 5 years ago

@PanRada I want a solution too, mine works fine on iOS simulator but Android is inaccessible

BrandonSmith commented 5 years ago

@PanRada @TheusBrz Ensure your Android app/build.gradle is only building for 32-bit architectures.

React Native 0.58 is when 64-bit first landed. So comparing the diff between the generated app/build.gradle, ensure your's uses 0.57 values...

android {
...
  splits {
    abi {
      ...
      include "armeabi-v7a", "x86"
      ...
  }
...
}

Ensure that "arm64-v8a", "x86-64" are not in the list.

https://github.com/react-native-community/rn-diff-purge/compare/release/0.57.0..release/0.59.0#diff-b5a6cecd7ee362715d6306d583e73612

theus-brz commented 5 years ago

@BrandonSmith become able to run my app on Android but it breaks other functionalities and break my iOS app... I'm very excited to use RealmDB but I'm feeling that is not the moment... I'm not an excellent developer yet and my projects deliver dates are close... I plan to move to SQLite for now..

cristianoccazinsp commented 5 years ago

Any updates on this? Removing "x86_64" from gradle build files is not working.

Edit. Looks like I had to also add: ndk { abiFilters "armeabi-v7a", "x86" }

This looks really bad, forcing 32 bits just because a library. What would be the side effects of this?

Edit 2: Using the above although allowed the app to run, it is now raising errors related to touch events that never happened before. I guess I will be staying away from Realm as well. Shame since it seemed very good when testing on other devices.

nirinchev commented 5 years ago

Thank you for relaying your concerns. While I understand that this is an issue many care about, flooding the comments with "+1", "I want this fixed now!!11", etc. is not productive. When we have more information to share, we are going to update the issue.

theus-brz commented 5 years ago

@nirinchev I'm anxious to start using Realm, I'll keep an eye on this issue to get news.

I wish you a good coding :)

Eyesonly88 commented 5 years ago

Hey @nirinchev, I think people wanna know if this will be resolved before the deadline of 1st of August 2019 or not?

cmelchior commented 5 years ago

It will

trungthanhnt commented 5 years ago

Does anybody have a hot fix for arm64bit? I can build but it crash on Android 64bits . Best Regards

bmunkholm commented 5 years ago

It's being worked on now here: https://github.com/realm/realm-js/pull/2366.

kneth commented 5 years ago

@trungthanhnt You need to combine https://github.com/realm/realm-js/issues/2221#issuecomment-482131628 and https://github.com/realm/realm-js/issues/2221#issuecomment-482337181 until we support 64 bit.

nhachicha commented 5 years ago

this is fixed in v2.28.0

diegolmello commented 5 years ago

Nice work, @nhachicha @kneth! 👏👏👏

ferrannp commented 4 years ago

Thank you very much to fix this!

kneth commented 4 years ago

We hear about crashes - most likely due to https://github.com/facebook/react-native/issues/24261 - on Samsung devices.

anshul-kai commented 4 years ago

Has there been a decision on which version of react-native will this be packaged in? Thank you!

kneth commented 4 years ago

@a-koka I don't think the React Native developers have a fix ready yet.

deepakverma4 commented 4 years ago

anyway to support 64bit architecture in 0.55.4?

kneth commented 4 years ago

@deepakverma4 You will need RN v0.59 (https://facebook.github.io/react-native/blog/2019/03/12/releasing-react-native-059)

0x01001 commented 4 years ago

still crash on v3.5.0 RN v0.61.5

kneth commented 4 years ago

@0x01001 Please create a new issue - and remember to add all relevant information (outlines in the issue template).