이 질문은 반복적 인 것 같지만 안드로이드에서 내 프로젝트에 반응 네이티브 파이어베이스를 추가하려고 시도하고 있지만 프로젝트를 실행하려고 할 때 다음과 같은 유명한 오류가 발생합니다.
org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler 유형의 개체에서 인수 [com.google.android.gms : play-services-base : 16.0.1]에 대한 implementation () 메서드를 찾을 수 없습니다.
나는 많이 검색했지만 찾은 모든 솔루션이 저에게 효과가 없었습니다. 다음은 내 build.gradle입니다. // 모든 하위 프로젝트 / 모듈에 공통적 인 구성 옵션을 추가 할 수있는 최상위 빌드 파일입니다.
buildscript {
ext {
buildToolsVersion = "27.0.3"
minSdkVersion = 16
compileSdkVersion = 27
targetSdkVersion = 26
supportLibVersion = "27.1.1"
}
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
classpath 'com.google.gms:google-services:4.2.0'
// This should be here already
implementation project(':react-native-firebase')
// Firebase dependencies
implementation "com.google.android.gms:play-services-base:16.0.1"
implementation "com.google.firebase:firebase-core:16.0.6"
implementation "com.google.firebase:firebase-firestore:17.1.5"
implementation "com.google.firebase:firebase-ads:15.0.1"
implementation "com.google.firebase:firebase-auth:16.1.0"
implementation 'me.leolin:ShortcutBadger:1.1.21@aar'
implementation "com.google.firebase:firebase-messaging:17.3.4"
implementation "com.google.firebase:firebase-database:16.0.5"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
//classpath 'com.google.gms:google-services:3.2.0'
}
apply plugin: 'com.google.gms.google-services'
}
allprojects {
repositories {
mavenLocal()
google() // <-- Add this line above jcenter
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}
task wrapper(type: Wrapper) {
gradleVersion = '4.4'
distributionUrl = distributionUrl.replace("bin", "all")
}
또한 여기 내 package.json이 있습니다.
{
"name": "xxx",
"version": "x.0.x",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "16.6.3",
"react-native": "0.57.8",
"react-native-animatable": "^1.3.1",
"react-native-firebase": "^5.2.0",
"react-native-i18n": "^2.0.15",
"react-native-linear-gradient": "^2.5.3"
},
"devDependencies": {
"babel-jest": "23.6.0",
"jest": "23.6.0",
"metro-react-native-babel-preset": "0.51.1",
"react-test-renderer": "16.6.3"
},
"jest": {
"preset": "react-native"
}
}
문제가있는 곳을 도와주세요. 미리 감사드립니다
classpath 'com.android.tools.build:gradle:3.2.0'
classpath 'com.google.gms:google-services:4.2.0'
무엇보다도; build.gradle
앱 build.gradle
(android / app / build.gradle)이 아닌 프로젝트 (android / build.gradle)에 implementation
있어야하며 프로젝트 gradle이 아닌 앱 gradle의 모든 종속성에 있어야합니다.
프로젝트의 작동 예는 다음을 참조하십시오 build.gradle
.
https://github.com/invertase/react-native-firebase/blob/master/tests/android/build.gradle#L9-L11
및 앱 빌드 gradle :
https://github.com/invertase/react-native-firebase/blob/master/tests/android/app/build.gradle
감사합니다, Salakar @ React Native Firebase
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다