I am building a android application with gradle in Android Studio, and i have a dependency jackson-databind, but i get a error can't resolve xxx, even i use my private repo and i sure that library is there.
apply plugin: 'com.android.application'
repositories {
mavenCentral()
}
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:recyclerview-v7:25.0.0'
compile 'com.android.support:cardview-v7:25.0.0'
compile 'com.fasterxml.jackson.core:jackson-core:2.8.1'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.8.1'
compile 'com.fasterxml.jackson.core:jackson-databind:2.8.1'
testCompile 'junit:junit:4.12'
}
And i get a error.
I update my gradle to 3.2 and it work well.
Sounds like you may just need to sync your build.gradle file, click the "Sync Now" like in this image here: https://postimg.org/image/v0yro39cl/
Related
I'm getting this message in android studio:
Failed to resolve: com.google.android.gms:play-services-appindexing:11.0.0...
What do I have to do?
My 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:25.3.1'
compile 'com.google.firebase:firebase-database:11.0.1'
compile 'com.google.firebase:firebase-auth:11.0.1'
compile 'com.google.android.gms:play-services-appindexing:11.0.0'
compile 'com.android.support:design:25.3.1'
compile 'com.google.firebase:firebase-core:11.0.1'
testCompile 'junit:junit:4.12'
apply plugin: 'com.google.gms.google-services'
I've recived this message from the start.
Thank you so much.
Try update or install Google Repository
Tools -> SDK Manager -> Google Repository
Have you added google maven repo?
repositories {
// google before jcenter to avoid mailicious artifacts
maven { url 'https://maven.google.com' } // or simple google() on gradle 4.0+
jcenter()
...
}
I've the below dependence in my Android app build.gradle
compileSdkVersion 25
buildToolsVersion "25.0.2"
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:design:25.0.0'
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.google.android.gms:play-services:10.0.1'
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.google.firebase:firebase-messaging:10.0.1'
compile 'com.firebase:firebase-jobdispatcher-with-gcm-dep:0.6.0'
compile 'com.google.firebase:firebase-appindexing:10.0.1'
compile 'com.google.firebase:firebase-ads:10.0.1'
testCompile 'junit:junit:4.12'
compile 'com.android.support:multidex:1.0.1'
}
but getting an error about versions compatibility, as shown below, what is the one to be changed here, i could not figure it out :(
I had same problem what i did was compile the higher version of libraries ,which were creating this error,in app:gradle only.
for example in your case
compile 'com.android.support:mediarouter-v7:25.0.0'
Add this in app:gradle.
There may be more like this mediarouter libraries if it still give error add them jst like this(making them higher version).
First you need to find out where's what consists of a conflicting version of the library. The easiest way to do so is to:
Open Terminal pane in your Android Studio.
Type in: ./gradlew androidDependencies
Find the row that represents the ENCLOSING library consisting of a conflict.
Then just use exclude statement for the conflicting library, like so:
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
(the example assuming com.android.support.test.espresso:espresso-core:2.2.2 was the ENCLOSING library, and com.android.support:support-annotations being the conflict)
I am using glide and firebase to manage my upload and download image to show a user profile pic, i follow the github repo where it talks about the firebaseUI and the glide, at the begin when my project worked fine my app gradle was like that:
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.google.firebase:firebase-auth:10.0.1'
compile 'com.android.support:design:25.2.0'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.google.firebase:firebase-storage:10.0.1'
testCompile 'junit:junit:4.12'
after reading the docs where it says that if i want to include the firebaseUI version i need to upgrade all the compiles related to firebase to 10.2.0, i did this:
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.google.firebase:firebase-auth:10.2.0'
compile 'com.android.support:design:25.2.0'
compile 'com.google.firebase:firebase-database:10.2.0'
compile 'com.google.firebase:firebase-storage:10.2.0'
compile 'com.firebaseui:firebase-ui:1.2.0'
testCompile 'junit:junit:4.12'
}
but i keep getting a error on my first compile: compile 'com.android.support:appcompat-v7:25.2.0'
the error is the following:
All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 25.2.0, 25.1.1. Examples include com.android.support:animated-vector-drawable:25.2.0 and com.android.support:cardview-v7:25.1.
my project gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
maven {
url 'https://maven.fabric.io/public'}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
need some help here im confused about this error :S
first, this is not relevant with Glide library.
gradle says "this project has different versions of android support packages", so you must use all com.android.support packages with same version. for example your project has '25.2.0' and '25.1.1'.
How can I achieve this ? Put this block to app level build.gradle
android {
...
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '25.2.0'
}
}
}
}
dependencies {
...
}
you can say "But I just compile my all android support packages with same level which is 25.2.0". some libraries includes android support packages and 25.1.1 is coming from your dependency.
I am new to Android App Development. I am trying to create an Android app using TabLayout and have added the following dependencies in the build.gradle file.
dependencies {
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:support-v4:25.3.1'
testCompile 'junit:junit:4.12'
}
But on running the App, I am getting build error as follows
Error:(27, 0) Gradle DSL method not found: 'compile()'
Possible causes:The project 'MyFirstapp' may be using a version of Gradle that does not contain the method.
Open Gradle wrapper fileThe build file may be missing a Gradle plugin.
Apply Gradle plugin
Any suggestions on why this problem is there. I get an option to install Plugin from Android Studio but I don't know which plugin to install.
I'm guessing you are adding dependencies to the wrong build.gradle.
Try doing this:
In your first build.gradle replace the dependencies with this
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
}
and replace dependencies in build.gradle(Module:app) (2nd build.gradle file) with this
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'
testCompile 'junit:junit:4.12'
}
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