Facebook Authentication Not Working with Firebase UI in Android - android

I have used Firebase UI to implement authentication in a couple of projects before, however, for some reason, I cannot get Facebook authentication to work in this current project. Each time the Sign in with Facebook button is clicked, it initiates what appears to be an authentication flow and then comes back to the Auth UI screen without doing anything.
No account is created in Firebase console and nothing is logged on Facebook. Here are the steps that I have taken and double checked.
Added Firebase UI latest library to project - 2.2.0
Add Facebook Android SDK
Updated other Firebase libraries to 11.4.0
Ensured Google Play services is 3.0.0
Ensured Facebook authentication is enabled in Firebase console
Ensured Facebook App ID and App Secret is added to Firebase console
Ensure Firebase oAuth redirect is added to Facebook
Ensure App is added correctly to Facebook and enabled
Ensure Facebook App Id is added to res/string resource file
Used a different Facebook account that is different from my
developer account
Tried on two different physical devices
There is no error message, no Log cat, what else could I be missing? Any help will be appreciated Here is my AuthUiActivity
https://gist.github.com/valokafor/d4d5663bcdcf999be1cd41f331a3b883
And here is my Gradle dependencies
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
androidTestCompile('com.android.support.test.espresso:espresso-contrib:2.2') {
// Necessary to avoid version conflicts
exclude group: 'com.android.support', module: 'appcompat'
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'support-annotations'
exclude module: 'recyclerview-v7'
}
compile('org.mnode.ical4j:ical4j:1.0.6') {
exclude group: 'commons.io'
}
compile "com.android.support:appcompat-v7:$rootProject.supportLibraryVersion"
compile "com.android.support:design:$rootProject.supportLibraryVersion"
compile "com.android.support:cardview-v7:$rootProject.supportLibraryVersion"
compile "com.android.support:support-vector-drawable:$rootProject.supportLibraryVersion"
compile "com.android.support:recyclerview-v7:$rootProject.supportLibraryVersion"
compile "com.android.support:support-v4:$rootProject.supportLibraryVersion"
compile('com.mikepenz:materialdrawer:5.9.1#aar') {
transitive = true
}
compile 'com.android.support:multidex:1.0.1'
compile 'com.afollestad.material-dialogs:core:0.9.4.5'
compile 'com.google.android.gms:play-services-auth:11.0.4'
compile 'com.google.firebase:firebase-crash:11.0.4'
compile 'com.google.firebase:firebase-core:11.0.4'
compile 'com.google.firebase:firebase-ads:11.0.4'
compile 'com.google.firebase:firebase-messaging:11.0.4'
compile 'com.google.firebase:firebase-auth:11.0.4'
compile 'com.firebaseui:firebase-ui:2.2.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha9'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'be.billington.calendar.recurrencepicker:library:1.1.1'
compile 'org.ocpsoft.prettytime:prettytime:3.2.7.Final'
compile 'com.jakewharton:butterknife:8.5.1'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'commons-io:commons-io:2.5'
compile 'org.apache.commons:commons-collections4:4.1'
compile 'com.afollestad:material-camera:0.4.4'
compile 'com.google.android:flexbox:0.2.5'
compile 'com.github.fiskurgit:ChipCloud:3.0.3'
compile 'com.github.adroitandroid:ChipCloud:2.2.1'
compile 'com.facebook.android:facebook-android-sdk:4.22.1'
compile 'com.google.code.gson:gson:2.8.1'
testCompile 'junit:junit:4.12'
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5.1'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1'
}
apply plugin: 'com.google.gms.google-services'
Firebase Auth Console

It turns out, it was a very simple thing.
The Facebook id should be added to the string like this:
<string name="facebook_application_id" translatable="false">98765xxxxxxx</string>
instead of the way appears in the Firebase UI doc like this
<string name="facebook_app_id" translatable="false">987565xxxxxx</string>
Once I made that update, thanks to this question FirebaseUI Authentication with Facebook not logging in the issue was resolved

Related

Released APK installed in Android Device is Error Blocked by Play Protect

I have Generated signed Apk and installed in Android device its give Dialog for Blocked by Play Protect.when Debug app is installed in devices Successfully installed.
I have Used two Google Api. Map and youtube after i will use firebase api.
How to change Project code in Android Studio or Google Api, release Apk successfully installed.
dependency :-
[dependencies {
compile fileTree(include: \['*.jar'\], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile files('libs/universal-image-loader-1.9.5.jar')
compile files('libs/mpandroidchartlibrary-2-2-4.jar')
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:25.0.1'
compile 'com.squareup.okhttp:okhttp:2.0.0'
compile 'com.android.support:support-v4:25.0.1'
compile 'com.roomorama:caldroid:3.0.1'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.github.bumptech.glide:glide:4.7.1'
compile 'com.android.support:cardview-v7:25.0.1'
compile 'com.android.support:recyclerview-v7:25.0.1'
compile 'com.google.android.gms:play-services:11.0.4'
compile 'com.google.firebase:firebase-core:11.0.4'
testCompile 'junit:junit:4.12'
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '25.0.1'
}
}
}
}
What happens when you communicate with Google will fix the problem. They have prepared a form for such situations. They usually correct within 3-5 days. https://support.google.com/googleplay/android-developer/contact/protectappeals?hl=en
or signing with a new developer account will fix the problem.
Build a new key but make sure your are logged in to Android Studio. This fixed the issue for me.

Integrate FirebaseUI to app/build.gradle cause crash at runtime

Adding
compile 'com.firebaseui:firebase-ui-auth:2.3.0'
into dependencies of the app/build.grandle File, cause an Error every Time I call FirebaseAuth.getInstance(). Before I added the new gradle Dependency, every FirebaseAuth.getInstance() Call works fine and also I was able to load Data from FirebaseDatabase.
Iam doing this Tutorial: FirebaseUI for Android — Auth. What did I wrong?
Update 1: Put the calls into an Try/Catch Block doesnt work. The Debbuger does not step into the catch Part.
UPDATE 2:
What is the Error? Answer: I dont get an Error. The Logcat Box do not print any Error Message. Also I cant figgure out the error via debugging, becaus the Catch-Block dont get reached.
My app/build.gradle:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.0.1'
compile 'com.android.support:design:26.0.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:support-v4:26.0.1'
compile 'com.android.support:cardview-v7:26.0.1'
testCompile 'junit:junit:4.12'
//Firebase
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
//FirebaseUI
compile 'com.firebaseui:firebase-ui-auth:2.3.0'
compile('com.facebook.android:facebook-android-sdk:4.22.1') // Required only if Facebook login support is required
}
apply plugin: 'com.google.gms.google-services'
To solve this, change this lines of code:
compile 'com.firebaseui:firebase-ui-auth:2.3.0'
with
compile 'com.firebaseui:firebase-ui-auth:1.2.0'
Make sure to using right version number for firebase-ui-auth at gradle. You can read the official document: https://firebase.google.com/docs/android/setup
Just check the compatibility:
FirebaseUI Version Firebase/Play Services Version
2.3.0 11.0.4
If you want to use the firebase-ui 2.3.0 you have to use firebase 11.0.4.
Use:
//Firebase
compile 'com.google.firebase:firebase-auth:11.0.4'
compile 'com.google.firebase:firebase-database:11.0.4'
//FirebaseUI
compile 'com.firebaseui:firebase-ui-auth:2.3.0'

Java.util.zip.ZipException: duplicate entry: com/google/common/base/FinalizableReference.class

Why am getting this error it will not occurred when I sync the Gradle but when I'm running the project I am getting this error .
Error:Execution failed for task ':app:transformClassesWithJarMergingForRelease'. > com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/common/base/FinalizableReference.class
I don't know which dependency cause this error, My dependencies are .
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:customtabs:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:percent:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.facebook.android:facebook-android-sdk:4.19.0'
compile 'com.google.android.gms:play-services-auth:11.0.0'
compile 'com.google.android.gms:play-services-location:11.0.0'
compile 'com.google.android.gms:play-services-maps:11.0.0'
compile 'com.google.android.gms:play-services-places:11.0.0'
compile 'com.google.maps.android:android-maps-utils:0.3.4'
compile 'io.nlopez.smartlocation:library:3.3.1'
compile 'com.appeaser.sublimenavigationviewlibrary:sublimenavigationviewlibrary:0.0.1'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.android.volley:volley:1.0.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.slider:library:1.1.5#aar'
compile 'com.afollestad:sectioned-recyclerview:0.4.1'
compile 'com.github.medyo:fancybuttons:1.8.3'
compile 'com.basgeekball:awesome-validation:2.0'
compile 'com.github.michaelye.easydialog:easydialog:1.4'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
Edit
I figured it out play service dependencies causing this problem. when I'm using 10.2.6 instead of 11.0.0 app is working perfectly, I just change dependecies to
compile 'com.google.android.gms:play-services-auth:10.2.6'
compile 'com.google.android.gms:play-services-location:10.2.6'
compile 'com.google.android.gms:play-services-maps:10.2.6'
compile 'com.google.android.gms:play-services-places:10.2.6'
but I want to use latest version of play-services 11.0.0 but it gives me the above problem. How to resolve this problem? Any help would be appriciated Thanks.
Finally problem is solved. Seems like its a bug google resolved this issue in updated version.
Use play Service Version 11.0.1
In project level gradle use
classpath 'com.google.gms:google-services:3.1.0'
Sometimes, this issue happens because of including different version of play-services (or some other libraries). Have a look at app dependencies using below:
gradle app:dependencies
or if you are using Gradle wrapper
./gradlew app:dependencies
There might be some other third party library that is using an older version of library. If that is the case, exclude the older library from the third party library and include the latest one.
You can do something like this:
compile ('com.thirdpartylib.android:library-sdk:8.3.0') {
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'com.google.android.gms', module: 'play-services-gcm'
compile 'com.android.support:support-v4:26.0.0'
compile 'com.android.support:support-annotations:26.0.0'
compile 'com.google.android.gms:play-services-gcm:11.2.0'
}
This should resolve any duplicate entry, the main reason for the issue

Authorizing google API error

I'm trying to Authorizing and using googel API for android but when I try to configure build dependencies and sync the project it give me an error like
Error:Execution failed for task ':app:prepareDebugAndroidTestDependencies'.> Dependency Error.
See console for details.
build gradle (app):
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
testCompile 'junit:junit:4.12'
compile 'com.google.android.gms:play-services-auth:10.2.0'
compile 'com.google.api-client:google-api-client:1.22.0'
compile 'com.google.api-client:google-api-client-android:1.22.0'
compile 'com.google.apis:google-api-services-people:v1-rev4-1.22.0'
how can I solve this?
Not sure, but I think your google apis are conflicting
compile 'com.google.android.gms:play-services-auth:10.2.0'
and
compile 'com.google.api-client:google-api-client:1.22.0'
Might internally be using other dependencies, with different versions.
Try running: /gradlew app:dependencies to see all your dependencies

Android Studio: canot import com.google.android.youtube

I got the jar file and also pasted it in lib folder of my project. Got the API key , and also wrote compiling code but still cannot import com.google.android.youtube
dependencies {
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:design:25.1.0'
testCompile 'junit:junit:4.12'
compile 'com.google.android.gms:play-services-vision:10.0.1'
compile 'com.google.android.gms:play-services-maps:10.0.1'
compile 'com.google.android.gms:play-services-location:10.0.1'
compile 'com.google.android.gms:play-services-places:10.0.1'
compile 'com.google.apis:google-api-services-youtube:v3-rev157-1.21.0'
}
The dependency: compile files('libs/YouTubeAndroidPlayerApi.jar') have two occurrences in your gradle file. Also edit the dependency: compile 'com.google.apis:google-api-services-youtube:v3-rev157-1.21.0' to compile 'com.google.apis:google-api-services-youtube:v3-rev181-1.22.0'. You can find more information here. After updating the gradle file, build your project once again.
I found here an issue about Android Player API of YouTube. The issue is all about YouTube APIs should have support via gradle and a documentation of it. I found here in this issue that one of the community created a github on how to add YouTube Android Player API into Android application via Gradle. So you may look on this on how to use it.
For more information, check this related SO question.

Categories

Resources