gpt4 book ai didi

Android Studio 卡在 "Gradle: resolve dependencies ' _debugCompile '"or ' detachedConfiguration1'

转载 作者:IT老高 更新时间:2023-10-28 13:24:15 33 4
gpt4 key购买 nike

我不知道我在项目中做了什么更改,但是在构建 gradle 脚本时它突然无法通过这一步。

使用 'gradle assemble' 构建它没有问题。

编辑:之前的卡点是解决依赖项“detachedConfiguration1”。 (在 _debugCompile 第一次尝试失败后,我又回到了 detachedConfiguration1)。我猜是依赖项目太多了?我的一些示例项目在 Studio 中导入得很好......我重新安装了 Android Studio 并删除了所有设置和首选项。

每次它开始这样做时,我都必须杀死它。

敲响铃铛?

import com.android.build.gradle.AppPlugin
import com.android.build.gradle.LibraryPlugin

// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript {
repositories {
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
}

apply plugin: 'android'

repositories {
maven { url 'http://ksoap2-android.googlecode.com/svn/m2-repo' }

mavenCentral()
}

dependencies {

compile 'com.google.code.ksoap2-android:ksoap2-android:2.5.2'
compile 'com.android.support:support-v4:18.0.+'
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':lib-projects:StickyListHeaders')
compile project(':lib-projects:ActionBar-PullToRefresh')
compile project(':lib-projects:facebook')
compile project(':lib-projects:Mopub:mopub-sdk')
compile project(':lib-projects:NineOldAndroids')
compile project(':lib-projects:ActionBarSherlock:actionbarsherlock')
compile project(':lib-projects:ActionBarSherlock:actionbarsherlock-i18n')
compile project(':lib-projects:SmoothProgressBar')
compile project(':lib-projects:android-viewflow-master:viewflow')
}

android {

signingConfigs {

debug {
storeFile file('....')
}
}

compileSdkVersion 19
buildToolsVersion "19.0.3"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}

// Move the tests to tests/java, tests/res, etc...
//instrumentTest.setRoot('tests')

// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...

// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')

}
}

最佳答案

自从我切换到 Android Studio 后,我经常遇到这个问题。这确实是无法访问存储库的问题 - 可能是由于网络问题,或者更可能是由于任何原因导致存储库关闭。

我发现的最简单的解决方法是在 Android Studio 首选项中选择“脱机工作”模式。如果您需要添加新的依赖项,这将无济于事,但如果您已经添加了所有依赖项,则可以解决问题。

要启用此设置,请转到:

Preferences -> Gradle

在右侧选项中,转到“全局 Gradel 设置”并选中“离线工作”框。

盒子应该是这样的:

enter image description here

您可以定期取消选中此框以查看 repo 是否重新上线。

注意:此选项等效于从命令行运行 gradle 构建时设置 --offline 标志。

关于Android Studio 卡在 "Gradle: resolve dependencies ' _debugCompile '"or ' detachedConfiguration1',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23837465/

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