gpt4 book ai didi

android - 如何在 build.gradle 中包含多个存储库?

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:34:41 25 4
gpt4 key购买 nike

Android Studio 不允许我构建它。它说找不到 com.mixpanel.blahblahblah。com.mixpanel.blahblahblah 来自 mavenCentral()我知道问题是因为它不识别 mavenCentral() 因为它只识别其他 repo 。我怎样才能同时包含这两者并使该项目正常运行?

apply plugin: 'com.android.application'
apply plugin: 'crashlytics'

buildscript {
repositories {
maven { url 'http://download.crashlytics.com/maven' }
}

dependencies {
classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
}
}


repositories {
maven { url 'http://download.crashlytics.com/maven' }
mavenCentral()
}


android {
compileSdkVersion 21
buildToolsVersion "21.1.2"

defaultConfig {
applicationId "co.dilmile.dilmile"
minSdkVersion 9
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.parse.bolts:bolts-android:1.1.2'
compile 'com.loopj.android:android-async-http:1.4.6'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.facebook.android:facebook-android-sdk:3.20.0'
compile 'com.android.support:support-v4:21.0.3'
compile 'org.roboguice:roboguice:3.+'
compile 'com.google.code.findbugs:jsr305:1.3.9'
provided 'org.roboguice:roboblender:3.+'
compile 'com.crashlytics.android:crashlytics:1.+'
compile 'com.mixpanel.android:mixpanel-android:4.5.3'
}

最佳答案

我认为您应该将 Maven Central 添加到您的构建脚本存储库中。我是这样操作的,没问题:

buildscript {
repositories {
mavenCentral()
maven { url 'http://download.crashlytics.com/maven' }
}
...
}

allprojects {
repositories {
mavenCentral()
maven { url 'http://download.crashlytics.com/maven' }
}
}

编辑:我相信你的 gradle 文件应该是

apply plugin: 'com.android.application'
apply plugin: 'crashlytics'

buildscript {
repositories {
maven { url 'http://download.crashlytics.com/maven' }
mavenCentral()
}

dependencies {
classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
}
}


repositories {
maven { url 'http://download.crashlytics.com/maven' }
mavenCentral()
}


android {
compileSdkVersion 21
buildToolsVersion "21.1.2"

defaultConfig {
applicationId "co.dilmile.dilmile"
minSdkVersion 9
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.parse.bolts:bolts-android:1.1.2'
compile 'com.loopj.android:android-async-http:1.4.6'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.facebook.android:facebook-android-sdk:3.20.0'
compile 'com.android.support:support-v4:21.0.3'
compile 'org.roboguice:roboguice:3.+'
compile 'com.google.code.findbugs:jsr305:1.3.9'
provided 'org.roboguice:roboblender:3.+'
compile 'com.crashlytics.android:crashlytics:1.+'
compile 'com.mixpanel.android:mixpanel-android:4.5.3'
}

关于android - 如何在 build.gradle 中包含多个存储库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28101444/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com