如何手动添加对Android Studio的依赖 [英] How to add dependency to Android Studio manually

查看:767
本文介绍了如何手动添加对Android Studio的依赖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试多次向我的项目添加依赖项,并且每次都给出错误
,我想添加它们的依赖项是'de.hdodenhof:circleimageview:1.3.0' code>和'com.github.bumptech.glide:glide:3.6.1'
所以我想下载这些并手动添加到我的项目中这是可能的,如果是如何?



这是我的应用程序的 build.gradle

  apply plugin:'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion '24 .0 .0 rc4'

defaultConfig {
applicationIdir.esfandune.material
minSdkVersion 23
targetSdkVersion 23
versionCode 1
versionName 1.0
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguar d-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
packagingOptions {
排除'classes.dex'
}
}

储存库{
jcenter()
maven {urlhttps:// oss。 sonatype.org/content/repositories/snapshots}

}

依赖项{
compile'c​​om.android.support:design:23.0.0'
编译'com.android.support:appcompat-v7:23.0.0'
编译'com.android.support:cardview-v7:23.0.0'
编译'com.android.support: recyclerview-v7:23.0.0'
compile'c​​om.android.support:support-v4:23.0.0'
compile'c​​om.android.support:multidex:1.0.1'
编译'com.github.rey5137:材料:1.2.1.6-SNAPSHOT'
编译项目(':material-dialogs')
编译文件('lib / de.hdodenhof / circleimageview / 1.3.0 /瓶/ CLA sses.jar')
// ***从原始来源添加
编译'de.hdodenhof:circleimageview:1.3.0'
编译'com.github.bumptech.glide:glide: 3.6.1'
}


解决方案

jar / aar你想要的库的文件

将文件复制到应用程序文件夹中的libs目录
用于* .jar文件:
添加此代码依赖你的gradle文件

 编译文件('libs / library.jar')

用于* .aar文件:
从项目结构/新模块尝试/从aar / jar导入

祝你好运

I try several times to add dependency to my project and each time give error the dependency that I want to add them are 'de.hdodenhof:circleimageview:1.3.0' and 'com.github.bumptech.glide:glide:3.6.1' so I want to download these and add to my project manually is it possible and if Yes How?

Here is my application's build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion '24.0.0 rc4'

    defaultConfig {
        applicationId "ir.esfandune.material"
        minSdkVersion 23
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
    packagingOptions {
        exclude 'classes.dex'
    }
}

repositories {
    jcenter()
    maven { url "https://oss.sonatype.org/content/repositories/snapshots" }

}

dependencies {
    compile 'com.android.support:design:23.0.0'
    compile 'com.android.support:appcompat-v7:23.0.0'
    compile 'com.android.support:cardview-v7:23.0.0'
    compile 'com.android.support:recyclerview-v7:23.0.0'
    compile 'com.android.support:support-v4:23.0.0'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.github.rey5137:material:1.2.1.6-SNAPSHOT'
    compile project(':material-dialogs')
    compile files('lib/de.hdodenhof/circleimageview/1.3.0/jars/classes.jar')
    //*** added from orginal source
    compile 'de.hdodenhof:circleimageview:1.3.0'
    compile 'com.github.bumptech.glide:glide:3.6.1'
}

解决方案

download the jar/aar file of your library you want

copy files into libs directory in your app folder for *.jar files: add this code to dependency on your gradle file

 compile files('libs/library.jar')

for *.aar files: try from projectstructure / new module/ import from aar/jar

good luck

这篇关于如何手动添加对Android Studio的依赖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆