gradle compile UNEXPECTED TOP-LEVEL EXCEPTION <p>My working build.graddle:</p> <pre><code> apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion "19.1.0" defaultConfig { applicationId "com.squiri.squiri" minSdkVersion 15 targetSdkVersion 23 versionCode 1 versionName "1.0" //multiDexEnabled = true } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } packagingOptions { exclude 'META-INF/DEPENDENCIES.txt' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/NOTICE.txt' exclude 'META-INF/NOTICE' exclude 'META-INF/LICENSE' exclude 'META-INF/DEPENDENCIES' exclude 'META-INF/notice.txt' exclude 'META-INF/license.txt' exclude 'META-INF/dependencies.txt' exclude 'META-INF/LGPL2.1' } } dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') compile 'com.google.android.gms:play-services:7.8.0' compile 'com.android.support:support-v4:23.0.0' compile 'com.android.support:appcompat-v7:23.0.0' compile 'com.vk:androidsdk:+' compile 'com.facebook.android:facebook-android-sdk:4.0.0' } </code></pre> <p>If I add to this file next lines:</p> <pre><code>repositories { mavenCentral() maven { url 'http://maven.stickerpipe.com/artifactory/stickerfactory' } } ... dependenies{ ... compile('vc908.stickers:stickerfactory:+') { transitive = true; } } </code></pre> <p>I getting next error:</p> <pre><code> Information:Gradle tasks [:app:assembleDebug] :app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:checkDebugManifest :app:preReleaseBuild UP-TO-DATE :app:prepareComAndroidSupportAppcompatV72300Library UP-TO-DATE :app:prepareComAndroidSupportDesign2221Library UP-TO-DATE :app:prepareComAndroidSupportMediarouterV72220Library UP-TO-DATE :app:prepareComAndroidSupportRecyclerviewV72221Library UP-TO-DATE :app:prepareComAndroidSupportSupportV42300Library UP-TO-DATE :app:prepareComAnjlabAndroidIabV3Library1026Library UP-TO-DATE :app:prepareComFacebookAndroidFacebookAndroidSdk400Library UP-TO-DATE :app:prepareComGithubCastorflexSmoothprogressbarLibrary110Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServices780Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesAds780Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesAnalytics780Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesAppindexing780Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesAppinvite780Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesAppstate780Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesBase780Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesCast780Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesDrive780Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesFitness780Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesGames780Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesGcm780Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesIdentity780Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesLocation780Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesMaps780Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesNearby780Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesPanorama780Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesPlus780Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesSafetynet780Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesVision780Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesWallet780Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesWearable780Library UP-TO-DATE :app:prepareComVkAndroidsdk1510Library UP-TO-DATE :app:prepareVc908StickersStickerfactory053Library 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:generateDebugResValues UP-TO-DATE :app:generateDebugResources UP-TO-DATE :app:mergeDebugResources UP-TO-DATE :app:processDebugManifest UP-TO-DATE :app:processDebugResources UP-TO-DATE :app:generateDebugSources UP-TO-DATE :app:processDebugJavaRes UP-TO-DATE :app:compileDebugJavaWithJavac UP-TO-DATE :app:compileDebugNdk UP-TO-DATE :app:compileDebugSources UP-TO-DATE :app:preDexDebug UP-TO-DATE :app:dexDebug UNEXPECTED TOP-LEVEL EXCEPTION: java.lang.IllegalArgumentException: method ID not in [0, 0xffff]: 65536 at com.android.dx.merge.DexMerger$6.updateIndex(DexMerger.java:501) at com.android.dx.merge.DexMerger$IdMerger.mergeSorted(DexMerger.java:276) at com.android.dx.merge.DexMerger.mergeMethodIds(DexMerger.java:490) at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:167) at com.android.dx.merge.DexMerger.merge(DexMerger.java:188) at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439) at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287) at com.android.dx.command.dexer.Main.run(Main.java:230) at com.android.dx.command.dexer.Main.main(Main.java:199) at com.android.dx.command.Main.main(Main.java:103) Error:Execution failed for task ':app:dexDebug'. &gt; com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0\bin\java.exe'' finished with non-zero exit value 2 Information:BUILD FAILED Information:Total time: 33.864 secs Information:1 error Information:0 warnings Information:See complete output in console </code></pre> <p>Why??? Notation: in other project (quickblox sample chat) on my PC working all OK!</p> <p>My not working build.gradle:</p> <pre><code> apply plugin: 'com.android.application' repositories { mavenCentral() maven { url 'http://maven.stickerpipe.com/artifactory/stickerfactory' } } android { compileSdkVersion 23 buildToolsVersion "19.1.0" defaultConfig { applicationId "com.squiri.squiri" minSdkVersion 15 targetSdkVersion 23 versionCode 1 versionName "1.0" //multiDexEnabled = true } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } packagingOptions { exclude 'META-INF/DEPENDENCIES.txt' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/NOTICE.txt' exclude 'META-INF/NOTICE' exclude 'META-INF/LICENSE' exclude 'META-INF/DEPENDENCIES' exclude 'META-INF/notice.txt' exclude 'META-INF/license.txt' exclude 'META-INF/dependencies.txt' exclude 'META-INF/LGPL2.1' } } dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') compile 'com.google.android.gms:play-services:7.8.0' compile 'com.android.support:support-v4:23.0.0' compile 'com.android.support:appcompat-v7:23.0.0' compile 'com.vk:androidsdk:+' compile 'com.facebook.android:facebook-android-sdk:4.0.0' compile('vc908.stickers:stickerfactory:+') { transitive = true; } } </code></pre> <p>Working build.gradle in quickblox sample chat:</p> <pre><code> apply plugin: 'com.android.application' repositories { mavenCentral() maven { url 'http://maven.stickerpipe.com/artifactory/stickerfactory' } } android { compileSdkVersion rootProject.compileSdkVersion buildToolsVersion rootProject.buildToolsVersion sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['src'] res.srcDirs = ['res'] } } } dependencies { compile files(rootProject.core_jar_path, rootProject.chat_jar_path, rootProject.messages_jar_path) compile 'com.google.android.gms:play-services-gcm:7.5.0' compile 'com.android.support:support-v4:19.0.+' compile 'com.android.support:appcompat-v7:19.0.0' compile project(':pull-to-refresh') compile('vc908.stickers:stickerfactory:0.2.2@aar') { transitive = true; } } </code></pre> <p><strong>What I have tried:</strong></p> <ul> <li><p>clear, rebuild, recreate project</p></li> <li><p>change compile version of java to 1.7</p></li> <li><p>enable multiDexEnabled with big memory size allocation for multidex configuration</p></li> <li><p>delete appcompat and support dependencies</p></li> <li><p>changed version of stickerfactory to latest (":+")</p></li> </ul> <p>Nothing works.</p> <p><strong>The analogic problem is with quickblox jar libraries also!</strong> (all jar libs are taken from quickblox chat sample (jars directory))</p>