I tried to transfer the Android Eclipse project to Android Studio, I tried both methods, opened directly from Android Studio and first switched to Gradle in Eclipse and then opened it in Android Studio.
Then I tried to delete the Google Play library folder and add it to the Gradle file, and then the project will do this:
- Make the project OK
- Clear project OK
- Rebuild project OK
- Gradle synchronize and load many dlls ok
- Play or debug KO and give me the following errors:
Error: execution completed for task .: GoSmart.guestperience.MoncloaDeSanLazaro: dexDebug
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: process command '/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java' "completed with non-zero output value 2
OR
Error: execution completed for task .: GoSmart.guestperience.MoncloaDeSanLazaro: dexDebug
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: process command '/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java' "completed with non-zero value of output 2
OR
Error: execution completed for task .: GoSmart.guestperience.MoncloaDeSanLazaro: dexDebug
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: process command '/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/bin/java' "completed with non-zero value of output 2
I started with JDK 1.6, and then upgraded to 1.7, and then to 1.8, to find out if this was a problem.
If I do not delete the Google Play Dervices folders, the project works fine.
I use MAC if it is important.
And if it is important to solve this problem, I have this other problem in my project, published in stack overflow.
This is what my project structure looks like:

And these are the build.grade files of all projects
The main warp project (guestperience 1.0.1 Moncloa De San Lazaro):
// 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:1.2.0' } }
goSmart.guestperience.MoncloaDeSanLazaro (here I am the code):
apply plugin: 'com.android.application' dependencies { compile fileTree(dir: 'libs', include: '*.jar') compile project(':librarySmartHotel') compile 'com.google.android.gms:play-services:7.3.0' } android { compileSdkVersion 16 buildToolsVersion "22.0.1" sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['src'] resources.srcDirs = ['src'] aidl.srcDirs = ['src'] renderscript.srcDirs = ['src'] res.srcDirs = ['res'] assets.srcDirs = ['assets'] } // Move the tests to tests/java, tests/res, etc... instrumentTest.setRoot('tests') // Move the build types to build-types/<type> // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ... // This moves them out of them default location under src/<type>/... which would // conflict with src/ being used by the main source set. // Adding new build types or product flavors should be accompanied // by a similar customization. debug.setRoot('build-types/debug') release.setRoot('build-types/release') } }
librarySmartHotel:
apply plugin: 'com.android.library' dependencies { compile fileTree(dir: 'libs', include: '*.jar') compile project(':main') } android { compileSdkVersion 16 buildToolsVersion '22.0.1' sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['src'] resources.srcDirs = ['src'] aidl.srcDirs = ['src'] renderscript.srcDirs = ['src'] res.srcDirs = ['res'] assets.srcDirs = ['assets'] } // Move the tests to tests/java, tests/res, etc... instrumentTest.setRoot('tests') // Move the build types to build-types/<type> // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ... // This moves them out of them default location under src/<type>/... which would // conflict with src/ being used by the main source set. // Adding new build types or product flavors should be accompanied // by a similar customization. debug.setRoot('build-types/debug') release.setRoot('build-types/release') } }
home:
apply plugin: 'com.android.library' dependencies { compile fileTree(dir: 'libs', include: '*.jar') } android { compileSdkVersion 16 buildToolsVersion '22.0.1' sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['src'] resources.srcDirs = ['src'] aidl.srcDirs = ['src'] renderscript.srcDirs = ['src'] res.srcDirs = ['res'] assets.srcDirs = ['assets'] } // Move the tests to tests/java, tests/res, etc... instrumentTest.setRoot('tests') // Move the build types to build-types/<type> // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ... // This moves them out of them default location under src/<type>/... which would // conflict with src/ being used by the main source set. // Adding new build types or product flavors should be accompanied // by a similar customization. debug.setRoot('build-types/debug') release.setRoot('build-types/release') } }
I think some configuration is missing (maybe), the truth is that I'm super lost.
I'm an iOS programmer, and this is my first steps in Android, the project was done by another guy, and now I have to continue, so let me say that I have a good fight with Android Studio and it looks like I'm losing; -P
Thanks for the help.
UPDATE:
I found this in the log:
AGPBI: {"kind": "SIMPLE", "text": "UNEXPECTED TOP LEVEL EXCEPTION:", "position": {}, "original": "UNEXPECTED TOP LEVEL EXCEPTION:"} AGPBI: {"kind" : "SIMPLE", "text": "com.android.dex.DexException: several dex files define Lcom / Google / Android / GMS / analytics / internal / Command $ 1;" "position": {}, "original": "com.android.dex.DexException: Several dex files define Lcom / google / android / gms / analytics / internal / Command $ 1;" } AGPBI: {"View": "SIMPLE", "Text": "\ tat com.android.dx.merge.DexMerger.readSortableTypes (DexMerger.javaโ96)" "Position": {}, "original": " \ tat com.android.dx.merge.DexMerger.readSortableTypes (DexMerger.javaโ96) "} AGPBI: {" kind ":" SIMPLE "," text ":" \ tat com.android.dx.merge.DexMerger. getSortedTypes (DexMerger.javaโ54) "" Position ": {}," original ":" \ tat com.android.dx.merge.DexMerger.getSortedTypes (DexMerger.javacla54) "} AGPBI: {" kind ": "SIMPLE", "text": "\ tat com.android.dx.merge.DexMerger.mergeClassDefs (DexMerger.javaโ35)" "position": {}, "original": "\ tat com.android.dx. merge.DexMerger.mergeClassDefs (DexMerger.java UP35) "} AGPBI: {" kind ":" SIMPLE "," text ":" \ tat com.android.dx.merge.DexMerger.mergeDexes (DexMerger.java:171) "" position ": {}," original ":" \ tat com.android.dx.merge.DexMerger.mergeDexes (DexMerger.java:171) "} AGPBI: {" View ":" SIMPLE "," Text ": "\ that t com.android.dx.merge.DexMerger.merge (DexMerger.java:189) "" position ": {}," original ":" \ tat com.android.dx.merge.DexMerger.merge (DexMerger.java: 189) "} AGPBI: {" View ":" SIMPLE "," Text ":" \ tat com.android.dx.command.dexer.Main.mergeLibraryDexBuffers (Main.java:454) "" Position ": {}, "original": "\ tat com.android.dx.command.dexer.Main.mergeLibraryDexBuffers (Main.java:454)"} AGPBI: {"kind": "SIMPLE", "text": "\ tat com.android .dx.command.dexer.Main.runMonoDex (Main.java:303) "" position ": {}," original ":" \ tat com.android.dx.command.dexer.Main.runMonoDex (Main.java: 303) "} AGPBI: {" View ":" SIMPLE "," Text ":" \ tat com.android.dx.command.dexer.Main.run (Main.java:246) "" position ": {}, "original": "\ tat com.android.dx.command.dexer.Main.run (Main.java:246)"} AGPBI: {"View": "SIMPLE", "Text": "\ tat com.android .dx.command.dexer.Main.main (Main.java:215) "" position " : {}, "original": "\ tat com.android.dx.command.dexer.Main.main (Main.java:215)"} AGPBI: {"View": "SIMPLE", "Text": "\ tat com.android.dx.command.Main.main (Main.java:106) "" position ": {}," original ":" \ tat com.android.dx.command.Main.main (Main.java: 106) "}