我正在尝试使用命令Set mdAtt =
构建我的离子项目
但这给了我这个错误ionic cordova build android --prod --release
这是我的两个build.gradle文件:
项目级文件
> Could not find method implementation() for arguments [com.google.firebase:firebase-core:17.0.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
模块(应用级文件)
/* Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.android.tools.build:gradle:3.3.0'
classpath 'com.google.gms:google-services:4.2.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
//This replaces project.properties w.r.t. build settings
project.ext {
defaultBuildToolsVersion="28.0.3" //String
defaultMinSdkVersion=19 //Integer - Minimum requirement is Android 4.4
defaultTargetSdkVersion=28 //Integer - We ALWAYS target the latest by default
defaultCompileSdkVersion=28 //Integer - We ALWAYS compile with the latest by default
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我认真遵守了Firebase控制台中编写的指令。
我尝试过的事情
所有失败。
答案 0 :(得分:1)
您必须移动您的依赖关系
implementation 'com.google.firebase:firebase-core:17.0.0'
从 buildscript
块到 dependencies
块
buildscript {
repositories {
mavenCentral()
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
//implementation 'com.google.firebase:firebase-core:17.0.0' --> remove this
}
}
dependencies {
implementation fileTree(dir: 'libs', include: '*.jar')
// SUB-PROJECT DEPENDENCIES START
implementation(project(path: ":CordovaLib"))
implementation "com.android.support:support-v4:24.1.1+"
implementation "com.android.support:support-annotations:27.+"
implementation "com.onesignal:OneSignal:3.10.8"
// SUB-PROJECT DEPENDENCIES END
implementation 'com.google.firebase:firebase-core:17.0.0' // <-- add in this block
}
注意:与该问题无关,但由于您使用的是firebase-core v.17.x.x
,因此也请this post进行检查,因为存在重大更改并且使用build.gradle
脚本还会出现另一个错误。
答案 1 :(得分:0)
您是否尝试过更改
implementation 'com.google.firebase:firebase-core:17.0.0'
到
classpath 'com.google.firebase:firebase-core:17.0.0'
在您的buildscript块中?
afaik构建脚本没有“实现”配置