0

The module I am trying to install is react-native-schedule-sms

The SchduleSMSDemo project provided in the react-native-schedule-sms app repository builds & runs fine without any issue

My App Name is birthdayReminder & the complete error is

Scanning 734 folders for symlinks in /Volumes/Coding/Code/ReactNative/birthdayReminder/node_modules (13ms)
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...
Incremental java compilation is an incubating feature.

FAILURE: Build failed with an exception.

* Where:Build file '/Volumes/Coding/Code/ReactNative/birthdayReminder/node_modules/react-native-schedule-sms/android/build.gradle' line: 17

* What went wrong:
A problem occurred evaluating project ':react-native-schedule-sms'.> Could not find method implementation() for arguments [com.facebook.react:react-native:+] on objectof type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

* Try:Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 7.77 secs
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/android-setup.html

I have realm as a native dependency & react-native-schedule-sms & both are in settings.gradle

I did react-native link after installing both & the app works fine if I remove react-native-schedule-sms

settings.gradle

rootProject.name = 'birthdayReminder'
include ':realm'
project(':realm').projectDir = new File(rootProject.projectDir, '../node_modules/realm/android')
include ':react-native-schedule-sms'
project(':react-native-schedule-sms').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-schedule-sms/android')

include ':app'

android/app/build.gradle

dependencies {
    compile project(':realm')
    compile project(':react-native-schedule-sms')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.facebook.react:react-native:+"  // From node_modules
}
deadcoder0904
  • 7,232
  • 12
  • 66
  • 163
  • Sometimes ''react-native link" doesn't fully link the modules. Have you checked the MainApplication.java file to see if it's imported properly? If it isn't, you need to write them yourself. And I also have had issues where I need to do Clean and Rebuild before the app runs properly after installing a module. – rabbit87 Sep 09 '17 at 13:17
  • Nope. `MainApplication.java` is alright. Also I uninstalled & reinstalled everything maybe 10 or more times so that's not the issue as well. – deadcoder0904 Sep 09 '17 at 13:41

1 Answers1

1

According to this question: Gradle - Error Could not find method implementation() for arguments [com.android.support:appcompat-v7:26.0.0].

It could be a problem with the module's gradle and not yours. Try checking '/node_modules/react-native-schedule-sms/android/build.gradle' file at line 17. Check if it's using 'implementation' instead of 'compile'. Replace them if it does.

rabbit87
  • 3,165
  • 2
  • 20
  • 29