android - 尝试使用 Firebase 在 Android Studio 中更新我的 build.gradle 并收到“AAPT2 错误:检查日志以获取详细信息”错误
问题描述
您好,我正在使用 Firebase 和 Android Studio 构建一个消息传递应用程序,但我的 build.gradle 文件遇到了问题。我试图更新我正在使用的 Firebase 版本,起初更新后我收到一条错误消息
“无法解决:com.google.firebase:firebase-core:16.0.1”
我发现了这个类似的帖子(Failed to resolve: com.google.firebase:firebase-core:16.0.1)并相应地更新了我的项目 build.gradle 文件和顶级构建 gradle 文件。
由于还遵循了响应中的建议,我重新运行了该应用程序,而我现在在构建控制台中收到“AAPT2 错误:检查日志以获取详细信息”错误。
我真的不知道如何提供解决方案,我已经花了几个小时尝试和浏览这个网站。任何帮助将不胜感激!
我正在关注的教程: https ://www.youtube.com/watch?v=5Y0foGqYmxc (大约 12:00)
build.gradle 文件
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.cmc.chatbox"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-beta01'
implementation 'com.android.support:design:28.0.0-beta01'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.google.firebase:firebase-auth:16.0.2'
implementation 'com.android.support:support-v4:28.0.0-beta01'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-storage:16.0.1'
implementation 'com.google.firebase:firebase-firestore:17.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
//creates a rounded user profile image
implementation 'de.hdodenhof:circleimageview:2.2.0'
//ArthurHub - allows user to crop their profile image
compile 'com.theartofdev.edmodo:android-image-cropper:2.7.+'
//Picasso - image uploader
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.firebaseui:firebase-ui-database:4.1.0'
}
apply plugin: 'com.google.gms.google-services'
顶级gradle文件:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:4.0.2'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
解决方案
尝试android.enableAapt2=false
添加gradle.properties
推荐阅读
- html - 反应形式的输入/离子输入 - ChangeDetectionStrategy 的问题
- python - 抓取表只返回“表”而不是表的内容
- linux - 每天在带有 Linux Ubuntu 的 Google Compute Engine 上运行 python 文件
- c# - 反序列化嵌套字典
- python - 即使在我的机器上安装了在 Jupiter 笔记本上导入 openCV 的问题
- redhat - 在不支持 AVX 指令的 Linux 机器上导入并运行 Tensorflow 2
- html - 无论我选择什么选项,选择都是空白的
- firebase - 如何在firestore中获取文档,其文档ID存储在列表中?即只带那些文档....?
- amazon-pay - 如何调整 Amazon Pay 计费协议的频率和持续时间
- python - 在 pytorch 中,是否有内置方法来提取具有给定索引的行?