这将是一个基本问题,我相信我只是读错了。我找不到其他地方的明确答案。
我正在尝试导入此库:
https://android-arsenal.com/details/1/2822
说明说:
The following goes in your module's build.gradle file:
repositories {
maven { url "https://jitpack.io" }
}
dependencies {
// ... other dependencies here
dependencies {
compile 'com.github.TouchBoarder:weekdays-buttons-bar:v1.0.2'
}
}
所以我在我的应用程序中添加了依赖项(最后一行):
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.amazon.mysampleapp"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
}
}
lintOptions {
abortOnError false
}
sourceCompatibility = 1.7
targetCompatibility = 1.7
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile fileTree(include: ['*.jar'], dir: 'app/libs')
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.amazonaws:aws-android-sdk-core:2.2.18'
compile 'com.amazonaws:aws-android-sdk-cognito:2.2.18'
compile 'com.amazonaws:aws-android-sdk-s3:2.2.18'
compile 'com.amazonaws:aws-android-sdk-mobileanalytics:2.2.18'
compile 'com.amazonaws:aws-android-sdk-lambda:2.2.18'
compile 'com.android.support:design:23.4.0'
compile 'com.wdullaer:materialdatetimepicker:2.3.0'
compile 'com.yarolegovich:lovely-dialog:1.0.4'
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
compile 'com.github.TouchBoarder:weekdays-buttons-bar:v1.0.2'
}
然后将存储库添加到我的顶级所有项目gradle文件:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
}
}
allprojects {
repositories {
jcenter()
compile 'com.github.TouchBoarder:weekdays-buttons-bar:v1.0.2'
}
}
但它无法正常工作我收到错误:
Could not find method compile() for arguments [com.github.TouchBoarder:weekdays-buttons-bar:v1.0.2] on repository container.
我显然没有正确编写我的gradle文件,但不确定是什么问题。
感谢您的帮助。
答案 0 :(得分:2)
尝试从顶层删除存储库所有项目gradle文件如下...
maven
此外,您需要在repositories
内添加apply plugin: 'com.android.application'
repositories {
maven {
url "https://jitpack.io"
}
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.amazon.mysampleapp"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
}
}
lintOptions {
abortOnError false
}
sourceCompatibility = 1.7
targetCompatibility = 1.7
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile fileTree(include: ['*.jar'], dir: 'app/libs')
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.amazonaws:aws-android-sdk-core:2.2.18'
compile 'com.amazonaws:aws-android-sdk-cognito:2.2.18'
compile 'com.amazonaws:aws-android-sdk-s3:2.2.18'
compile 'com.amazonaws:aws-android-sdk-mobileanalytics:2.2.18'
compile 'com.amazonaws:aws-android-sdk-lambda:2.2.18'
compile 'com.android.support:design:23.4.0'
compile 'com.wdullaer:materialdatetimepicker:2.3.0'
compile 'com.yarolegovich:lovely-dialog:1.0.4'
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
compile 'com.github.TouchBoarder:weekdays-buttons-bar:v1.0.2'
}
个网址到您的应用套件中。
{
"status":200,
"response":[
{
"docId":"1",
"docName":"Madan",
"docMobileNumber":"9676499774",
"location":"S R Nagar",
"specialization":"ENT",
"avaliablity":"Available",
"lat":"17.4436",
"log":"78.4458"
},
{
"docId":"2",
"docName":"Kumar",
"docMobileNumber":"9052598855",
"location":"KPHB",
"specialization":"Pediatrician",
"avaliablity":"Available",
"lat":"17.4948",
"log":"78.3996"
},
{
"docId":"3",
"docName":"charan",
"docMobileNumber":"8080809089",
"location":"Ameerpet",
"specialization":"Dentist",
"avaliablity":"Available",
"lat":"17.4375",
"log":"78.4483"
},
{
"docId":"4",
"docName":"Vamsy",
"docMobileNumber":"7777778888",
"location":"Kukatpally",
"specialization":"Orthopedic",
"avaliablity":"Available",
"lat":"17.4948",
"log":"78.3996"
},
{
"docId":"5",
"docName":"Ganesh",
"docMobileNumber":"9878686544",
"location":"Dilsuk Nagar",
"specialization":"Dermatologist",
"avaliablity":"Available",
"lat":"17.3688",
"log":"78.5247"
},
{
"docId":"6",
"docName":"Savitri",
"docMobileNumber":"8786599452",
"location":" West Marredpally",
"specialization":"Physician",
"avaliablity":"Not Available",
"lat":"17.4500",
"log":"78.5006"
},
{
"docId":"7",
"docName":"Sandhya",
"docMobileNumber":"9873243687",
"location":"Bowenpally",
"specialization":"Eye Specialist",
"avaliablity":"Available",
"lat":"17.898",
"log":"78.5008"
},
{
"docId":"8",
"docName":"Padma",
"docMobileNumber":"9768832418",
"location":"Kompally",
"specialization":"Cardiologist",
"avaliablity":"Not Available",
"lat":"17.5600",
"log":"78.5343"
},
{
"docId":"9",
"docName":"Priya",
"docMobileNumber":"9898767654",
"location":"Tirumalgiri",
"specialization":"Nerphrologist",
"avaliablity":"Available",
"lat":"17.787",
"log":"78.9805"
}
]
}
答案 1 :(得分:1)
我认为这是一个非常简单的错误: 尝试从v1.0.2中删除v
所以,而不是
compile 'com.github.TouchBoarder:weekdays-buttons-bar:v1.0.2'
试试这个:
compile 'com.github.TouchBoarder:weekdays-buttons-bar:1.0.2'
我不确定这是不是问题,但你可以尝试一下。
编辑:您还必须将jitpack添加到您的存储库。如果您查看说明,可以看到它包含:
repositories {
maven { url "https://jitpack.io" }
}
然后将其添加到您的gradle文件中:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
}
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
dependencies {
compile 'com.github.TouchBoarder:weekdays-buttons-bar:v1.0.2'
}
}