-1

I had this problem for some hours, i did not risolve. please help me.

  1. I have already did Clean / Build / Rebuild / Cache Invalidate / Gradle sync etc.
  2. Finally i get this error when i have onClick Listner in Alert Dialog.
  3. I am calling a button to show up a dialog from a fragment where i pass Context as "getActivity" .. But it works with Toast so it is not a problem(Toast works and Dialog also works with ok button with no listeners.)

:app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:checkDebugManifest :app:preReleaseBuild UP-TO-DATE :app:prepareComAndroidSupportAppcompatV72220Library UP-TO-DATE :app:prepareComAndroidSupportDesign2220Library UP-TO-DATE :app:prepareComAndroidSupportMediarouterV72200Library UP-TO-DATE :app:prepareComAndroidSupportSupportV42220Library UP-TO-DATE :app:prepareComCrashlyticsSdkAndroidAnswers132Library UP-TO-DATE :app:prepareComCrashlyticsSdkAndroidBeta113Library UP-TO-DATE :app:prepareComCrashlyticsSdkAndroidCrashlytics252Library UP-TO-DATE :app:prepareComCrashlyticsSdkAndroidCrashlyticsCore235Library UP-TO-DATE :app:prepareComGithubLzyzsdCircleprogress110Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServices750Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesAds750Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesAnalytics750Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesAppindexing750Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesAppinvite750Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesAppstate750Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesBase750Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesCast750Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesDrive750Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesFitness750Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesGames750Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesGcm750Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesIdentity750Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesLocation750Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesMaps750Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesNearby750Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesPanorama750Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesPlus750Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesSafetynet750Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesWallet750Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesWearable750Library UP-TO-DATE :app:prepareComJourneyappsZxingAndroidEmbedded303Library UP-TO-DATE :app:prepareComOguzdevCircularFloatingActionMenu102Library UP-TO-DATE :app:prepareComReginaldSwiperefreshLibrary111Library UP-TO-DATE :app:prepareIoFabricSdkAndroidFabric136Library UP-TO-DATE :app:prepareRuNotiesScrollable113Library UP-TO-DATE :app:prepareDebugDependencies :app:compileDebugAidl UP-TO-DATE :app:compileDebugRenderscript UP-TO-DATE :app:generateDebugBuildConfig UP-TO-DATE :app:generateDebugAssets UP-TO-DATE :app:mergeDebugAssets UP-TO-DATE :app:processDebugManifest UP-TO-DATE :app:fabricGenerateResourcesDebug :app:generateDebugResValues UP-TO-DATE :app:generateDebugResources :app:mergeDebugResources :app:processDebugResources :app:generateDebugSources :app:preDebugAndroidTestBuild UP-TO-DATE :app:prepareDebugAndroidTestDependencies :app:compileDebugAndroidTestAidl UP-TO-DATE :app:processDebugAndroidTestManifest UP-TO-DATE :app:compileDebugAndroidTestRenderscript UP-TO-DATE :app:generateDebugAndroidTestBuildConfig UP-TO-DATE :app:generateDebugAndroidTestAssets UP-TO-DATE :app:mergeDebugAndroidTestAssets UP-TO-DATE :app:generateDebugAndroidTestResValues UP-TO-DATE :app:generateDebugAndroidTestResources UP-TO-DATE :app:mergeDebugAndroidTestResources UP-TO-DATE :app:processDebugAndroidTestResources UP-TO-DATE :app:generateDebugAndroidTestSources UP-TO-DATE :app:processDebugJavaRes UP-TO-DATE :app:compileDebugJava Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. :app:compileDebugNdk UP-TO-DATE :app:compileDebugSources :app:preDexDebug UP-TO-DATE :app: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 ':app:dexDebug'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_60\bin\java.exe'' finished with non-zero exit value 2 Information:BUILD FAILED Information:Total time: 13.67 secs Information:1 error Information:0 warnings Information:See complete output in console It was the Error Here is my Dialog and XML Button

XML for Button

<Button
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="Rimuovi chiamata abbinata"
    android:id="@+id/btn_del_chiamata"
    android:layout_above="@+id/riep_tec_rl_nav"
    android:layout_centerHorizontal="true"
    android:layout_marginRight="10dp"
    android:layout_marginLeft="10dp"
    android:drawableRight="@drawable/delete"
    android:background="@xml/edit_text" />
Chris Stillwell
  • 10,266
  • 10
  • 67
  • 77
  • what is your problem? it is crashing or not working? – NehaK Jan 27 '16 at 15:25
  • 1
    TOP-LEVEL EXCEPTION: com.android.dex.DexIndexOverflowException – OneCricketeer Jan 27 '16 at 15:26
  • The problem is multi dex files either you have imported a library twice or you are exceeding the libraries limit ! i can see are you really need to compile all play services libraries ? check this link for more understanding https://developers.google.com/android/guides/setup – Mohamed Jan 27 '16 at 15:27

1 Answers1

0

You run into the 65K method count limit. Either you use multidex or reduce the number of methods ( e.g. with proguard ) Please read this: https://developer.android.com/tools/building/multidex.html

Matias Elorriaga
  • 8,880
  • 5
  • 40
  • 58
  • I am using this compile for play services. ' compile 'com.google.android.gms:play-services:7.5.0' But my application is an enterprise app so i do not use even play store to launch my application instead i use Twitter Fabrics.io. Also i use google map only. So i can i omit the google play services in Gradle? – Jo Jo - Tamilan Jan 27 '16 at 16:01
  • **thanks for the reply i have cut off un used play service libraries, then it works.** – Jo Jo - Tamilan Jan 28 '16 at 08:38