Leo*_*Fan 5 android gradle firebase ionic5
我正在使用 Ionic 5 Framework 开发一个 Android 应用程序,并希望对其实施 Firebase 消息传递。在我更新了两个 build.gradle 文件和 Sync project with Gradle files 后,我收到以下错误消息:
在类型 org 的对象上找不到参数 [DefaultExternalModuleDependency{group='com.google.firebase', name='firebase-bom', version='26.1.1', configuration='default'}] 的方法 implementation() .gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler。
这是我的系统信息:
项目级 build.gradle (/build.gradle):
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.4'
}
}
allprojects {
repositories {
google()
jcenter()
}
project.ext {
defaultBuildToolsVersion="29.0.2" //String
defaultMinSdkVersion=22 //
defaultTargetSdkVersion=29 //
defaultCompileSdkVersion=29 //
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Run Code Online (Sandbox Code Playgroud)
应用级 build.gradle (//build.gradle)
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
if (cdvHelpers.getConfigPreference('GradlePluginKotlinEnabled', 'false').toBoolean()) {
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
}
buildscript {
apply from: '../CordovaLib/cordova.gradle'
if(cdvHelpers.getConfigPreference('GradlePluginKotlinEnabled', 'false').toBoolean()) {
String defaultGradlePluginKotlinVersion = kotlin_version
/**
* Fetches the user's defined Kotlin Version from config.xml.
* If the version is not set or invalid, it will default to the ${defaultGradlePluginKotlinVersion}
*/
String gradlePluginKotlinVersion = cdvHelpers.getConfigPreference('GradlePluginKotlinVersion', defaultGradlePluginKotlinVersion)
if(!cdvHelpers.isVersionValid(gradlePluginKotlinVersion)) {
println("The defined Kotlin version (${gradlePluginKotlinVersion}) does not appear to be a valid version. Falling back to version: ${defaultGradlePluginKotlinVersion}.")
gradlePluginKotlinVersion = defaultGradlePluginKotlinVersion
}
// Change the version to be used.
ext.kotlin_version = gradlePluginKotlinVersion
}
repositories {
mavenCentral()
google()
jcenter()
}
dependencies {
apply from: '../CordovaLib/cordova.gradle'
classpath 'com.android.tools.build:gradle:4.0.0'
implementation platform('com.google.firebase:firebase-bom:26.1.1')
implementation 'com.google.firebase:firebase-messaging-ktx'
Run Code Online (Sandbox Code Playgroud)
离子框架信息:
Ionic CLI : 6.7.0 (C:\Program Files\nodejs\node_modules\@ionic\cli)
Ionic Framework : @ionic/angular 5.3.1
@angular-devkit/build-angular : 0.1000.6
@angular-devkit/schematics : 10.0.6
@angular/cli : 10.0.6
@ionic/angular-toolkit : 2.3.0
Capacitor:
Capacitor CLI : 2.4.0
@capacitor/core : 2.4.0
Cordova:
Cordova CLI : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms : android 9.0.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 12 other plugins)
Utility:
cordova-res : not installed
native-run (update available: 1.3.0) : 1.0.0
System:
NodeJS : v14.15.1 (C:\Program Files\nodejs\node.exe)
npm : 6.14.9
OS : Windows 10
Run Code Online (Sandbox Code Playgroud)
摇篮版本:
Gradle 6.1.1
------------------------------------------------------------
Build time: 2020-01-24 22:30:24 UTC
Revision: a8c3750babb99d1894378073499d6716a1a1fa5d
Kotlin: 1.3.61
Groovy: 2.5.8
Ant: Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM: 1.8.0_271 (Oracle Corporation 25.271-b09)
OS: Windows 10 10.0 amd64
Run Code Online (Sandbox Code Playgroud)
我已经尝试了 gradle 6.3、6.5、6.7.1 版并得到了同样的错误消息。
非常感谢!
| 归档时间: |
|
| 查看次数: |
1478 次 |
| 最近记录: |