Reputation: 4287
I am working on authentication through firebase since when I added implementation 'com.firebaseui:firebase-ui-auth:3.3.0'
I am getting AAPT2 error: check logs for details
error after syncing the gradle.
Here are my build.gradle files.
build.gradle(app)
apply plugin: 'com.android.application'
repositories {
mavenLocal()
flatDir {
dirs 'libs'
}
}
android {
compileSdkVersion 24
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.google.firebase.udacity.friendlychat"
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:design:24.2.1'
implementation 'com.android.support:appcompat-v7:24.2.1'
// Firebase
implementation 'com.google.firebase:firebase-database:12.0.1'
implementation 'com.firebaseui:firebase-ui-auth:3.3.0'
implementation 'com.google.firebase:firebase-auth:12.0.1'
// Displaying images
implementation 'com.github.bumptech.glide:glide:3.6.1'
}
apply plugin: 'com.google.gms.google-services'
And build.gradle(Project)
// Top-level build file where you can add configuration options common to
all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenLocal()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
classpath 'com.google.gms:google-services:3.2.1' // google-services
plugin
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenLocal()
maven {
url "https://maven.google.com" // Google's Maven repository
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
The moment I delete this implementation 'com.firebaseui:firebase-ui-auth:3.3.0'
the error is gone. I think adding this is creating AAPT2 error
.
Google SDK Tools
, Google Repository
and Google Play Services
are also installed. Please also explain what is this AAPT2 error
and how this occur if possible.
Upvotes: 1
Views: 2862
Reputation: 1548
Solved!! The problem is with versioning.
your app's build.gradle must also be updated to specify a compileSdkVersion of at least 26 (Android O)
Took me couple of hours to figure out.
Read more here, https://firebase.googleblog.com/2017/08/some-updates-to-apps-using-google-play.html
Upvotes: 0
Reputation: 1766
In Android Studio Aapt2 is enabled by default when you use android plugin for gradle 3.0.
This is primarily done to improve the incremental resource processing, check this page for more info.
If you don't want to see this error you can disable it by adding the the following lines in your gradle.properties.
android.enableAapt2=false
Upvotes: 0
Reputation: 69671
Use this
implementation 'com.android.support:design:27.0.3'
implementation 'com.android.support:appcompat-v7:27.0.3'
Instead of this
implementation 'com.android.support:design:24.2.1'
implementation 'com.android.support:appcompat-v7:24.2.1'
Update
compileSdkVersion 27
andtargetSdkVersion 27
Upvotes: 2