运行“ react-native run-android”时,出现此错误。
Could not find method implementation() for arguments [project ':react-native-maps', build_9fle69hf72xe0lqw6wvfsi3fa$_run_closure2$_closure12@6a555b9] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
尝试了各种在线解决方案后,经过以下更改,我就能使react-native-maps正常工作
从
更改了android / app / build.gradledependencies {
compile project(':react-native-vector-icons')
compile project(':react-native-maps')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
implementation project(':react-native-maps')
implementation(project(':react-native-maps')){
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-maps'
}
implementation 'com.google.android.gms:play-services-base:10.0.1'
implementation 'com.google.android.gms:play-services-maps:10.0.1'
}
到
dependencies {
compile project(':react-native-vector-icons')
compile project(':react-native-maps')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
compile project(':react-native-maps')
compile(project(':react-native-maps')){
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-maps'
}
compile 'com.google.android.gms:play-services-base:10.0.1'
compile 'com.google.android.gms:play-services-maps:10.0.1'
}
更改了实现以进行编译。
许多其他用户也有相同的错误,但可以通过其他一些更改来解决。但是,这些更改都不适合我。
我在网上的任何地方都没有看到我提到的更改。 更改实现以进行编译是否可以?