我正在尝试实现gradle:
compile 'com.edmodo:cropper:1.0.2'
..在我的项目中,Gradle构建时我一直收到错误。我得到的错误是:
错误:(36,13)无法解决:com.edmodo:cropper:1.0.2
它全部显示,甚至没有显示原因。我也提到THIS回答,但错误仍然存在。为什么这个错误通常会发生?
修改
我的build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
修改
应用模块
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.myapp.testapp"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "4g"
}
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:23.1.1'
compile 'com.google.code.gson:gson:2.3'
compile 'com.google.guava:guava:18.0'
compile 'com.googlecode.android-query:android-query:0.25.9'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.google.android.gms:play-services-gcm:8.3.0'
compile 'com.edmodo:cropper:1.0.2'
}
答案 0 :(得分:3)
您可以使用compile 'com.edmodo:cropper:1.0.1'
<强>的build.gradle 强>
repositories
{
mavenCentral()
}
dependencies {
compile 'com.edmodo:cropper:1.0.1'
}
然后 Clean-Rebuild-Restart-Sync
您的项目。
答案 1 :(得分:0)
使用Gradle 2.2.2,将以下内容添加到projectname.gradle文件中:
allprojects {
repositories {
jcenter()
maven { url "https://repo.commonsware.com.s3.amazonaws.com" }
maven { url "https://jitpack.io" }
}
}