After adding Android Facebook SDK dependencies
compile 'com.facebook.android:facebook-android-sdk:4.21.0'
I'm getting error in
compile 'com.android.support:appcompat-v7:25.3.1'
But Project is running fine.
All com.android.support libraries must use the exact same version
specification (mixing versions can lead to runtime crashes). Found
versions 25.3.1, 25.0.0. Examples include
com.android.support:animated-vector-drawable:25.3.1 and
com.android.support:cardview-v7:25.0.0 less... (Ctrl+F1)
There are some combinations of libraries, or tools and libraries, that
are incompatible, or can lead to bugs. One such incompatibility is
compiling with a version of the Android support libraries that is not
the latest version (or in particular, a version lower than your
targetSdkVersion.)
Build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
repositories {
mavenCentral()
}
defaultConfig {
applicationId "sujeet.raj.com"
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'
testCompile 'junit:junit:4.12'
compile 'com.facebook.android:facebook-android-sdk:4.21.0'
}
This problem occurs due to different version of dependency files get downloaded.
Explicitly put this as well in gradle file and sync again.
compile 'com.android.support:animated-vector-drawable:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
Under this directory you can find these libraries getting downloaded
Project Files/Your project/.idea/libraries
Don't ask me why but this solved it for me:
android {
/.../
configurations.all {
resolutionStrategy.force 'com.android.support:cardview-v7:27.1.0'
resolutionStrategy.force 'com.android.support:animated-verctor-drawable:27.1.0'
resolutionStrategy.force 'com.android.support:customtabs:27.1.0'
resolutionStrategy.force 'com.google.android.gms:play-services-base:12.0.1'
resolutionStrategy.force 'com.google.android.gms:play-services-auth:12.0.1'
}
}
You can solve this with one of the following solutions: original here
Run a Gradle dependency report to see what your full tree of dependencies is. From there, you will see which one of your libraries is asking for a different version of the Android Support libraries. For whatever it is asking for, you can ask for it directly with the 25.2.0 version, or use Gradle's other conflict resolution approaches to arrange to get the same version.
Run:
./gradlew -q dependencies <module-name>:dependencies --configuration compile
Example:
./gradlew -q dependencies app:dependencies --configuration compile
For me, the error disappeared after removing com.google.android.gms:play-services:10.2.0
And only include com.google.android.gms:play-services-location:10.2.0 and com.google.android.gms:play-services-maps:10.2.0 as they are the only two play services that I use.
I think the gms:play-services depend on some old components of the support library, so we need to add them explicitly ourselves.
Maybe I am too late for this, but well, trying to be helpful here... this is how I solve it.
open
project/your project/.idea/libraries
then head to facebook sdk and you can see this
library name="facebook-android-sdk-4.22.1"
use the number "4.22.1" into the one in build.gradle
this is how I do it, I am too a beginner myself.
Related
Android studio has automatically update the following components to API 26:
ROM - SDK to API 26
Android SDK Build-Tools 26
Android Emulator 26.0.3
Android SDK Platforms-Tools 26.0.0
Android SDK Tools 26.0.2
My gradle 2.3.3:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.0'
defaultConfig {
applicationId "com.mycompany.myapplication"
minSdkVersion 15
targetSdkVersion 26
versionCode 4
versionName "0.0.4"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
/////////If I change it to 26.0.0 it gives errors.///////////
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:support-vector-drawable:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
/////////////////////////////////////////////////////////////
testCompile 'junit:junit:4.12'
}
I have two questions (see commented line in Gradle):
How can I know the latest version of these libraries (I simply throw random numbers and try to up them until I found the latest version).
In the excluded group there is 'com.android.support', if I delete that do I need to specify those libraries? I see many people including 'com.android.support' libraries this way so there is a reason I guess to do so.
I searched in developer.android.com and the latest version is 24.2.0 (so really old I have been using 25.3.1).
If you really want to use the 26 version you could use the + character at the end of your dependencies.
compile 'com.android.support:appcompat-v7:26+'
This way, grade will take the latest version beginning with 26.?.? of your dependency. But you will get a warning from Android Studio, because between two different versions the behavior could eventually change and then produce random effect.
To know the latest version, just take a look here : https://developer.android.com/topic/libraries/support-library/revisions.html
And to finish, if you include 'com.android.support', you will include the whole library. And you certainly not need all the stuff included. If you only use recycler view just add :
compile 'com.android.support:recyclerview-v7:26.0.0-beta2'
Check https://developer.android.com/topic/libraries/support-library/revisions.html and set language to English at footer to check latest version of support library. Currently is 25.4.0 (stable) or 26.0.0 (beta 2)
Try this:
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
Thanks for reporting your issue.upcoming 6.0.0 release includes support for Java 8 features, therefore in order to run it (or any of the betas) you need to upgrade your project to include Java 8 support by adding this into you app's gradle file:
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
i was working on a project, everything was fine but when i tried to run the app, i couldn't,i guess because i'm using a bundled version of google play services. so i i made sure that i update android studio and install the lastest google repository.
but it still wouldn't work. And when i click on install Repostiroy and sync project, still nothing happens.
please help me : this is my gradle ;
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.nefissa.pfe2"
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.android.support:design:25.1.0'
compile 'com.android.support:cardview-v7:25.1.0'
compile 'com.google.android.gms:play-services:25.1.0'
testCompile 'junit:junit:4.12'
}
please where did i go wrong?
a screenshot;please what can i do? the click on install wouldn't work
replace it with compile 'com.google.android.gms:play-services:10.2.0'
and add apply plugin: 'com.google.gms.google-services' on the bottom of your gradle,
and make sure you added classpath 'com.google.gms:google-services:3.0.0'
in the Top-level build.gradle file
There might one of these problems can cause this issue, try any one of them.
Solution 1:
Try to updated the gradle plugin.
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
Then just Build->Clean project and everything works again.
Solution 2:
Go to the main module in your project, it's usually have the name app.
Then go to > Open Module Settings > in Properties change the Build Tools Version to 25.0.1
Then to make sure open the build.gradle file, and change compileSDKVersion & buildToolsVersion to 25 and 25.0.1 respectively.
If the above solution doesnt work.
Solution 3:
From this answer
"build cache" is enabled by default in build Android Plugin since 2.3.0. It creates files in build cache outside of project folder (e.g. in \Users\%username%.android\build-cache). Theese files are intended to be common between your projects.
And then Android Studio is unable to navigate in theese files.
You can disable Build Cache in gradle.properties file. just add android.enableBuildCache=false
While setting compile 'com.google.android.gms:play-services-appindexing:10.0.0' it is giving following error:
Error:(82, 13) Failed to resolve: com.google.android.gms:play-services-appindexing:10.0.0
and while setting compile 'com.google.android.gms:play-services-appindexing:9.8.0' it is giving following error:
Error:Execution failed for task ':app:processDebugGoogleServices'.
> Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 10.0.0.
It would be grateful if someone can tell me whats wrong with this because rest play services version 10.0.0 working fine.
my build.gradle file
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.22.0'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
signingConfigs {
}
compileSdkVersion 25
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.example.app"
minSdkVersion 15
targetSdkVersion 25
versionCode 41
versionName "2.2.0"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
}
debug {
signingConfig signingConfigs.config
}
}
lintOptions {
checkReleaseBuilds false
}
}
configurations {
compile.exclude group: 'stax'
compile.exclude group: 'xpp3'
}
repositories {
maven {
url "http://dl.bintray.com/microsoftazuremobile/SDK"
}
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
//Microsoft azure
compile 'com.microsoft.azure:azure-notifications-handler:1.0.1#aar'
compile files('libs/notification-hubs-0.4.jar')
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.android.support:support-v4:25.0.1'
compile 'com.android.support:recyclerview-v7:25.0.1'
compile 'com.android.support:cardview-v7:25.0.1'
compile 'com.android.support:design:25.0.1'
compile 'com.android.support:palette-v7:25.0.1'
compile 'com.google.android.gms:play-services-auth:10.0.0'
compile 'com.google.android.gms:play-services-maps:10.0.0'
compile 'com.google.android.gms:play-services-analytics:10.0.0'
compile 'com.google.android.gms:play-services-gcm:10.0.0'
compile 'com.google.android.gms:play-services-appindexing:10.0.0'
compile 'com.google.android.gms:play-services-base:10.0.0'
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.android.support:multidex:1.0.1'
//Facebook SDK
compile 'com.facebook.android:facebook-android-sdk:4.17.0'
}
apply plugin: 'com.google.gms.google-services'
The appindexing library you are looking for is now under a new gradle target.
You want to add compile 'com.google.firebase:firebase-appindexing:10.0.0' to your app's build.gradle file :)
You can see the up-to-date libraries here.
Now Google Play Services Version 10.0.1 has released so replace this
compile 'com.google.android.gms:play-services-appindexing:10.0.0'
by compile 'com.google.firebase:firebase-appindexing:10.0.1'
Hi, anytime you come across this type of error, the first thing to do is usually to check if you have the latest version of google repository installed in your Android Studio. I had the same issue and after updating as everything works fine. Hope it helps.
I had to do two things.
Add:
compile 'com.google.firebase:firebase-appindexing:10.0.0'
which apparently is new. This API is now listed as a sole firebase API among all the Google Play services setup APIs here. Also REMOVE the play-services-appindexing compile this API replaces:
//no longer include 'play-services-appindexing' compile
//compile 'com.google.android.gms:play-services-appindexing:10.0.0
I had removed the play-services-ads compile when first installing firebase services months ago, as instructed by docs, although including it does not crash the project compile like including play-services-appindexing now does.
On uploading the release apk, I found three permissions unfortunately now added to my required permissions after upgrading my sdks and adding the firebase-appindexing compile. These were not in my manifest:
android.permission.READ_EXTERNAL_STORAGE,
android.permission.READ_PHONE_STATE, and
android.permission.WRITE_EXTERNAL_STORAGE
Edit 12/9/16: As commented by Gaurav, play-services version 10.0.1 has eliminated the added 'dangerous' permissions of READ_PHONE_STATE, READ_EXTERNAL_STORAGE, and WRITE_EXTERNAL_STORAGE, resulting I expect from a manifest merge in version 10.0.0. These permissions call a special dialogue box that can discourage your users from continuing with your app ('Is this game trying to take over my phone?'). If you use firebase compiles, be sure to upgrade all of those to 10.0.1 too. They won't be grayed out like the play-services compiles, an unfortunate inconsistency in the app gradle upgrade warnings. If you neglect to upgrade the firebase compiles to match the play-services compiles you get the infamous 'cannot access zzanb after using play-services' project compile crash - Firebase Error cannot access zzanb after using play-services-xxx:9.8.00.
Do i need to add any jar file. or need to and any dependencies
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'org.apache.httpcomponents:httpcore:4.4.1'
compile 'org.apache.httpcomponents:httpclient:4.5'
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http. client:4.1.2'
compile "org.apache.httpcomponents:httpmime:4.2.3"
}
And it displays this error in console:
Warning:Dependency org.apache.httpcomponents:httpclient:4.5 is ignored for debug as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
Warning:Dependency org.apache.httpcomponents:httpclient:4.5 is ignored for release as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
On the contrary, you need to remove a dependency. The warning message is telling you that you're trying to import a dependency that's already included in Android. So you might not need the line
compile 'org.apache.httpcomponents:httpclient:4.5' #Try removing this line
Try removing it and see if the app works correctly. If it doesn't and you still need to import HttpClient, please refer to this page (it's posted just a few days go by apache.org, it doesn't get any more official than that).
The link above basically tells you that you should use:
Apache HttpClient 4.3 port for Android when targeting Android API 22 and older
dependencies {
compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5.1'
}
or
Apache HttpClient packages for Android maintained by Marek Sebera when targeting Android API 23 and newer
dependencies {
compile group: 'cz.msebera.android' , name: 'httpclient', version: '4.4.1.1'
}
I've been developing this small project for some days now but suddenly today, Android Studio started to give me this error
Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 14 cannot be smaller than version 14 declared in library com.android.support:support-v4:21.0.0-rc1
I understood that it is because it's trying to compile the library of Android-L. The version I want it to compile is the old version but it won't. It keeps giving me the above error no matter which version I enter. Here is the dependencies.
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:20.+'
compile 'com.android.support:support-v4:20.+'
}
UPDATE
I just installed Android Studio Beta and changed my dependencies to the one Eugen suggested below. But syncing the project gives the same error no matter which version of appcompat, support version I specify. It gives this error every single time I sync
uses-sdk:minSdkVersion 14 cannot be smaller than version L declared in library com.android.support:support-v4:21.0.0-rc1
My updated dependencies
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:19.+'
compile 'com.android.support:support-v4:19.+'
}
UPDATE 2
I don't think I understand the dependencies system of Android Studio correctly. I just removed both the appcompat and support from the dependencies and it still gives me the same error. Do I have to remove the initially included libraries from somewhere?
build.gradle
*note - I added those two libraries back in again and tried syncing, just in case. But no chenges.
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion "19.1.0"
defaultConfig {
applicationId "taz.starz.footynews"
minSdkVersion 14
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:19.+'
compile 'com.android.support:support-v4:19.+'
compile project(':ParallaxScroll')
compile files('src/main/libs/Header2ActionBar-0.2.1.jar')
compile 'com.arasthel:gnavdrawer-library:+'
compile 'com.koushikdutta.ion:ion:1.2.4'
}
Top level build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.+'
}
}
allprojects {
repositories {
mavenCentral()
}
}
UPDATE: Found the real fix for my case. Make sure none of your dependencies are silently including support-v4 r21 by doing this in your build.gradle:
compile("com.blahblah:blah:123") {
exclude group: 'com.android.support', module:'support-v4'
}
You can add the exclude to all libraries, then remove one-by-one until you figure out which one was pulling in support-v4 and giving you the error. And leave exclude on that one.
There is a new bug filed here: https://code.google.com/p/android/issues/detail?id=72430
Assuming you are using the Support Repository, the workaround is to comment or remove the line
<version>21.0.0-rc1</version>
in the local Maven repo listing file at <android-sdk>/extras/android/m2repository/com/android/support-v4/maven-metadata.xml
With the last updates, using this:
compile 'com.android.support:support-v4:20.+'
or
compile 'com.android.support:support-v4:+'
you are using the support lib in L-preview.
These support libs are declaring minSdkVersion L.
You have to force the minSdkVersion to be 'L' (check the doc)
This is because these APIs are not final. It is a way to prevent installing the apps on a final API 21 device or publishing it on the store using support lib 21-r1.
Using
compile 'com.android.support:support-v4:19.1.0'
you are using the "old" support library 19.1.0.
I had the same issue as one of my dependencies had specified 'support-v7:+' as a dependency. I was able to track this down using gradle dependencies
Gradle provides a way to force resolution to a specific version. I ended up having this in my build.grade:
compile('com.android.support:appcompat-v7:19.1.0') {
// really use 19.1.0 even if something else resolves higher
force = true
}
compile('com.android.support:support-v4:19.1.0'){
force = true
}
This worked for me
That is correct. The new support library is not compatible (yet) with old Android versions.
Change your gradle to:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:19.1.+'
compile 'com.android.support:support-v4:19.1.+'
}
I hope your still have something like this:
android {
compileSdkVersion 19
buildToolsVersion '19.1.0'
defaultConfig {
minSdkVersion 14
targetSdkVersion 19
}
}
I was getting the error:
Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : uses-sdk:minSdkVersion 1 cannot be smaller than version 4 declared in library
C:\Users\Igor\AppData\Local\Android\sdk\samples\android-21_1\legacy\ApiDemos\app\build\intermediates\exploded-aar\com.android.support\support-v4\21.0.3\AndroidManifest.xml
Suggestion: use tools:overrideLibrary="android.support.v4" to force
usage
Then I resolved it by putting the following in my defaultConfig gradle block:
minSdkVersion 15
targetSdkVersion 21
In Android SDK Manager install "Android Support Repository" from "extra" group. It helps me. When I added "exclude group: 'com.android.support', module:'support-v4'" build was completed, but some other errors was occured