0

Hello I am building a messaging app using Firebase and Android Studio and have ran into an issue with my build.gradle file. I have tried to update the versions of Firebase I am using and at first after updating I was getting an error message saying

"Failed to resolve: com.google.firebase:firebase-core:16.0.1"

I found this similar post ( Failed to resolve: com.google.firebase:firebase-core:16.0.1 ) and updated my project build.gradle file and top level build gradle file accordingly.

Since also following the advice from the responses I have rerun the app and I am now instead getting a "AAPT2 error: check logs for details" error in the build console.

I really have no idea how to provide a solution to this and I've already spent hours trying and browsing this website. Any help would be greatly appreciated!

The tutorial I was following: https://www.youtube.com/watch?v=5Y0foGqYmxc (Around 12:00)

build.gradle file

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'

Top level gradle file:

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
}
Community
  • 1
  • 1
cmc1993
  • 103
  • 2
  • 8
  • 3.1.3 - the lastest version I think. – cmc1993 Aug 02 '18 at 19:45
  • check the answers here: https://stackoverflow.com/questions/46988102/errorcom-android-tools-aapt2-aapt2exception-aapt2-error-check-logs-for-detail – Peter Haddad Aug 02 '18 at 19:46
  • Thanks, I have read through the responses and tried to apply a few of the fixes to my own project. Hopefully I will find one that works. – cmc1993 Aug 02 '18 at 21:27

2 Answers2

0

Try adding android.enableAapt2=false in gradle.properties

Andrei Zgirvaci
  • 367
  • 3
  • 11
  • Thanks, i have already tried this as I saw it provided as a solution to other similar questions but unfortunately it wont work for me. – cmc1993 Aug 02 '18 at 21:26
0

add implementation 'com.google.firebase:firebase-core:16.0.1' as the first one dependency, before firebase-database:16.0.1. should not be like that, but may cause issues.

the error message clearly reads: check logs for details ...

Martin Zeitler
  • 1
  • 19
  • 155
  • 216