2015-09-13 68 views
0

我的工作build.graddle:gradle這個編譯意外頂級EXCEPTION

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' 

} 

如果我加入到這個文件下一行:

repositories { 
    mavenCentral() 
    maven { url 'http://maven.stickerpipe.com/artifactory/stickerfactory' } 
} 
... 
dependenies{ 
... 
    compile('vc908.stickers:stickerfactory:+') { 
     transitive = true; 
    } 
} 

我得到一個錯誤:

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'. 
> 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 

爲什麼?註釋:在我的電腦上的其他項目(quickblox示例聊天)中,一切正常!

我不工作的build.gradle:

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; 
    } 
} 

在quickblox樣品聊天工作的build.gradle:

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:[email protected]') { 
     transitive = true; 
    } 
} 

我曾嘗試:

  • 清楚,重建,重建項目

  • 改變編譯Java版本1.7

  • 使multiDexEnabled大內存大小分配multidex配置

  • 刪除程序兼容性和支持的依賴

  • 更改版本stickerfactory到最新版本(「: +「)

沒什麼用。

模擬問題與quickblox jar庫也!(所有jar庫都取自quickblox聊天示例(jars目錄))

回答

2

請勿包含所有播放服務。它包括許多不必要的類

compile 'com.google.android.gms:play-services:7.5.0' 

反而只添加neccecarry模塊。 例如

compile 'com.google.android.gms:play-services-analytics:7.5.0' 
相關問題