在intelliJ中添加依赖项

时间:2017-03-01 06:49:46

标签: android intellij-idea dependencies

我有一个android项目和一个添加它的指令     compile 'com.github.claucookie.miniequalizer:library:1.0.0'

作为项目中的依赖项。 在进入项目的项目结构后,我不知道正确的选项。

2 个答案:

答案 0 :(得分:3)

第1步:

要添加依赖项,请转到applevel gradle文件

enter image description here

第2步:

在依赖项中添加compile 'com.github.claucookie.miniequalizer:library:1.0.0',在}之前的最后一行之后。 enter image description here

即。我添加了您的依赖项,如下所示

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'org.greenrobot:eventbus:3.0.0'
    compile 'com.android.support:appcompat-v7:25.1.0'
    compile 'com.android.support:design:25.1.0'
    compile 'com.jakewharton:butterknife:8.4.0'
    compile 'com.android.support:cardview-v7:25.1.0'
    compile 'com.android.support:support-v4:25.1.0'
    compile 'com.squareup.retrofit2:retrofit:2.1.0'
    compile 'com.squareup.okhttp3:logging-interceptor:3.3.1'
    compile 'com.squareup.retrofit2:converter-jackson:2.1.0'
    compile 'com.android.support:recyclerview-v7:25.1.0'
    compile 'com.github.traex.rippleeffect:library:1.3'
    compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    testCompile 'junit:junit:4.12'
    testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
    debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5'
    releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
    compile 'com.github.claucookie.miniequalizer:library:1.0.0'
}

第3步:

点击同步Gradle enter image description here后。

答案 1 :(得分:2)

project -->gradle Scripts--> build.gradle (Module:App)

添加依赖项,如:

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "rafsan.practice"
        minSdkVersion 15
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:24.2.1'
    compile 'com.github.claucookie.miniequalizer:library:1.0.0'   //add the dependency here
}