Gradle sync error when adding Material Spinner dependency - android

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

Related

Error when putting facebook dependency in android app

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.

Error with adding dependencies to my build.gradle in android studio (Conflict with dependency)

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

Update constraint layout

I can't install new version of constraint layout and other Repository like CardView and RecyclerView
my build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.radin.myapplication"
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'
}
}
}
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.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:cardview-v7'
compile 'com.android.support:recyclerview-v7'
}
I don't see new version of constraint layout in my SDK manager
Screen shot of my sdk Manager
When i click on Install Repository and sync project nothing happens Screen shot of my android studio
try click in install repository and sync Project and change:
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:cardview-v7'
compile 'com.android.support:recyclerview-v7'
to:
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
And remove this from the build gradle file:
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})

Error:Failed to resolve: org.json:json:20160810

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.

faild to resolve errors on android studio core:2.2.2

Got this 4 errors:
Error:(23, 24) Failed to resolve: com.android.support.test.espresso:espresso-core:2.2.2
Error:(26, 13) Failed to resolve: com.android.support:appcompat-v7:24.0.0
Error:(27, 13) Failed to resolve: com.android.support:design:24.0.0
Error:Failed to resolve: com.android.support:support-v4:24.0.0
The code:
android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "com.adir.remember"
minSdkVersion 15
targetSdkVersion 24
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:24.0.0'
compile 'com.android.support:design:24.0.0'
compile 'com.google.firebase:firebase-appindexing:10.0.0'
}
How can I fix errors above?
You should read the document about configure build for more about refer here
Then, in your gradle add the following lib's
androidTestCompile 'com.android.support:support-annotations:23.1.0'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
compile 'com.google.android.gms:play-services:7+'
compile 'com.android.support:appcompat-v7:23.4.0'
Hope it will help.!
Please be sure about your library, because your compileSdkVersion and buildToolsVersion both are different so please set same, its not required but its better for us. Your compile 'com.android.support:appcompat-v7:23.4.0' library version is also different. Please set compileSdkVersion 24 and buildToolsVersion 24.0.0 same. I suggest that use compileSdkVersion and buildToolsVersion and your every library version will be same .
In my case i used as below and it's working fine for me
android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
}
configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:23.0.1'
}
...
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude module: 'support-annotations'
exclude module: 'support-v4'
exclude module: 'support-v13'
exclude module: 'recyclerview-v7'
exclude module: 'design'
module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:design:24.0.0'
compile 'com.google.firebase:firebase-appindexing:10.0.0'
}

Categories

Resources