在React Native中安装Native Module后应用程序无法构建?

时间:2017-09-09 11:00:54

标签: java android android-studio react-native react-native-android

我尝试安装的模块是react-native-schedule-sms

SchduleSMSDemo app存储库中提供的react-native-schedule-sms项目&运行良好没有任何问题

我的应用名称为<div class="shape"> </div>&amp;完整的错误是

birthdayReminder

我有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 作为原生依赖&amp; realm&amp;两者都在react-native-schedule-sms

安装了两个&amp;后我做了settings.gradle如果我删除react-native link

,该应用就可以了

settings.gradle

react-native-schedule-sms

机器人/应用/的build.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'

1 个答案:

答案 0 :(得分:1)

根据这个问题:Gradle - Error Could not find method implementation() for arguments [com.android.support:appcompat-v7:26.0.0]

这可能是模块的gradle而不是你的问题。尝试检查&#39; /node_modules/react-native-schedule-sms/android/build.gradle'第17行的文件。检查它是否正在使用&#39;实施&#39;而不是编译&#39;。如果有,请更换它们。