Realm-js: [Android] Builds are failing after init setup

Created on 11 Aug 2017  路  13Comments  路  Source: realm/realm-js

Hi. I have created a fresh react native project with react-native init and add realm yard add realm. Then linked react-native link realm. I have set the android build tools for 25. When I run ios it is fine but when I run android the build fails:

RealmReactPackage.java:18: error: method does not override or implement a method from a supertype @Override ^ RealmReactModule.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 1 error :realm:compileReleaseJavaWithJavac FAILED

I have checked the settings.gradle and build.gradle and everything is at it should be according to realm doc.

Version of Realm and Tooling

  • Realm JS SDK Version: 1.10.1
  • React Nattive: 0.47.1
  • Client OS & Version: iOS 10, Android N
T-Duplicate T-Help

Most helpful comment

I hope we have time to do a release today or tomorrow.

All 13 comments

I am also having this issue.

I have the same issue. The only one difference is that I upgraded versions of react, react-native and realm for the existing project. Previous react-native version was 0.44 (Realm worked with this version).
Is there a way to fix it?

+1

The same issue here. Not able to build
Realm: 1.10.1
React Native: 0.47.1

.......
:realm:mergeReleaseResources
:realm:processReleaseManifest
:realm:processReleaseResources
:realm:generateReleaseSources
:realm:incrementalReleaseJavaCompilationSafeguard
:realm:compileReleaseJavaWithJavac
:realm:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
/home/brano/Programming/Servio/node_modules/realm/android/src/main/java/io/realm/react/RealmReactPackage.java:18: error: method does not override or implement a method from a supertype
@Override
^
Note: /home/brano/Programming/Servio/node_modules/realm/android/src/main/java/io/realm/react/RealmReactModule.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
:realm:compileReleaseJavaWithJavac FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':realm:compileReleaseJavaWithJavac'.
    > Compilation failed; see the compiler error output for details.

After one day trying I think it's working now for me, I can build and develop finally without bugs.

This helped me:

  1. Changing dependencies in package.json to:
    "react-native": "0.46.0",
    "realm": "1.10.0"
  2. removing modules: rm -r node_modules/
  3. getting modules by changed dependencies: npm i

Then it started working. Maybe also uninstall&install of app on device would be needed.

As the build output highlights, the problem is on overriding the method that you will find on the RealmReactModule.java under "node_modules/realm/android/src/main/java/io/realm/react", you need to change this on line 18:
@Override
public List> createJSModules() {
return Collections.emptyList();
}
to this :
// @Override
public List> createJSModules() {
return Collections.emptyList();
}
It worked for me !

@aminesig Thank you for your solution! But it's not a good practice to make changes to the node modules.

I believe it is fixed by #1178 but it hasn't be released yet.

@aminesig This did came on my mind, but when I want to deploy it to CI it would download/upgrade the library so this error would persist outside development machine.

I hope we have time to do a release today or tomorrow.

I have the same problem using [email protected], [email protected]

We have released 1.10.3. Please upgrade as we believe #1178 fixes it.

@kneth Thank you! It seems it's working now

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Chris-Petty picture Chris-Petty  路  3Comments

MihaelIsaev picture MihaelIsaev  路  3Comments

CrystalRanita picture CrystalRanita  路  3Comments

matt2legit picture matt2legit  路  3Comments

timanglade picture timanglade  路  3Comments