React-native-contacts: issue with installing

Created on 30 Jun 2019  路  10Comments  路  Source: morenoh149/react-native-contacts

I am trying to solve this issue for 3 days , please any one can help

details when running react-native run-android

`* What went wrong:
Execution failed for task ':react-native-contacts:compileDebugJavaWithJavac'.

Compilation failed; see the compiler error output for details.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 4s
19 actionable tasks: 1 executed, 18 up-to-date
error Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
error Command failed: ./gradlew app:installDebug. Run CLI with --verbose flag for more details.`

Most helpful comment

./gradlew app:installDebug --warning-mode all

@morenoh149 the only message I get is:

Task :react-native-contacts:generateDebugRFile UP-TO-DATE
Changing the value for a property with a final value has been deprecated. This will fail with an error in Gradle 6.0.

All 10 comments

please run gradle with the--warning-mode all flag so we can review the specific deprecations. It's probably something like ./gradlew app:installDebug --warning-mode all in the android folder.

I'm not a specialist, but it seams a problem with Androidx migration... This migration will be mandatory?

@williamgurzoni yes. Read https://medium.com/@yathousen/the-day-google-decided-to-shake-the-react-native-community-4ba5cdd33388 to learn more about the situation.

Followed those steps but I still getting the same error. Any other Idea?

./gradlew app:installDebug --warning-mode all

@morenoh149 the only message I get is:

Task :react-native-contacts:generateDebugRFile UP-TO-DATE
Changing the value for a property with a final value has been deprecated. This will fail with an error in Gradle 6.0.

I'm also encountering something similar. Here's the error output I'm experiencing.

Versions:
react-native-contacts: 4.0.2
react-native: 0.59.10

When I run ./gradlew app:installDebug --warning-mode all I received the same information @morenoh149 did.

Error Output:

> Task :react-native-contacts:compileDebugJavaWithJavac FAILED
/Users/puma/wigo-mobile/node_modules/react-native-contacts/android/src/main/java/com/rt2zz/reactnativecontacts/ContactsManager.java:50: error: ContactsManager is not abstract and does not override abstract method onActivityResult(int,int,Intent) in ActivityEventListener
public class ContactsManager extends ReactContextBaseJavaModule implements ActivityEventListener {
       ^
/Users/puma/wigo-mobile/node_modules/react-native-contacts/android/src/main/java/com/rt2zz/reactnativecontacts/ContactsManager.java:1053: error: method does not override or implement a method from a supertype
    @Override
    ^
/Users/puma/wigo-mobile/node_modules/react-native-contacts/android/src/main/java/com/rt2zz/reactnativecontacts/ContactsManager.java:1099: error: method does not override or implement a method from a supertype
    @Override
    ^
3 errors

Update: I created a new React Native project (version 0.59.10) and installed all dependencies successfully and confirmed that the Android project files were in sync, however the bug still exists.

Newer Update:

Solved my issue! User error!

Instead of this:

        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }

I had:

        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url '$rootDir/../node_modules/react-native/android'
        }

Gradle files are written using Groovy syntax, and only double-quoted strings support variable interpolation.. so $rootDir was being taken literally and react-native wasn't being properly loaded, causing its API calls to fail.

I had the same error, I was using:

versions:

"react-native": "0.57.8",
"react-native-contacts": "^5.0.2",

The build.gradle with:

compileSdkVersion = 27
targetSdkVersion = 27
supportLibVersion = "27.1.1"

In react-native-contacts: 5.0.2 use version 28 in build.gradle, so I had to downgrade to version 4.0.2 of react-native-contacts that use version 27, and now it's working in Android and ios

Working versions:

"react-native": "0.57.8",
"react-native-contacts": "4.0.2",

interesting. Moving forward most projects should use at least android 28. @Girgetto is there any reason you didn't upgrade your build.gradle to 28 instead of downgrading rnc to 4.0.2?

@morenoh149 I tried to upgrade to 28 but it didn't work

Was this page helpful?
0 / 5 - 0 ratings