我正在尝试在gradle中添加第三方库。它显示以下错误:
这是我的gradle文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
compileOptions.encoding = 'ISO-8859-1'
defaultConfig {
applicationId "com.attendme.io"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.4" //1.4.1
//multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile files('libs/kandy-1.6.160.jar')
compile files('libs/gcm.jar')
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
compile 'com.android.support:recyclerview-v7:23.3.0'
//compile 'com.google.android.gms:play-services-gcm:8.4.0'
//compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.squareup.okhttp3:okhttp:3.2.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.github.ParkSangGwon:TedPicker:v1.0.10'
}
当我在搜索这个问题时,我找到了一些解决方案,但它们并没有为我工作。我该如何解决这个问题?
答案 0 :(得分:8)
您需要添加2个maven存储库。
因此,请确保您的build.gradle(Project)包含此
if (event.getSource() == startAIvAI)
这是你的build.gradle(app)
allprojects {
repositories {
jcenter()
maven { url "https://repo.commonsware.com.s3.amazonaws.com" }
maven { url "https://jitpack.io" }
}
}
答案 1 :(得分:1)
您还应该将存储库添加到build.gradle中。将这些存储库放在repositories
标记中。将这些放在android
标记上方。
repositories {
maven { url "https://repo.commonsware.com.s3.amazonaws.com" }
maven { url "https://jitpack.io" }
}
答案 2 :(得分:1)
我们将使用cwac-camera拍照。从enter link jitpack.io
获取图书馆repositories {
jcenter()
maven { url "https://repo.commonsware.com.s3.amazonaws.com" }
maven { url "https://jitpack.io" }
}
dependencies {
compile 'com.github.ParkSangGwon:TedPicker:v1.0.10'
}
添加相机,外部存储的权限,以及android6的运行时权限。有关更多信息,请阅读官方documentation
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />