Usage says, add this --> new OrientationPackage()
but, the compiler says:
错误: 无法将类 OrientationPackage中的构造器 OrientationPackage应用
到给定类型;
new OrientationPackage()
^
需要: Activity
找到: 没有参数
原因: 实际参数列表和形式参数列表长度不同
1 个错误
:app:compileDebugJavaWithJavac FAILED
已经解决,导入"react-native-orientation":‘0.17.0’ 改成 "react-native-orientation": "git+https://github.com/yamill/react-native-orientation",然后react-native link react-native-orientation,即可!
It looks like NPM is not using the latest version.
Try installing it directly from git with:
npm install git+https://github.com/yamill/react-native-orientation.git --save
Same issue
```
:app:compileDebugJavaWithJavac/Users/shade/Downloads/react-native-swiper-master/examples/android/app/src/main/java/com/examples/MainApplication.java:29: error: constructor OrientationPackage in class OrientationPackage cannot be applied to given types;
new OrientationPackage(this),
^
required: no arguments
found:
reason: actual and formal argument lists differ in length
1 error
FAILED
FAILURE: Build failed with an exception.```
How do you call it in MainApplication.java?
It needs to be without arguments, like this:
import com.github.yamill.orientation.OrientationPackage;
...
new OrientationPackage()
Yeah but not working
@klinkov use latest version
npm install git+https://github.com/yamill/react-native-orientation.git --save
and
react-native link
@xdimh It's work! Thank you
First install::: npm install react-native-orientation --save
After Next,
Following These 3 steps:
Android
In android/setting.gradle
...
include ':react-native-orientation', ':app'
project(':react-native-orientation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-orientation/android')
In android/app/build.gradle
...
dependencies {
...
compile project(':react-native-orientation')
}
Register module (in MainApplication.java)
import com.github.yamill.orientation.OrientationPackage; // <--- import
public class MainApplication extends Application implements ReactApplication {
......
@Override
protected List
return Arrays.
new MainReactPackage(),
new OrientationPackage() <------- Add this
);
}
......
}
Modify Package.JSON
give this
"react-native-orientation": "git+https://github.com/yamill/react-native-orientation.git"
After next You Will install: npm install react-native-orientation --save
That's it....
"react-native-orientation": "github:yamill/react-native-orientation"
for short
Did you follow above Steps?
I tried to change "react-native-orientation": git+https://[email protected]/yamill/react-native-orientation.git"
but still not working.../Users/luca/workspace/pillsy/android/app/src/main/java/com/pillsy/MainApplication.java:27: error: constructor OrientationPackage in class OrientationPackage cannot be applied to given types;
new OrientationPackage(this)
^
required: no arguments
found:
reason: actual and formal argument lists differ in length
1 error
:app:compileDebugJavaWithJavac FAILED
@lavarajallu i followed all step ,but
`:app:preDexDebug UP-TO-DATE
:app:dexDebug
Unknown source file : UNEXPECTED TOP-LEVEL EXCEPTION:
Unknown source file : com.android.dex.DexException: Multiple dex files define Lcom/github/yamill/orientation/OrientationModule$1;
Unknown source file : at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
Unknown source file : at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
Unknown source file : at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
Unknown source file : at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
Unknown source file : at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
Unknown source file : at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:502)
Unknown source file : at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
Unknown source file : at com.android.dx.command.dexer.Main.run(Main.java:277)
Unknown source file : at com.android.dx.command.dexer.Main.main(Main.java:245)
Unknown source file : at com.android.dx.command.Main.main(Main.java:106)
:app:dexDebug FAILED
FAILURE: Build failed with an exception.
i solved my problem,and forked and writed solution,https://github.com/aqnaruto/react-native-orientation/blob/master/README.md
Updated version of React Native Orientation package is not published to NPM yet. Working with project owner regarding deployment. Please use git+https://github.com/yamill/react-native-orientation.git in your package.json file to get the latest updates on master branch.
Most helpful comment
It looks like NPM is not using the latest version.
Try installing it directly from git with:
npm install git+https://github.com/yamill/react-native-orientation.git --save