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

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.

Related

Gradle sync error when adding Material Spinner dependency

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

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

Libraries missing. "Install and Sync" not working

I opened my project and it shows me some errors, I'm starting in the world of Android now, so I don't know how to do this. I press over the install Repository and sync project but this doesn't do anything.
This is all the versions that I have in my project.
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "mx.com.dtss.carritocompras"
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:3.0.0', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile files('libs/ksoap2-android-assembly-3.0.0-jar-with-dependencies.jar')
compile group: 'com.google.code.gson', name: 'gson', version: '2.3'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.squareup.picasso:picasso:2.5.2'
testCompile 'junit:junit:4.12'
}
And these are the errors
How can I fix it?
first option is to click on Install Repository and sync project,
if that dosent work then you need to add the repository from the dependencies manually, go to File > Project Structure > Dependencies
click on + > Library dependency
and search for the missing repository
enter image description here

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'
})

Categories

Resources