Duplicate files in pom.xml - android-studio

Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK pom.xml
File1: /Users/michaelnares/Documents/TripMatcher2/app/libs/library_sliding.jar
File2: /Users/michaelnares/Documents/TripMatcher2/app/libs/roundedimageview.jar
Is there any way of viewing the pom.xml within Android Studio? I can only see build.gradle. My top-level build.gradle is as follows:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
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()
}
}
My app-level build.gradle is as follows:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.tripmatcher"
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 'com.google.android.gms:play-services-auth:9.2.1'
// glide is added to load the g+ profile image. Ignore if you want
compile 'com.github.bumptech.glide:glide:3.7.0'
compile fileTree(include: ['*.jar'], dir: 'libs')
apply plugin: 'com.google.gms.google-services'
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.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile files('libs/facebook_sdk.jar')
compile files('libs/android-support-v4.jar')
}
As far as I can see, everything should work fine.

We do not have a pom.xml in android projects using Android Studio, All dependencies of your project are in build.gradle file. The issue below is because you need to specify which libraries of google service you want to use. Like :
compile "com.google.android.gms:play-services-maps:10.2.1"

For anyone else coming across this problem, manually deleting the pom.xml file from the Eclipse project and then creating the .jar after that did the trick for me.

Related

Google API gradle errors when trying to compile code in Android Studio

I was following a guide on how to make an application similar to uber, I seem to have come across an issue not resolved by the guide. How do I get Android Studio to find the matching client for my package name? Also how do I go about updating the stated firebase build in the code?
I get a error that reads "org.gradle.api.GradleException: No matching client found for package name 'com.NovaTaxi.uber'"
The first solution I was able to find and test was changing the name of my file so that it didnt match the project name and that was of no help. Next I tried to download the completed version of the code to see if it would run for me, in an attempt to find what was wrong and replace it in my own work. To no avail it also wouldn't run because of the same error.
There is a lot of the code and I can't pin-point the error, so I will provide part of the error, and then a link to the vide/github so that you have a better scope of things.
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.NovaTaxi.uber"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation 'com.google.firebase:firebase-core:16.0.1'
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'
})
//noinspection GradleCompatible
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-core:11.6.0'
compile 'com.google.firebase:firebase-database:11.6.0'
compile 'com.google.firebase:firebase-auth:11.6.0'
compile 'com.google.firebase:firebase-storage:11.6.0'
compile 'com.firebase:geofire-android:2.1.1'
compile 'com.google.android.gms:play-services:11.6.0'
compile 'com.github.bumptech.glide:glide:4.0.0'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.github.jd-alexander:library:1.1.0'
compile 'com.paypal.sdk:paypal-android-sdk:2.15.3'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
There should be no error but because of what I assume is an issue with the gradle compatibles it wont compile.

appcompat-v7:28.0.0-beta01 Broke after update

I am beginner in Android studio and installed it yesterday. Then I created a empty project that worked just fine. Today I had to update and now I am fighting with that error message:
As you can see I already included the Examples. Any ideas how I can fix that?
Here the full app.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "at.sumser.fateandlove"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0-beta01'
implementation 'com.android.support:support-media-compat:26.1.0'
implementation 'com.android.support:animated-vector-drawable:28.0.0-beta01'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation'com.google.android.gms:play-services-location:15.0.1'
}
Funny, that it tells me to add 'com.android.support:support-media-compat:26.1.0' when the SDK is 28? Any ideas?
UPDATE
Here is also the build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.2.41'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Now the 'com.android.support:support-media-compat:26.1.0' does also tell me about a problem:
Question: Does Google not test their releases? Or is the autoresolver in Android Studio just broken? I lost now nearly 3 hours to find a fix for this issue...
I just had the same issue when updating to AppCompat version 28.
First I recommend to use the latest version which is 28.0.0-rc01 instead of 28.0.0-beta01.
If you then still get the warning that all libraries must use the exact same version specification, you can force to use the latest version for the corresponding library.
You can do so by adding a resolution strategy to your apps build.gradle file within android { } like this:
configurations.all {
resolutionStrategy {
force 'com.android.support:support-v4:28.0.0-rc01'
force 'com.android.support:support-media-compat:28.0.0-rc01'
force 'com.android.support:customtabs:28.0.0-rc01'
}
}

Error: more than one library with package name 'android.support.graphics.drawable'

I am trying to learn android studio. In this computer ( its not mine) android studio version is 2.2.3
When i created a new project while gradle build an error occurs.
Error:Execution failed for task ':app:processDebugResources'.
Error: more than one library with package name 'android.support.graphics.drawable'
I have been searching for this error for one day. I haven't found the same topic anywhere so i have to open this thread.Thanks for all answers from now.
this is build.gradle(project:myapplication2)
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and this is build.gradle(module:app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "28.0.0"
defaultConfig {
applicationId "com.example.alicetin.myapplication"
minSdkVersion 15
targetSdkVersion 28
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'])
compile 'com.android.support:appcompat-v7:28.+'
testCompile 'junit:junit:4.12'
}
Try
implementation 'com.android.support:appcompat-v7:27.1.1'
instead of
compile 'com.android.support:appcompat-v7:28.+'
appcompat-v7 version 28 is still alpha
Try
classpath 'com.android.tools.build:gradle:3.2.1'
instead of
classpath 'com.android.tools.build:gradle:2.2.3'
I faced the same issue and It worked for me.
Use:
compile 'com.android.support:appcompat-v7:27.+'
Instead of:
compile 'com.android.support:appcompat-v7:28.+'
I faced the exact same problem although my build.gradle(app) file has already been updated with the latest production version of SDK, tools and libraries.
The only thing left to check is the gradle version and in fact there was a warning saying that a newer gradle version is available. Please refer to image below.
more than one library with 'android.support.graphics.drawable'
Once I uprev the gradle version, the error got resolved.
So please upgrade your gradle version from 2.2.3 to a newer version.
"com.android.support:appcompat-v7" depends on "support-vector-drawable"
and
"com.android.support:design" depends on "animated-vector-drawable"
Add this to your build.gradle:
configurations.all {
exclude module: 'animated-vector-drawable'
}
Sush as:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
// ...
configurations.all {
exclude module: 'animated-vector-drawable'
}
}

failed to resolve com.android.support.espresso:espresso-core:2.2.2

I've just downloaded android studio for the first time and i'm getting gradle errors. I've downloaded everything the SDK provided and still the same errors.
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.noelly.myapplication"
minSdkVersion 19
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.+'
testCompile 'junit:junit:4.12'
}
The errors I'm getting are
(Failed to resolve: com.android.support.appcompat-v7:25.+)
and
(Failed to resolve: com.android.support.espresso:espresso-core:2.2.2)
Everything by the way is up to date,please help this is really frustrating starting out.
**EDIT FROM ANSWER ONE- PICTURE OF INSTALLED TOOLS---
sdktoolsscreenshot
Code form project build.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.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
New Error messages_____newerrorscreenshot
failed to resolve com.android.support.espresso:espresso-core:2.2.2
This error can occur when we refactor layout name.
I had the same problem and my mistake was that I had created the layout naming test.xml and then when I refactored that name with like layout_offers.xml, my gradle was changed something like
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.detail_layout.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
})
Whereas It should be like follow
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'
})
So, one solution is that we should avoid using test.xml as a layout name.
Here's how your gradle file should look like:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.noelly.myapplication"
minSdkVersion 19
targetSdkVersion 25
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:25.1.0'
}
Update:
There must be a problem with the SDK you downloaded. Navigate to C:/Users/Noelly/AppData/Local/Android/Sdk/extras/android/m2repository/com/android and delete the support folder.
Now open your SDK Manager and re-install the Android Support Repository.
I got same trouble as yours, and I have found how to solve the problem.
It was because I was using x86 operating system, while android studio was x64.
I went to https://developer.android.com/studio/index.html and pressed 'download option', and installed x86 version of android studio.
Do not uninstall your previous x64 android studio. It is required because of the android sdk.
unpack your x86 android studio anywhere, and find 'bin' folder. There should be your 'studio.exe'.
I got this same error message after renaming a layout file, although everything had just worked before. I fixed this by commenting out these lines from gradle:
androidTestCompile('com.android.support.detail_layout.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
I have no idea why this happened or if this is a good way of fixing it, only hoping that this could be a quick fix for some beginner like me.

Google services ; com.google.gms:google-services:2.1.2 ; failed to resolve services-measurement

Just trying to update to the latest google play services 9.4.0. If I leave the classpath in the application level gradle to 2.1.2 which seems to be the latest release as of June 03, link, I get the error failed to resolve :
Error:Failed to resolve: com.google.android.gms:play-services-measurement:9.4.0
Install Repository and sync project
I have already my packages updated in SDK manager.
If I leave the classpath as 3.0.0 which was the release of May things seem to be ok. Any idea as to why I get such error with the 2.1.2 version classpath? see below for my gradle files. Android Studio version : 2.1.3. Appreciate any help.
build.gradle Project Level:
buildscript {
repositories {
jcenter()
mavenLocal()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
classpath 'com.google.gms:google-services:2.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenLocal()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle app Level:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "com.example.main.projectone"
minSdkVersion 18
targetSdkVersion 24
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile('com.facebook.android:facebook-android-sdk:4.7.0') {
exclude module: 'bolts-android'
}
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:design:24.0.0'
compile 'com.parse:parse-android:1.13.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.github.bumptech.glide:okhttp3-integration:1.4.0#aar'
compile 'com.squareup.okhttp3:okhttp:3.3.1'
compile 'com.android.support:cardview-v7:24.0.0'
compile 'com.android.support:support-v4:24.0.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.8.1'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.android.support:recyclerview-v7:24.0.0'
compile 'com.firebase:geofire-android:2.0.0'
compile 'com.google.android.gms:play-services:9.4.0'
compile 'com.google.firebase:firebase-auth:9.4.0'
compile 'com.google.firebase:firebase-storage:9.4.0'
}
apply plugin: 'com.google.gms.google-services'
Since you are using the version 9.4.0 you have to use the google play service plugin v 3.0.0:
buildscript {
// ...
dependencies {
// ...
classpath 'com.google.gms:google-services:3.0.0'
}
}
Check the official documentation for the setup.

Resources