Android libraries: versions conflict issue - android

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)

Related

Android Apk Install not working

I have a problem with an app I developing right now.
When I build a signed APK(with V1 & V2) I can only install it on my own phone(Android 5.0.1). Anyone else(friends with different(all higher) Android versions) can't install the app.
Points I have found that might help to find a solution:
I renamed the app
when other people want to install the app it says not special permissions required, but actually, the app needs a few. When I install the app it asks correctly.
2000x2000 png icon
More Information:
minSdkVersion 21, targetSdkVersion 25
Dependencies:
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 group: 'commons-io', name: 'commons-io', version: '2.5'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.google.android.gms:play-services:11.0.4'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.code.gson:gson:2.8.2'
compile 'com.wang.avi:library:2.1.3'
compile 'com.android.support:support-v4:25.3.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
Thanks!

Android Studio Error- failed to resolve support-v4:24.0.0

Greeting
I am new to Android Studio and I run my app and I got the following error:
Failed to resolve: com.android.support: support-v4:24.0.0-beta1
I need to know the reason behind this error and how to fix it.
Can any Android Studio expert help me in this?
THANKS
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.andoid.support: support-v4:25.3.1'
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'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.android.support:support-v4:25.1.1'
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.1.1'
}
I need to know the reason behind this error
In your module's build.gradle file (e.g., app/build.gradle), you have a line like:
compile 'com.android.support:support-v4:24.0.0-beta1'
I do not know why you are requesting an out-of-date beta of this library.
how to fix it
Change the version number to something more current. Ideally, you set your compileSdkVersion to be 25, then use:
compile 'com.android.support:support-v4:25.3.1'
as version 25.3.1 is the now-current version of this library.

Gradle indentation issue in Android Studio 2.3

Every time I create a new Activity in AS 2.3 it messes up the build.gradle indentation that results in errors like this.
Error:Could not get unknown property 'compile' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
I have to redo the indentations every time. Any idea how to fix this permanently?
Don't use compile as a property and don't change the gradle structure.
compile 'com.android.support:appcompat-v7:22.2.1' compile
'com.parse:parse-android:1.11.0'
Sometimes Gradle build messes up the code like above, it still happens. Probably related to Java JDK updates.
The problem seems to be caused by the lines which contain curly braces like:
compile('com.github.tony19:logback-android-core:1.1.1-4') {
exclude group: 'ch.qos.logback.core.net'
}
In order to avoid the bug just put all the lines with curly braces above the "usual" (i.e. compile 'something') lines like this:
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.github.tony19:logback-android-core:1.1.1-4') {
exclude group: 'ch.qos.logback.core.net'
}
compile('com.github.tony19:logback-android-classic:1.1.1-4') {
exclude group: 'ch.qos.logback.core.net'
}
compile 'com.bolyartech.forge.android:forge-android:6.1.0'
compile 'com.bolyartech.scram_sasl:scram_sasl:2.0.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.squareup:otto:1.3.6'
compile 'com.google.code.gson:gson:2.7'
compile 'com.github.franmontiel:PersistentCookieJar:v0.9.3'
compile 'com.google.dagger:dagger:2.9'
...

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

Crouton depends on libraries but is not a library itself

I'm using Android Studio 0.6.1, with Crouton library and today after gradle sync I got next error:
Error:A problem occurred configuring root project 'project_name'.
Module version de.keyboardsurfer.android.widget:crouton:1.8.4 depends on libraries but is not a library itself
That's going on?
This issue due to com.android.support-v4 recent update.
So I changed
compile 'com.android.support:support-v4:20.+'
to
compile 'com.android.support:support-v4:19.1.+'
and crouton works fine
Different workaround is to use #aar:
compile('de.keyboardsurfer.android.widget:crouton:1.8.4#aar') {
exclude group: 'com.google.android', module: 'support-v4'
}
My solution according to #Revedko answer, using #aar and change all supports to version lower than 21 -> 20.+
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.loopj.android:android-async-http:1.+'
compile "com.bugsense.trace:bugsense:3.5"
compile('de.keyboardsurfer.android.widget:crouton:1.8.4#aar') {
exclude group: 'com.google.android', module: 'support-v4'
}
compile 'com.android.support:appcompat-v7:20.+'
compile 'com.google.android.gms:play-services:5.0.77'
}

Categories

Resources