This question has already been answered:
IDE: Android Studio
I used this guide: https://habrahabr.ru/post/238327/ to connect Google services to my project. Imported libu (ProjectStructure -> android -> Dependencies -> com.google.android.gms: play-services: 8.4.0 -> [Scope]: Compile), further in the Manifesto added the necessary lines (from the guide), and then Gradl has broken:
Error: Execution failed for task ': android: dexDebug'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process' command 'C: \ Program Files \ Java \ jdk1.8.0_51 \ bin \ java.exe' finished with non- zero exit value 2
I did the Clean Project, the Rebuild Project, restarted the studio, rebooted the car, everything is OK with the memory, above 92% is not used, what to do - I don’t know.
Here is the Gradle log:
Information:Gradle tasks [:android:assembleDebug] :android:preBuild UP-TO-DATE :android:preDebugBuild UP-TO-DATE :android:checkDebugManifest :android:preReleaseBuild UP-TO-DATE :core:compileJava UP-TO-DATE :core:processResources UP-TO-DATE :core:classes UP-TO-DATE :core:jar UP-TO-DATE :android:prepareComAndroidSupportAppcompatV72300Library UP-TO-DATE :android:prepareComAndroidSupportMediarouterV72300Library UP-TO-DATE :android:prepareComAndroidSupportSupportV42300Library UP-TO-DATE :android:prepareComGoogleAndroidGmsPlayServices840Library UP-TO-DATE :android:prepareComGoogleAndroidGmsPlayServicesAds840Library UP-TO-DATE :android:prepareComGoogleAndroidGmsPlayServicesAnalytics840Library UP-TO-DATE :android:prepareComGoogleAndroidGmsPlayServicesAppindexing840Library UP-TO-DATE :android:prepareComGoogleAndroidGmsPlayServicesAppinvite840Library UP-TO-DATE :android:prepareComGoogleAndroidGmsPlayServicesAppstate840Library UP-TO-DATE :android:prepareComGoogleAndroidGmsPlayServicesAuth840Library UP-TO-DATE :android:prepareComGoogleAndroidGmsPlayServicesBase840Library UP-TO-DATE :android:prepareComGoogleAndroidGmsPlayServicesBasement840Library UP-TO-DATE :android:prepareComGoogleAndroidGmsPlayServicesCast840Library UP-TO-DATE :android:prepareComGoogleAndroidGmsPlayServicesDrive840Library UP-TO-DATE :android:prepareComGoogleAndroidGmsPlayServicesFitness840Library UP-TO-DATE :android:prepareComGoogleAndroidGmsPlayServicesGames840Library UP-TO-DATE :android:prepareComGoogleAndroidGmsPlayServicesGcm840Library UP-TO-DATE :android:prepareComGoogleAndroidGmsPlayServicesIdentity840Library UP-TO-DATE :android:prepareComGoogleAndroidGmsPlayServicesLocation840Library UP-TO-DATE :android:prepareComGoogleAndroidGmsPlayServicesMaps840Library UP-TO-DATE :android:prepareComGoogleAndroidGmsPlayServicesMeasurement840Library UP-TO-DATE :android:prepareComGoogleAndroidGmsPlayServicesNearby840Library UP-TO-DATE :android:prepareComGoogleAndroidGmsPlayServicesPanorama840Library UP-TO-DATE :android:prepareComGoogleAndroidGmsPlayServicesPlus840Library UP-TO-DATE :android:prepareComGoogleAndroidGmsPlayServicesSafetynet840Library UP-TO-DATE :android:prepareComGoogleAndroidGmsPlayServicesVision840Library UP-TO-DATE :android:prepareComGoogleAndroidGmsPlayServicesWallet840Library UP-TO-DATE :android:prepareComGoogleAndroidGmsPlayServicesWearable840Library UP-TO-DATE :android:prepareDebugDependencies :android:compileDebugAidl UP-TO-DATE :android:compileDebugRenderscript UP-TO-DATE :android:generateDebugBuildConfig UP-TO-DATE :android:generateDebugAssets UP-TO-DATE :android:mergeDebugAssets UP-TO-DATE :android:generateDebugResValues UP-TO-DATE :android:generateDebugResources UP-TO-DATE :android:mergeDebugResources UP-TO-DATE :android:processDebugManifest UP-TO-DATE :android:processDebugResources UP-TO-DATE :android:generateDebugSources UP-TO-DATE :android:processDebugJavaRes UP-TO-DATE :android:compileDebugJava UP-TO-DATE :android:compileDebugNdk UP-TO-DATE :android:compileDebugSources UP-TO-DATE :android:preDexDebug UP-TO-DATE :android:dexDebug UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536 at com.android.dx.merge.DexMerger$6.updateIndex(DexMerger.java:502) at com.android.dx.merge.DexMerger$IdMerger.mergeSorted(DexMerger.java:277) at com.android.dx.merge.DexMerger.mergeMethodIds(DexMerger.java:491) at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:168) at com.android.dx.merge.DexMerger.merge(DexMerger.java:189) at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:502) at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334) at com.android.dx.command.dexer.Main.run(Main.java:277) at com.android.dx.command.dexer.Main.main(Main.java:245) at com.android.dx.command.Main.main(Main.java:106) Error:Execution failed for task ':android:dexDebug'. > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_51\bin\java.exe'' finished with non-zero exit value 2 Information:BUILD FAILED Information:Total time: 45.63 secs Information:1 error Information:0 warnings Information:See complete output in console And the code for gradle.build itself:
android { buildToolsVersion "23.0.1" compileSdkVersion 23 sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['src'] aidl.srcDirs = ['src'] renderscript.srcDirs = ['src'] res.srcDirs = ['res'] assets.srcDirs = ['assets'] jniLibs.srcDirs = ['libs'] } instrumentTest.setRoot('tests') } } // called every time gradle gets executed, takes the native dependencies of // the natives configuration, and extracts them to the proper libs/ folders // so they get packed with the APK. task copyAndroidNatives() { file("libs/armeabi/").mkdirs(); file("libs/armeabi-v7a/").mkdirs(); file("libs/x86/").mkdirs(); configurations.natives.files.each { jar -> def outputDir = null if (jar.name.endsWith("natives-armeabi-v7a.jar")) outputDir = file("libs/armeabi-v7a") if (jar.name.endsWith("natives-armeabi.jar")) outputDir = file("libs/armeabi") if (jar.name.endsWith("natives-x86.jar")) outputDir = file("libs/x86") if (outputDir != null) { copy { from zipTree(jar) into outputDir include "*.so" } } } } task run(type: Exec) { def path def localProperties = project.file("../local.properties") if (localProperties.exists()) { Properties properties = new Properties() localProperties.withInputStream { instr -> properties.load(instr) } def sdkDir = properties.getProperty('sdk.dir') if (sdkDir) { path = sdkDir } else { path = "$System.env.ANDROID_HOME" } } else { path = "$System.env.ANDROID_HOME" } def adb = path + "/platform-tools/adb" commandLine "$adb", 'shell', 'am', 'start', '-n', 'com.dailytoys.universalrace.android/com.dailytoys.universalrace.android.AndroidLauncher' } // sets up the Android Eclipse project, using the old Ant based build. eclipse { // need to specify Java source sets explicitely, SpringSource Gradle Eclipse plugin // ignores any nodes added in classpath.file.withXml sourceSets { main { java.srcDirs "src", 'gen' } } jdt { sourceCompatibility = 1.6 targetCompatibility = 1.6 } classpath { plusConfigurations += [project.configurations.compile] containers 'com.android.ide.eclipse.adt.ANDROID_FRAMEWORK', 'com.android.ide.eclipse.adt.LIBRARIES' } project { name = appName + "-android" natures 'com.android.ide.eclipse.adt.AndroidNature' buildCommands.clear(); buildCommand "com.android.ide.eclipse.adt.ResourceManagerBuilder" buildCommand "com.android.ide.eclipse.adt.PreCompilerBuilder" buildCommand "org.eclipse.jdt.core.javabuilder" buildCommand "com.android.ide.eclipse.adt.ApkBuilder" } } // sets up the Android Idea project, using the old Ant based build. idea { module { sourceDirs += file("src"); scopes = [COMPILE: [plus: [project.configurations.compile]]] iml { withXml { def node = it.asNode() def builder = NodeBuilder.newInstance(); builder.current = node; builder.component(name: "FacetManager") { facet(type: "android", name: "Android") { configuration { option(name: "UPDATE_PROPERTY_FILES", value: "true") } } } } } } } dependencies { compile 'com.google.android.gms:play-services:8.4.0' } What do you advise?
dexindexoverflowexception android(the name of the error from your log) and get this answer: tyk - JuriySPb ♦