2015-03-19 89 views
0

我的項目只有一個庫,但是我沒有構建它。未能建立。任務':app:dexDebug'的執行失敗。

https://github.com/dinocore1/DevsmartLib-Android/tree/master/devsmartlib的庫。

任何幫助將不勝感激。

請告訴我,如果需要更多信息。

devsmartlib> gradle.build(我這寫我自己,因爲我無法找到任何從回購本身)

apply plugin: 'com.android.library' 

dependencies { 
    compile 'com.android.support:support-v4:21.0.3' 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
} 

android { 
    compileSdkVersion 21 
    buildToolsVersion "21.1.2" 

    defaultConfig { 
     minSdkVersion 14 
     targetSdkVersion 21 
    } 

    sourceSets { 
     main { 
      manifest.srcFile 'AndroidManifest.xml' 
      java.srcDirs = ['src'] 
      res.srcDirs = ['res'] 
     } 
    } 
} 

MYAPP>的build.gradle

apply plugin: 'com.android.application' 

    android { 
    compileSdkVersion 21 
    buildToolsVersion "21.1.2" 

    defaultConfig { 
     applicationId "com.example.hs.mybookapp" 
     minSdkVersion 16 
     targetSdkVersion 21 
     versionCode 2 
     versionName "1.1 Beta" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    compile 'com.android.support:appcompat-v7:21.0.3' 
    compile project(":devsmartlib") 
} 

根構建.gradle

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

     // NOTE: Do not place your application dependencies here; they belong 
     // in the individual module build.gradle files 
    } 
} 

allprojects { 
    repositories { 
     jcenter() 
    } 
} 

搖籃控制檯

Executing tasks: [:app:assembleDebug] 

Configuration on demand is an incubating feature. 
:app:preBuild 
:app:compileDebugNdk UP-TO-DATE 
:app:preDebugBuild 
:app:checkDebugManifest 
:app:preReleaseBuild 
:devsmartlib:compileLint 
:devsmartlib:copyReleaseLint UP-TO-DATE 
:devsmartlib:preBuild 
:devsmartlib:preReleaseBuild 
:devsmartlib:checkReleaseManifest 
:devsmartlib:preDebugBuild 
:devsmartlib:preDebugTestBuild 
:devsmartlib:prepareComAndroidSupportSupportV42103Library UP-TO-DATE 
:devsmartlib:prepareReleaseDependencies 
:devsmartlib:compileReleaseAidl UP-TO-DATE 
:devsmartlib:compileReleaseRenderscript UP-TO-DATE 
:devsmartlib:generateReleaseBuildConfig UP-TO-DATE 
:devsmartlib:generateReleaseAssets UP-TO-DATE 
:devsmartlib:mergeReleaseAssets UP-TO-DATE 
:devsmartlib:generateReleaseResValues UP-TO-DATE 
:devsmartlib:generateReleaseResources UP-TO-DATE 
:devsmartlib:mergeReleaseResources UP-TO-DATE 
:devsmartlib:processReleaseManifest UP-TO-DATE 
:devsmartlib:processReleaseResources UP-TO-DATE 
:devsmartlib:generateReleaseSources UP-TO-DATE 
:devsmartlib:compileReleaseJava UP-TO-DATE 
:devsmartlib:extractReleaseAnnotations UP-TO-DATE 
:devsmartlib:mergeReleaseProguardFiles UP-TO-DATE 
:devsmartlib:processReleaseJavaRes UP-TO-DATE 
:devsmartlib:packageReleaseJar UP-TO-DATE 
:devsmartlib:compileReleaseNdk UP-TO-DATE 
:devsmartlib:packageReleaseJniLibs UP-TO-DATE 
:devsmartlib:packageReleaseLocalJar UP-TO-DATE 
:devsmartlib:packageReleaseRenderscript UP-TO-DATE 
:devsmartlib:packageReleaseResources UP-TO-DATE 
:devsmartlib:bundleRelease UP-TO-DATE 
:app:prepareComAndroidSupportAppcompatV72103Library UP-TO-DATE 
:app:prepareComAndroidSupportSupportV42103Library UP-TO-DATE 
:app:prepareMyBookAppDevsmartlibUnspecifiedLibrary 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:compileDebugJava UP-TO-DATE 
:app:preDexDebug UP-TO-DATE 
:app:dexDebug 
UNEXPECTED TOP-LEVEL EXCEPTION: 
com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompatIcs; 
    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) 


FAILED 

FAILURE: Build failed with an exception. 

* What went wrong: 
Execution failed for task ':app:dexDebug'. 
> com.android.ide.common.internal.LoggedErrorException: Failed to run command: 
    C:\Users\HS\AppData\Local\Android\sdk\build-tools\21.1.2\dx.bat --dex --no-optimize --output C:\Users\HS\AndroidStudioProjects\MyBookApp\app\build\intermediates\dex\debug --input-list=C:\Users\HS\AndroidStudioProjects\MyBookApp\app\build\intermediates\tmp\dex\debug\inputList.txt 
Error Code: 
    2 
Output: 

    UNEXPECTED TOP-LEVEL EXCEPTION: 
    com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompatIcs; 
     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. 

BUILD FAILED 

Total time: 9.638 secs 

回答

0

我現在只是意識到,我使用了lib包含此文件android-support-v4.jar。刪除此文件將解決問題。

相關問題