2015-01-16 53 views
0

目標:整合微博SDK https://github.com/sinaweibosdk/weibo_android_sdk「DexException:多dex文件所界定的」 使用微博SDK

工作流程:我創造了新的項目,並加入微博SDK。之後,運行該項目,並得到編譯錯誤。

的gradle微博:

apply plugin: 'com.android.library' 

android { 
    compileSdkVersion 21 
    buildToolsVersion "21.1.2" 

    defaultConfig { 
     minSdkVersion 8 
     targetSdkVersion 8 
    } 

    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 
     } 
    } 
} 

dependencies { 
    compile files('libs/weibosdkcore.jar') 
} 

應用gradle這個:

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 21 
    buildToolsVersion "21.1.2" 

    defaultConfig { 
     applicationId "ufasreader.cn.weiboclient" 
     minSdkVersion 14 
     targetSdkVersion 21 
     versionCode 1 
     versionName "1.0" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile project(':weiboSDK') 
} 

設置搖籃:

include ':weiboSDK' 
    include ':weiboSDKDemo' 

的gradle項目:

buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:1.0.0' 
    } 
} 

allprojects { 
    repositories { 
     jcenter() 
    } 
} 

失敗:建立失敗,一個例外。

* What went wrong: 
Execution failed for task ':app:dexDebug'. 
> com.android.ide.common.internal.LoggedErrorException: Failed to run command: 
    D:\adt-bundle-windows-x86_64-20130522\adt-bundle-windows-x86_64-20130522\sdk\build-tools\21.1.2\dx.bat --dex --no-optimize --output C:\Users\drovorub\work\WeiboClient\app\build\intermediates\dex\debug --input-list=C:\Users\sir\work\WeiboClient\app\build\intermediates\tmp\dex\debug\inputList.txt 
Error Code: 
    2 
Output: 

    UNEXPECTED TOP-LEVEL EXCEPTION: 
    com.android.dex.DexException: Multiple dex files define Lcom/sina/weibo/sdk/BuildConfig; 
     at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596) 
     at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554) 
     at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535) 
     at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171) 
     at com.android.dx.merge.DexMerger.merge(DexMerger.java:189) 
     at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454) 
     at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303) 
     at com.android.dx.command.dexer.Main.run(Main.java:246) 
     at com.android.dx.command.dexer.Main.main(Main.java:215) 
     at com.android.dx.command.Main.main(Main.java:106) 



* Try: 
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. 

謝謝你的幫忙!

+0

Stack Overflow是一個純粹的英文網站,鏈接你」重新指向的是中國人。海事組織,這個問題太局部化了。 – 0101100101

+0

不,不需要按照鏈接瞭解這一點。錯誤是非常明顯的,儘管海報選擇了標題的消息的非信息部分(修復)。 –

回答

相關問題