2016-03-06 109 views
1
apply plugin: 'com.android.application' 

android { 
compileSdkVersion 23 
buildToolsVersion "23.0.2" 

defaultConfig { 
    applicationId "jzdevelopers.ml.schoolbinder" 
    minSdkVersion 16 
    targetSdkVersion 23 
    versionCode 1 
    versionName "1.0.0" 
} 

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

packagingOptions { 
     exclude 'META-INF/NOTICE' 
     exclude 'META-INF/LICENSE' 
} 

} 

repositories { 
maven { url "https://jitpack.io" } 

maven { url "https://s3.amazonaws.com/repo.commonsware.com" } 

jcenter() 
} 

dependencies { 
compile fileTree(dir: 'libs', include: ['*.jar']) 
compile 'com.android.support:appcompat-v7:23.2.0' 
compile 'com.android.support:recyclerview-v7:23.2.0' 
compile 'com.android.support:cardview-v7:23.2.0' 
compile 'com.android.support:design:23.2.0' 
compile 'com.melnykov:floatingactionbutton:1.3.0' 
compile 'com.commonsware.cwac:richedit:0.5.2' 
compile 'org.sufficientlysecure:html-textview:1.4' 
compile ('com.github.NightWhistler:HtmlSpanner:0.4') 
compile('com.github.afollestad.material-dialogs:core:[email protected]') { 
    transitive = true 
} 
compile('com.github.ganfra:material-spinner:1.1.1') { 
    exclude group: 'com.nineoldandroids', module: 'library' 
    exclude group: 'com.android.support', module: 'appcompat-v7' 
} 
compile('com.rengwuxian.materialedittext:library:2.1.4') { 
    exclude group: 'com.nineoldandroids', module: 'library' 
    exclude group: 'com.android.support', module: 'appcompat-v7' 
} 
    } 

錯誤:執行任務':app:transformResourcesWithMergeJavaResForDebug'失敗。將庫添加到android studio

com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/LICENSE.txt File1: /Users/JordanZimmitti/.gradle/caches/modules-2/files-2.1/org.jdom/jdom/1.1/1d04c0f321ea337f3661cf7ede8f4c6f653a8fdd/jdom-1.1.jar File2: /Users/JordanZimmitti/.gradle/caches/modules-2/files-2.1/org.apache.ant/ant/1.7.0/9746af1a485e50cf18dcb232489032a847067066/ant-1.7.0.jar

+0

https://stackoverflow.com/questions/16588064/how-do-i-add-a-libra ry-project-to-the-android-studio –

回答

2

使用「JitPack」,一旦整合的gradle中輸入用戶的鏈接和他的GitHub庫的名稱。 對於這個特定的情況下,所以你應該寫:

compile 'com.github.NightWhistler:HtmlSpanner:0.4' 

當然在倉庫中添加這一行,你也將找到的官方網站

maven { url "https://jitpack.io" } 

編輯

編輯您的build.gradle

apply plugin: 'com.android.application' 

android { 
compileSdkVersion 23 
buildToolsVersion "23.0.2" 

defaultConfig { 
    applicationId "jzdevelopers.ml.schoolbinder" 
    minSdkVersion 16 
    targetSdkVersion 23 
    versionCode 1 
    versionName "1.0.0" 
} 

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

packagingOptions { 
     exclude 'META-INF/NOTICE.txt' 
     exclude 'META-INF/LICENSE.txt' 
} 

} 

repositories { 
maven { url "https://jitpack.io" } 

maven { url "https://s3.amazonaws.com/repo.commonsware.com" } 

jcenter() 
} 

dependencies { 
compile fileTree(dir: 'libs', include: ['*.jar']) 
compile 'com.android.support:appcompat-v7:23.2.0' 
compile 'com.android.support:recyclerview-v7:23.2.0' 
compile 'com.android.support:cardview-v7:23.2.0' 
compile 'com.android.support:design:23.2.0' 
compile 'com.melnykov:floatingactionbutton:1.3.0' 
compile 'com.commonsware.cwac:richedit:0.5.2' 
compile 'org.sufficientlysecure:html-textview:1.4' 
compile 'com.github.NightWhistler:HtmlSpanner:0.4' 
compile('com.github.afollestad.material-dialogs:core:[email protected]') { 
    transitive = true 
} 
compile('com.github.ganfra:material-spinner:1.1.1') { 
    exclude group: 'com.nineoldandroids', module: 'library' 
    exclude group: 'com.android.support', module: 'appcompat-v7' 
} 
compile('com.rengwuxian.materialedittext:library:2.1.4') { 
    exclude group: 'com.nineoldandroids', module: 'library' 
    exclude group: 'com.android.support', module: 'appcompat-v7' 
} 
    } 
+0

它說未能解決你爲什麼 – Jordan

+0

你輸入了maven倉庫的順序? 然後你進入依賴檢查編譯? 如果你把我的錯誤 https://jitpack.io/ – peppinoibra

+0

檢查我的更新馬貝它會幫助你弄明白 – Jordan