I am creating a facebook login option in android app in Android Studio. When i put
compile group: 'com.facebook.android', name: 'facebook-android-sdk', version: '4.26.0'
dependency in build.gradle, an error is coming as:-
Error:Failed to resolve: com.facebook.android:facebook-android-sdk:4.26.0
What is the Reason.
The gradle file is :-
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
defaultConfig {
applicationId "com.example.android.health"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories{
mavenCentral()
}
dependencies {
// https://mvnrepository.com/artifact/com.facebook.android/facebook-android-sdk
compile group: 'com.facebook.android', name: 'facebook-android-sdk', version: '4.26.0'
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:25.1.1'
compile 'com.android.support:design:25.1.1'
// testCompile 'junit:junit:4.12'
}
put below line in dependency in build.gradle;
compile 'com.facebook.android:facebook-android-sdk:4.18.0'
Instead of this.
compile group: 'com.facebook.android', name: 'facebook-android-sdk', version: '4.26.0'
Do this.
compile 'com.facebook.android:facebook-android-sdk:4.26.0'
And make sure you have this inside classpath gradle.
repositories {
jcenter {
url "http://jcenter.bintray.com/"
}
}
Then clean and rebuild your project.
Related
When trying to add the dependency for the latest version (2.0.0) of the Material Spinner, my gradle sync fails with the error:
Error:(33, 14) Failed to resolve: com.github.ganfra:material-spinner:2.0.0
This is my build.grade
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.myroommate.myroommate"
minSdkVersion 23
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
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:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.volley:volley:1.0.0'
compile ('com.github.ganfra:material-spinner:2.0.0') {
exclude group: 'com.android.support', module: 'appcompat-v7'
}
}
But when I change the Material Spinner version to 1.1.1, the gradle sync is finishing without any errors.
compile ('com.github.ganfra:material-spinner:1.1.1') {
exclude group: 'com.android.support', module: 'appcompat-v7'
}
Even using 1.1.2 makes my gradle build fails. I would like to use the latest version of the Material Spinner so what am I doing wrong here?
the release has not been pushed to maven yet.
It'll be ok very soon.
check this
I am new to android studio and am trying to add Google sheets api v4. On their website it says to add some dependencies to my build.gradle file.
Here is what my gradle currently looks like:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.example"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
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.google.android.gms:play-services-location:11.0.4'
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.android.gms:play-services-maps:11.0.4'
compile 'com.android.support:design:26.+'
testCompile 'junit:junit:4.12'
}
The error occurs when I try to add the following lines
compile('com.google.api-client:google-api-client-android:1.22.0') {
exclude group: 'org.apache.httpcomponents'
}
compile('com.google.apis:google-api-services-sheets:v4-rev483-1.22.0') {
exclude group: 'org.apache.httpcomponents'
}
When I try to sync my Gradle I instead get this error:
Error:Conflict with dependency 'com.google.code.findbugs:jsr305' in project ':app'. Resolved versions for app (1.3.9) and test app (2.0.1) differ. See http://g.co/androidstudio/app-test-app-conflict for details.
Any help fixing this would be appreciated as I am pretty new to android studio.
In your build.gradle (in app folder) add the following inside android{} body
android {
....
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
}
Related answer: https://stackoverflow.com/a/37357786/8405762
i just upgraded my android studio to 3.0 canery 1. now am having an issue upon syncing my project which was working fine on my previous version of android studio .
here is my file
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.******.app"
minSdkVersion 14
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
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:25.2.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.afollestad:bridge:5.1.2'
compile 'com.vistrav:ask:2.4'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.thefinestartist:finestwebview:1.2.7'
compile 'com.google.firebase:firebase-messaging:10.0.1'
compile 'com.google.android.gms:play-services-maps:10.0.1'
compile 'com.google.android.gms:play-services-places:10.0.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
exclude org.json its already available in the framework.
compile('com.afollestad:bridge:5.1.2') {
exclude group: 'org.json', module: 'json'
}
Your project having org.json:json:20160810 artifact(direct injection or indirect(like by provider of other artifact)) but not able to do find from local/remote repo.
And make sure you've your repository in your project
repositories {
mavenCentral()
jcenter({url "http://jcenter.bintray.com/"})
}
Hopefully you're connected to Internet so that it can find from remote repo:
You go File > Settings > Gradle Look at the "Offline work" inbox, if it's checked u uncheck and try to sync again.
I am trying to add the firebase admin SDK to my project following the instructions here: https://firebase.google.com/docs/admin/setup
but when i add compile 'com.google.firebase:firebase-admin:4.0.4' on my build.grandle file, then following error appears:
Error:(44, 0) Version: 4.0.4 is lower than the minimum version (9.0.0) required for google-services plugin.
If i try version 4.0.3 i face the same problem.
My build.grandle file at the moment:
android {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
compileSdkVersion 25
buildToolsVersion "25.0.1"
defaultConfig {
applicationId "com.example.qrcodereader"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
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.google.android.gms:play-services-appindexing:9.0.0'
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.google.zxing:core:3.2.1'
compile 'com.google.firebase:firebase-admin:4.0.4'
compile 'com.journeyapps:zxing-android-embedded:3.2.0#aar'
compile 'com.android.support:gridlayout-v7:25.1.0'
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.firebaseui:firebase-ui:1.1.0'
compile 'com.android.support:support-v4:25.1.0'
compile project(':linkedin-sdk')
testCompile 'junit:junit:4.12'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
}
apply plugin: 'com.google.gms.google-services'
Any help appreciated :)
i am trying to declare Firebase but it's giving error can not resolve Firebase.
i have added all the dependencies. when typing in android studio FirebaseDatabase etc are available but simple Firebase is not.
here are my dependencies
enter code here
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.doctor.lenovo.mvprecovery"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
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:25.1.0'
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.google.firebase:firebase-storage:10.0.1'
compile 'com.google.firebase:firebase-crash:10.0.1'
compile 'com.google.firebase:firebase-auth:10.0.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
Make sure you have the lastest version of Google Repository (You can update to a newer version in SDK Manager tab)