execution failed for task:app-merge debug resources. Some file crunching failed.
this is the message shown
these i have used
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.0.1'
}
You problem seems to be because of the import of different versions of appcompat-v7 and design.
Update the gradle import of design to version 23.2.1, like:
compile 'com.android.support:design:23.2.1'
Related
Below is the error I am getting after adding the Firebase, google services in gradle and google-services.json in app module.
I have 13 modules in my app. I have 7 build variants in all the modules. I tried with placing the google-services.json in app module and placing it in build variant folder inside the app module. I am getting same error. I have the notification feature in one build variant.
I removed the firebase related code in gradle and google-services.json from application, it is working perfectly.
Due to security reason I can't share the entire file.
Main app module gradle:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.4-beta1'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
compile('com.crashlytics.sdk.android:crashlytics:2.6.2#aar') {
transitive = true;
}
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.jakewharton:butterknife:8.2.1'
apt 'com.jakewharton:butterknife-compiler:8.2.1'
compile 'com.github.hotchemi:permissionsdispatcher:2.0.7'
apt 'com.github.hotchemi:permissionsdispatcher-processor:2.0.7'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.android.support:multidex:1.0.1'
}
In Application gradle:
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'com.google.gms:google-services:3.0.0'
}
:app:transformClassesWithJarMergingForSmePreDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformClassesWithJarMergingForSmePreDebug'.>
com.android.build.api.transform.TransformException:
java.util.zip.ZipException: duplicate entry:
com/google/android/gms/common/api/zza.class
I reffered many links in StackOverflow for this issue. None fixed my problem. Any suggestions appreciated.
Edited push notification module gradle:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
//compile 'com.google.android.gms:play-services-gcm:9.0.0'
compile 'com.google.firebase:firebase-messaging:9.8.0'
//compile ('com.google.firebase:firebase-messaging:9.8.0') {
//exclude group: 'com.google.android.gms'
//}
}
apply plugin: 'com.google.gms.google-services'
This issue might because you have duplicate dependencies. One has latest version and the other one has old version.
What you can do is
check your app dependecies.
./gradlew clean :app:dependencies
find 3rd party libraries that also have com.google.android.gms included.
exclude this group from the library
compile ('library') {
exclude group: 'com.google.android.gms'
}
This might be able to be a quick fix. But it's not good!
The best solution should be updating your 3rd party library, their latest version might update their google services library already.
I have the next gradle file:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
classpath 'com.google.gms:google-services:2.0.0-alpha3'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'org.apache.httpcomponents:httpcore:4.4.1'
compile 'org.apache.httpcomponents:httpclient:4.5'
compile 'org.apache.httpcomponents:httpcore:4.4.1'
compile 'org.apache.httpcomponents:httpclient:4.5'
compile 'com.android.support:design:23.2.1'
compile 'com.loopj.android:android-async-http:1.4.4'
compile 'com.google.android.gms:play-services-base:8.4.0'
compile 'com.google.android.gms:play-services-location:7.3.0'
compile 'com.google.gms:google-services:2.1.0-rc1'
}
I'm getting error in the lines starting with: compile 'com.google.android.gms
The error is:
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 8.3.0.
How I can know what version are available for this specific component?
You should keep the version of com.google.android.gms libraries the same. If you are going to use v. 8.4.0 for the services.base, then you should always keep the others the same. So, you should also set services-location to the same version:
compile 'com.google.android.gms:play-services-base:8.4.0'
compile 'com.google.android.gms:play-services-location:8.4.0'
See Google Play Services for more version information.
Also, here is a similar question that is helpful for general Gradle setup as well: Version conflict updating to 8.4.0
Say I have a library module which contains some 3rd party libraries like OkHttp. When I include this library in my application I was unable to use these 3rd party libraries. I read the following articles Article 1,
Article 2
and tried
1. compile project(':library-name')
{after importing the .aar file(of library) as a module into myproject}
2. I included the .aar file in libs folder and added following dependencies
build.gradle(project level)
allprojects {
repositories {
flatDir {
dirs 'libs'
}
}
}
build.gradle(application level)
compile fileTree(dir: 'libs', include: ['*.jar'])
compile ('com.myapp.package:library-name:1.0.0#aar'){
transitive=true
}
3. similar to 2nd but in
build.gradle(application level)
compile fileTree(dir: 'libs', include: ['*.jar'])
compile (name:'library-name', ext:'aar'){
transitive=true
}
But, still I was unable to use the transitive libraries which are present in my library. I am getting following exception.
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/squareup/okhttp/MediaType;
Can someone help
EDIT:
The following is build.gradle of my library
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'org.apache.httpcomponents:httpcore:4.4.4'
compile 'org.apache.httpcomponents:httpclient:4.5.1'
compile 'com.squareup.okhttp:okhttp:2.6.0'
compile 'petrov.kristiyan.colorpicker:colorpicker-library:1.0.3'
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.10.19'
testCompile 'org.hamcrest:hamcrest-library:1.1'
compile files('notificationlog-0.1.0.jar')
I was able to use the notificationlog in my application which was a dependency in my library, but I was unable to use okhttp and colorpicker
The aar file doesn't contain the nested (or transitive) dependencies and doesn't have a pom file which describes the dependencies used by the library.
It means that, if you are importing a aar file using a flatDir repo you have to specify the dependencies also in your project.
It doesn't make sense:
compile (name:'library-name', ext:'aar'){
transitive=true
}
because the aar is without a pom file which describes the dependencies, then gradle is unable to add any dependencies because it can't know them.
I'm making an interactive login app with Android Studio and wampserver. After creating the Android Studio project, I changed the build.gradle like this:
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:support-v4:21.0.3'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Then the IDE keeps showing the following error:
(((Gradle DSL method not found: 'compile()
Possible causes:The project 'Login_wamp' may be using a version of Gradle that does not contain the method.
The build file may be missing a Gradle plugin.
Apply Gradle plugin )))
When I click on Apply gradle plugin, it shows me a lot of plugins. Should I pick one of these options?
What should I do to fix this error?
UPDATE
I have moved the above lines to the other build.gradle file, but I get 2 other problems now:
the support library should not use the different version(21) than the compileSDK version(23).
These lines are my gradles exact shape. Which "21" should be changed to "23" or which "23" should be changed into "21"?
I have changed the
compile 'com.android.support:appcompat-v7:21.0.3' to
compile 'com.android.support:appcompat-v7:23.0.3' and it says that I should Install Repository and sync project.
Here is my build.gradle:
compileSdkVersion 23
buildToolsVersion "23.0.1"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:appcompat-v7:23.0.3'
compile 'com.android.support:support-v4:21.0.3'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
}
You are using the top level build.gradle
root
|--app
|----build.gradle
|--build.gradle //top level file
|--settings.gradle
In this file you can't use the compile statement:(it is the reason of your issue)
Just move these lines:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.1'
//REMOVE THESE LINES
//compile 'com.android.support:appcompat-v7:21.0.3'
//compile 'com.android.support:support-v4:21.0.3'
//compile 'com.mcxiaoke.volley:library-aar:1.0.0'
}
}
Then you have to add the dependencies in your module/build.gradle file.
EDIT: After your comment.
In your module/build.gradlefile:
use the same version for all support libraries
use the latest (currenlty 23.1.1)
dont' add the same library twice (appcompat)
the 23.0.3 doesn't exist
Here the changes:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1' //update to 23.1.1
//compile 'com.android.support:appcompat-v7:23.0.3' //REMOVE THIS LINE. It doesn't exist and you adding twice
compile 'com.android.support:support-v4:23.1.1' //USE THE SAME VERSION
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
}
I think you are using the wrong build.grade file.
There are two gradle files in your Project.
One is called build.gradle (Project: YourProjectname)
The other one build.grade (Module: app).
Delete the following lines from build.gradle (Project: YourProjectname):
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:support-v4:21.0.3'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
Search the dependencies in your build.gradle (app: Module)
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
}
and add the compile lines there:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:support-v4:21.0.3'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
}
salam Mehdi. first of all you must open freegate and set proxy settings from android studio settings.(IP=127.0.0.1 and port=8580). after that you must click on apply gradle plugin to update your SDK. after updates done the error must gone. Hope this help you.
Gradle build error - more than one library with package name android.support.v7.appcompat. This project has Chrome Cast in it, so is using android-support-v7-appcompat and CastCompanionLibary-android-master. Project structure is the following:
BaseGameUtils
CastCompanionLibrary-android-master
VideoBrowserActivity
android-support-v7-appcompat
android-support-v7-mediarouter
google-play-services_lib
Really tough error because the compiler doesn't give much information other than 'more than one library with package name 'android.support.v7.appcompat'. Understand why you don't want to be using different versions of the same library, but why doesn't the compiler reveal what versions are being used, and where they are being called from?
Trying to add leaderboard similar to type-a-number challenge (github example project)
There are a total of (7) build.gradle files. One for the top level and one for each of the packages listed above. Top level gradle file:
// 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:1.0.0'
}
BaseGameUtils:
dependencies {
compile 'com.android.support:appcompat-v7:20.0.+'
compile 'com.android.support:support-v4:20.0.+'
compile 'com.google.android.gms:play-services-games:6.5+'
compile 'com.google.android.gms:play-services-plus:6.5+'
compile 'com.google.android.gms:play-services-appstate:6.5+'
}
CastCompanionLibrary-android-master
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile 'com.android.support:appcompat-v7:20.0.+'
compile project(':android-support-v7-mediarouter')
compile 'com.google.android.gms:play-services-cast:6.5+'
compile project(':BaseGameUtils')
}
VideoBrowserActivity
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':CastCompanionLibrary-android-master')
}
android-support-v7-appcompat
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
android-support-v7-mediarouter
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':android-support-v7-appcompat')
}
google-play-services_lib
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
Any help is appreciated on this.
Just go through you project's libs folder not from the Android Studio but from you windows explorer/finder (for windows)/(for mac). And search for android.support.v7.appcompat. Any evidence found related to Apcompat (whether it is v4 or v7) is recommended to be deleted.
Hopefully your problem will be solved.
In your libs folder dont miss any sub directory that has libs folder.
Follow the Steps
1) Remove This repository:
implementation 'com.android.support:appcompat-v7:28.0.0'
2) Add This Repository
implementation 'com.android.support:support-v4:21.0.3'
compile group: 'com.android.support', name: 'appcompat-v7', version: '26.0.1'
3) That's It You Are Ready To Go