FirebaseUI causes DexException Multiple Dex Files - android

I am using FirebaseUI to try out the RecyclerViewAdapter. When I try to run the app the gradle build doesn't succeed and gives these errors:
Errors shown by Gradle
This doesn't happen when I take out the FirebaseUI Dependency.
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.firebaseui:firebase-ui-database:4.1.0'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'}
Edit: I added MultiDex Support as mentioned on Android Developers Site
What should I do to make the build successful and run the app.
Thanks in advance.

Related

android design library 28.0.0 causes app to crash

Including android design library to the dependencies causes app to crash.
Im launching this on Nexus S emulator with 25 API. All my libraries are of the same version, so I don't know what's the problem.
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0' //this one
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:cardview-v7:28.0.0' // For CardView
implementation 'com.android.support:recyclerview-v7:28.0.0'
}
Migrate your code to AndroidX, the new SDK dependency dir structure will help you avoid such problems now and in the future.

Firebase plugin error mixing versions can lead to runtime crashes

I have this code on my gradle file but I have an error which says
"mixing versions can lead to runtime crashes"
I made this project using the assistant of android studio
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-messaging:17.0.0'
}
Try updating your 'com.google.firebase:firebase-core:16.0.1' to '16.0.6'. It's the most up-to-date version.

Cannot resolve symbol 'OnSuccessListener' in Android Studio

I'm getting this strange behavior that I'm not able to import OnSuccessListener to my code after git cloning and building in a different machine (this resolved fine in my previous machine). However the project builds fine and runs on the emulator. But I'm not able to write firebase related codes further as the listener isn't resolving.
I tried cleaning the project, rebuilding, invalidating the cache but still no luck.
Gradle Dependencies,
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:support-v4:27.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-firestore:17.0.4'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.2'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'com.facebook.android:facebook-android-sdk:4.34.0'
implementation 'com.android.support:design:27.1.1'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.github.drawers:SpinnerDatePicker:1.0.6'
implementation 'com.github.yalantis:ucrop:2.2.2'
}
Please try adding this into your app-gradle file.
implementation 'com.google.android.gms:play-services-tasks:16.0.1'
What you do is make all the firebase and gms version of the same number like for example:
implementation 'com.google.firebase:firebase-auth:102.0'
implementation 'com.google.android.gms:play-services-auth:10.2.0'

Android - appcompat-v7:27.1.1 error after adding facebook sdk

These are the dependencies:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:cardview-v7:27.1.1'
}
When I add implementation 'com.facebook.android:facebook-android-sdk:4.0.1' then it "breaks" implementation 'com.android.support:appcompat-v7:27.1.1' with the error: All com.android.support libraries must use the exact same version specification
Some answers from All com.android.support libraries must use the exact same version specification suggest that I have to look at all the libraries but I can't see what's wrong here:
Can someone explain it? I'm complete newbie in android and I must say it's a horrendous mess
Try use implementation 'com.facebook.android:facebook-android-sdk:4.35.0'

I am getting error in dependencies while adding Admob ad in an Android app

I am trying to integrate admob ad in my app but I am getting some red line under one of my dependencies code.
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
**implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'**
implementation 'com.google.android.gms:play-services-ads:15.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
while adding
implementation 'com.google.android.gms:play-services-ads:15.0.0'
I am getting red line under
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
Where am I going wrong?
Try to downgrade the appcombat version to:
implementation 'com.android.support:appcompat-v7:27.1.1'
See more here.

Categories

Resources