我正在使用Ionic,Angular和Firebase构建应用程序。
今天,我不知道发生了什么变化,但是每次尝试按项目进行构建时,我都会遇到问题。
:app:preDebugBuild失败
失败:构建失败,并出现异常。
- 出了什么问题:
无法通知依赖项解析侦听器。
其他各种图书馆都在[[15.0.2,15.0.2],[16.0.2,16.0.2]]请求com.google.android.gms:play-services-measurement-base库,但解析为15.0.4。禁用插件,并使用./gradlew:app:dependencies检查您的依赖关系树。
其他[[15.0.2,15.0.2],[16.2.1,16.2.1]]的其他各种图书馆正在请求库com.google.firebase:firebase-analytics-impl,但解析为16.2 .1。禁用插件,并使用./gradlew:app:dependencies检查您的依赖关系树。
我猜这是一个问题吗?
我的platforms/android/build.gradle
文件如下:
buildscript {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
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.0.0'
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
//This replaces project.properties w.r.t. build settings
project.ext {
defaultBuildToolsVersion="25.0.2" //String
defaultMinSdkVersion=19 //Integer - Minimum requirement is Android 4.4
defaultTargetSdkVersion=26 //Integer - We ALWAYS target the latest by default
defaultCompileSdkVersion=26 //Integer - We ALWAYS compile with the latest by default
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
和我在platforms/android/app/build.gradle
下的dependencies
文件如下:
dependencies {
implementation fileTree(dir: 'libs', include: '*.jar')
// SUB-PROJECT DEPENDENCIES START
implementation(project(path: ":CordovaLib"))
compile "com.android.support:support-v4:24.1.1+"
compile "com.google.gms:google-services:+"
compile "com.google.android.gms:play-services-tagmanager:+"
compile "com.google.firebase:firebase-core:+"
compile "com.google.firebase:firebase-messaging:+"
compile "com.google.firebase:firebase-crash:+"
compile "com.google.firebase:firebase-config:+"
compile "com.google.firebase:firebase-perf:+"
compile "com.google.android.gms:play-services-analytics:11.0.1"
compile "com.google.android.gms:play-services-location:15.+"
compile "com.android.support:support-v4:26.+"
compile "com.android.support:appcompat-v7:26.+"
// SUB-PROJECT DEPENDENCIES END
}
最后我的project.properties
文件看起来像这样:
target=android-26
android.library.reference.1=CordovaLib
android.library.reference.2=app
cordova.gradle.include.1=cordova-android-play-services-gradle-release/bemochi-cordova-android-play-services-gradle-release.gradle
cordova.gradle.include.2=cordova-plugin-firebase/bemochi-build.gradle
cordova.system.library.1=com.android.support:support-v4:24.1.1+
cordova.gradle.include.3=cordova-support-google-services/bemochi-build.gradle
cordova.system.library.2=com.google.gms:google-services:+
cordova.system.library.3=com.google.android.gms:play-services-tagmanager:+
cordova.system.library.4=com.google.firebase:firebase-core:+
cordova.system.library.5=com.google.firebase:firebase-messaging:+
cordova.system.library.6=com.google.firebase:firebase-crash:+
cordova.system.library.7=com.google.firebase:firebase-config:+
cordova.system.library.8=com.google.firebase:firebase-perf:+
cordova.system.library.9=com.google.android.gms:play-services-analytics:11.0.1
cordova.system.library.10=com.google.android.gms:play-services-location:15.+
cordova.system.library.11=com.android.support:support-v4:26.+
cordova.system.library.12=com.android.support:appcompat-v7:26.+
有人知道我为什么会遇到这个问题吗?老实说,我不知道,我尝试使用的一些在线资源也无济于事。我将不胜感激!谢谢!