简体   繁体   中英

Add library to android studio

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:0.8.5.6@aar') {
    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'
}
  }

Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.

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

Use " JitPack ", once integrated in gradle enter the link of the user and the name of his github repo. For this specific case, so you should write:

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

Of course in the repositories you add this line, as you will also find the official website

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

EDIT

Edit your 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:0.8.5.6@aar') {
    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'
}
  }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM