我尝试多次向项目添加依赖项,每次都给出错误
我要添加它们的依赖项是'de.hdodenhof:circleimageview:1.3.0'
和'com.github.bumptech.glide:glide:3.6.1'
所以我想下载这些并手动添加到我的项目是否可能,如果是,如何?
这是我的应用程序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'
}
答案 0 :(得分:4)
下载您想要的库的jar / aar文件
将文件复制到app文件夹中的libs目录中 对于* .jar文件: 添加此代码以依赖您的gradle文件
compile files('libs/library.jar')
表示* .aar文件: 尝试从projecttructure / new module /从aar / jar导入
祝你好运答案 1 :(得分:2)
展开GradleScripts选项卡。你会看到2个build.gradle文件。打开第二个build.gradle(module:app)文件。在文件的末尾,您将看到如下部分:
dependencies {
compile 'com.android.support:appcompat-v7:23.0.0'
}
在这里添加一个新的依赖项:
dependencies {
compile 'com.android.support:appcompat-v7:23.0.0'
//manually added dependency
compile 'com.android.support:design:23.0.0'
}
答案 2 :(得分:1)
只需在依赖项中复制它
class Main$SimplePojo time = 295
class Main$DelegatingPojo time = 328
class Main$ReflectingPojo time = 544
并按'与gradle文件同步项目'按钮
然后通过粘贴下面的代码随时随地使用它
compile 'de.hdodenhof:circleimageview:1.3.0'
答案 3 :(得分:0)
我遇到了类似的问题,并且@SaravInfern在评论中指出,我通过将项目作为模块导入来解决它。
apply plugin: 'com.android.library'
(之前,可能是com.android.library
)compile project(":app")
其中,app
是导入模块的名称。然后构建项目。它应该成功构建。您可以参考this blog和this SO thread了解更详细的解决方案。
答案 4 :(得分:0)
Yes you can manually update the dependencies in build.gradle system
Just copy any of the existing dependency and rename with yours required dependency..
Example:
dependencies {
compile 'com.android.support:design:23.0.0'// this is default dependency
compile 'de.hdodenhof:circleimageview:1.3.0' // this is your dependency..
}
Issues your get..
1. android machine warn you to use implements instand of complie..(its a warning ignore it)
2. de.hdodenhof:circleimageview:1.3.0 change of version...(use latest if your using latest then change to lower version).
.@Sunil, Try this It will work....