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

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'

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.

All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0,

All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0, 27.0.2. Examples include com.android.support:animated-vector-drawable:28.0.0 and com.android.support:cardview-v7:27.0.
Whatever API I use gives me the same error.
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'
implementation 'com.facebook.android:facebook-android-sdk:[4,5)'
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'
The android team has been working on migrating the support libraries to androidx. This allows you to mix and match better.
Backup your project and in android studio go to
Refractor > Migrate to AndroidX
Add explicitly the library with the old version but with a new version number.
In your case implementation 'com.android.support:cardview-v7:28.0.0' so you need to add:
implementation 'com.android.support:cardview-v7:28.0.0'
ie: Take the library from the second item, and implement it with the version number from the first.
Note: don't forget to press sync now
Now after changes your dependencies will look like this:
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation "com.android.support:support-media-compat:28.0.0"
implementation "com.android.support:customtabs:28.0.0"
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.facebook.android:facebook-android-sdk:[4,5)'
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'

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'

FirebaseUI causes DexException Multiple Dex Files

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.

Categories

Resources