react-native-orientation: Compilation error on demo project

I cloned this repo and tried to launch the demo project but got below error:

MainActivity.java:42: error: constructor OrientationPackage in class OrientationPackage cannot be applied to given types;
            new OrientationPackage(this)
            ^
  required: no arguments
  found: MainActivity
  reason: actual and formal argument lists differ in length
1 error

it seems like an compilation error.

My react-native version is 0.27.2

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 18

Most upvoted comments

use in package.json "react-native-orientation": "git+https://git@github.com/yamill/react-native-orientation.git",

@aqnaruto yes, the package does work with RN 0.40+. Check 5a16ac8a3f96e12969d86a1dd1f6d548efc213b2 commit to see the changes.

Removing the whole directory inside ‘npm_modules’, adding the Git-Version to ‘package.json’ and then doing ‘npm install’ again fixed it for me without a problem!

Tried this with version 0.42

@joeyzhao0113 I copied this whole repo into my node_modules and it worked perfectly. The version of RN I’m using is 0.42.

So, I solved my problem by copying the files directly from the repository.

If you guys copied the files via npm or any other package manager, do what I did and everything will compile fine.