yamill / react-native-orientation

Listen to device orientation changes in react-native and set preferred orientation on screen to screen basis.
https://www.npmjs.com/package/react-native-orientation
ISC License
1.72k stars 810 forks source link

Android Builds Fail Could not find method compile() for arguments [project ':react-native-orientation'] #412

Open NLanese opened 2 years ago

NLanese commented 2 years ago

After following all of the manual linking instructions, I am unable to build or run the app as a whole on any Android Devices (iOS works fine) React Native has moved away from npx react-native link meaning the instructions for auto-linking no longer seem to apply, yet there's a lot of issues getting this to work on Android.

kirgy commented 2 years ago

I am suffering from this problem too after following the configuration section only, on Android. iOS also works fine.

> ./gradlew clean
...
FAILURE: Build failed with an exception.

* Where:
Build file '[redacted]/node_modules/react-native-orientation/android/build.gradle' line: 19

* What went wrong:
A problem occurred evaluating project ':react-native-orientation'.
> Could not find method compile() for arguments [com.facebook.react:react-native:+] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
kirgy commented 2 years ago

@NLanese see here for Expo's package which might tackle your needs. This package seems dead since 2018 unfortunately.

https://docs.expo.dev/versions/latest/sdk/screen-orientation/

ImahImm commented 2 years ago

I changed the word compile to implementation like this :: implementation "com.facebook.react:react-native:+"

sam9010 commented 7 months ago

go to package in node_modules and then go to android/build.gradle replace compile with implementation

node_modules>react-native-orientation>android>build.gradle like this dependencies { implementation "com.facebook.react:react-native:+" }

ItaloFalzoni commented 1 month ago

The last PR that was mentioned this issue is the https://github.com/yamill/react-native-orientation/pull/430