- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
更新了我的事件日志
最后编辑在尝试了所有可能的解决方案后,我发现我已经开始全新安装 Windows。这样做我注意到这确实是一个防火墙问题,我的防病毒软件阻止了 studio64.exe 进程。
我刚安装了 Android Studio 0.4.2,然后立即更新到 0.5.2,没有打开或创建任何新项目。
我更新了 Android SDK,然后创建了一个新项目。我不断收到 Gradle Refresh Failed 错误,即使我尝试更改本地 gradle 分发,似乎没有任何效果,我尝试 Gradle 的所有内容都回复:“请修复您的 Gradle 配置”...
自从我更新到 Android studio 5.1 后,我就遇到过这种情况,以前从未发生过。
我尝试使用 Gradle 1.10 和 1.11 以及可从网站下载的安装工具包中包含的 Gradle 包装器 http://developer.android.com/sdk/installing/studio.html
这是我的 gradle 文件:
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion "19.0.3"
defaultConfig {
minSdkVersion 8
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:+'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
以及外部的 build.gradle 文件。
// 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.+'
}
}
allprojects {
repositories {
mavenCentral()
}
}
现在我已经尝试从 Canary Build 下载最新版本,然后单独下载 SDK,仍然是同样的问题,这真的很烦人......是否有任何网络设置我可能设置不正确?
目前我正在使用 Android Studio 的默认 grale 包装器,这是我得到的错误:
10:58:37 AM Gradle 'ClujTourist' project refresh failed:
A fatal exception has occurred. Program will exit.
: Gradle settings
尝试使用以下命令编译项目后:gradlew.bat --stacktrace assemble
这是我得到的:
C:\Users\Adrian-PC\AndroidStudioProjects\ClujTourist>gradlew.bat --stacktrace as
semble
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'ClujTourist'.
> Could not resolve all dependencies for configuration ':classpath'.
> Could not find any version that matches com.android.tools.build:gradle:0.11
.+.
Required by:
:ClujTourist:unspecified
* Try:
Run with --info or --debug option to get more log output.
* Exception is:
org.gradle.api.ProjectConfigurationException: A problem occurred configuring roo
t project 'ClujTourist'.
at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigu
rationFailure(LifecycleProjectEvaluator.java:79)
at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(L
ifecycleProjectEvaluator.java:57)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProj
ect.java:507)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProj
ect.java:82)
at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuil
dConfigurer.java:31)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(Default
GradleLauncher.java:142)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradle
Launcher.java:113)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLaun
cher.java:81)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildCon
troller.run(InProcessBuildActionExecuter.java:64)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.jav
a:33)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.jav
a:24)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProce
ssBuildActionExecuter.java:35)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProce
ssBuildActionExecuter.java:26)
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50)
at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.jav
a:171)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.
execute(CommandLineActionFactory.java:201)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.
execute(CommandLineActionFactory.java:174)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(
CommandLineActionFactory.java:170)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(
CommandLineActionFactory.java:139)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionRep
ortingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionRep
ortingAction.java:22)
at org.gradle.launcher.Main.doAction(Main.java:46)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at org.gradle.launcher.Main.main(Main.java:37)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBoots
trap.java:50)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.j
ava:32)
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.ja
va:33)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:130)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)
Caused by: org.gradle.api.artifacts.ResolveException: Could not resolve all depe
ndencies for configuration ':classpath'.
at org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfigurat
ion.rethrowFailure(DefaultLenientConfiguration.java:52)
at org.gradle.api.internal.artifacts.ivyservice.DefaultResolvedConfigura
tion.rethrowFailure(DefaultResolvedConfiguration.java:36)
at org.gradle.api.internal.artifacts.ivyservice.SelfResolvingDependencyR
esolver$FilesAggregatingResolvedConfiguration.rethrowFailure(SelfResolvingDepend
encyResolver.java:106)
at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingArtifactDep
endencyResolver$ErrorHandlingResolvedConfiguration.rethrowFailure(ErrorHandlingA
rtifactDependencyResolver.java:176)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration
$ConfigurationFileCollection.getFiles(DefaultConfiguration.java:465)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration
.getFiles(DefaultConfiguration.java:202)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration
_Decorated.getFiles(Unknown Source)
at org.gradle.api.internal.initialization.DefaultScriptHandler.updateCla
ssPath(DefaultScriptHandler.java:75)
at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.
apply(DefaultScriptPluginFactory.java:145)
at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildSc
riptProcessor.java:38)
at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildSc
riptProcessor.java:25)
at org.gradle.configuration.project.ConfigureActionsProjectEvaluator.eva
luate(ConfigureActionsProjectEvaluator.java:34)
at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(L
ifecycleProjectEvaluator.java:55)
... 28 more
Caused by: org.gradle.api.internal.artifacts.ivyservice.ModuleVersionNotFoundExc
eption: Could not find any version that matches com.android.tools.build:gradle:0
.11.+.
Required by:
:ClujTourist:unspecified
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.LazyDependenc
yToModuleResolver$DynamicVersionResolveResult.notFound(LazyDependencyToModuleRes
olver.java:170)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.LazyDependenc
yToModuleResolver$AbstractVersionResolveResult.resolve(LazyDependencyToModuleRes
olver.java:91)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.LazyDependenc
yToModuleResolver.resolve(LazyDependencyToModuleResolver.java:47)
at org.gradle.api.internal.artifacts.ivyservice.VersionForcingDependency
ToModuleResolver.resolve(VersionForcingDependencyToModuleResolver.java:48)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.Dependency
GraphBuilder$ModuleVersionSelectorResolveState.resolveModuleRevisionId(Dependenc
yGraphBuilder.java:935)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.Dependency
GraphBuilder$DependencyEdge.resolveModuleRevisionId(DependencyGraphBuilder.java:
296)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.Dependency
GraphBuilder.traverseGraph(DependencyGraphBuilder.java:93)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.Dependency
GraphBuilder.resolve(DependencyGraphBuilder.java:66)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DefaultDep
endencyResolver$1.transform(DefaultDependencyResolver.java:108)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DefaultDep
endencyResolver$1.transform(DefaultDependencyResolver.java:77)
at org.gradle.api.internal.artifacts.ivyservice.DefaultIvyContextManager
.withIvy(DefaultIvyContextManager.java:61)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DefaultDep
endencyResolver.resolve(DefaultDependencyResolver.java:77)
at org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactDepe
ndencyResolver$1.create(CacheLockingArtifactDependencyResolver.java:39)
at org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactDepe
ndencyResolver$1.create(CacheLockingArtifactDependencyResolver.java:37)
at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAcc
ess.java:148)
at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(De
faultPersistentDirectoryStore.java:123)
at org.gradle.api.internal.artifacts.ivyservice.DefaultCacheLockingManag
er.useCache(DefaultCacheLockingManager.java:77)
at org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactDepe
ndencyResolver.resolve(CacheLockingArtifactDependencyResolver.java:37)
at org.gradle.api.internal.artifacts.ivyservice.SelfResolvingDependencyR
esolver.resolve(SelfResolvingDependencyResolver.java:41)
at org.gradle.api.internal.artifacts.ivyservice.ShortcircuitEmptyConfigs
ArtifactDependencyResolver.resolve(ShortcircuitEmptyConfigsArtifactDependencyRes
olver.java:46)
at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingArtifactDep
endencyResolver.resolve(ErrorHandlingArtifactDependencyResolver.java:44)
at org.gradle.api.internal.artifacts.ivyservice.DefaultConfigurationReso
lver.resolve(DefaultConfigurationResolver.java:42)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration
.resolveNow(DefaultConfiguration.java:240)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration
.getResolvedConfiguration(DefaultConfiguration.java:230)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration
_Decorated.getResolvedConfiguration(Unknown Source)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration
$ConfigurationFileCollection.getFiles(DefaultConfiguration.java:463)
... 36 more
BUILD FAILED
Total time: 7.864 secs
C:\Users\Adrian-PC\AndroidStudioProjects\ClujTourist>
还尝试从我的项目中删除 .gradle 和 gradle 文件。似乎没有任何效果。
编辑 到目前为止,似乎对我有用的是将服务目录 .gradle
替换为您的根目录,因为它似乎可能存在路径问题目录。让我知道这是否为您解决了问题!
最佳答案
轻松修复!
build.gradle
文件的 defaultConfig
部分需要放在 buildTypes
中,如下所示:
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion "19.0.3"
buildTypes {
defaultConfig {
minSdkVersion 8
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:+'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
请参阅 Migrating from 0.8 to 0.9 的指南.
此外,请确保您使用的是最新的 Gradle 分发 url(如果您使用的是 Gradle 包装器)。
在您的 gradle-wrapper.properties
文件中应包含以下行:
distributionUrl=http\://services.gradle.org/distributions/gradle-1.11-all.zip
最后确保您在再次构建之前清理
您的项目(Build -> Clean Project)。
关于Android Studio 0.5.2 Gradle 刷新项目失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22437097/
在 spring-security项目,在 build.gradle文件,以下插件可用: apply plugin: 'io.spring.nohttp' apply plugin: 'locks'
我正在尝试使用gradle任务作为“与操作系统无关的shell脚本”。我在编写构建文件的逻辑时没有问题,但是我希望能够从任何文件夹中运行它。 我的第一次尝试是在路径上放置一个带有build.gradl
我在同一目录下有三个具有不同名称的build.gradle dev.build.gradle uat.build.gradle prd.build.gradle 我有4期 “gradle build”
乡亲们 有谁知道如何使用gradle与自定义的build.gradle和settings.gradle一起运行-即两者在一起? 我认为我可以有一个自定义的build.gradle文件(-b标志)-但这
Gradle 配置有两个属性,称为 dependencies和 incoming .根据我的理解,我们可以通过 Gradle 依赖 block 向配置添加依赖,如下所示: dependencies {
我正在测试将我的工件推送到 Nexus Maven 存储库。我正在使用 gradle这样做。 gradle upload有什么区别和 gradle publish ? 最佳答案 目前gradle提供了
这里有一个类似的问题:Gradle properties not being read from ~/.gradle/gradle.properties,但它不能解决我的问题。 在我看来,gradle
如何检索 Gradle 本身的版本 以编程方式从 Gradle 插件中? 最佳答案 刚刚发现可以使用任何一种方法来解决它 getProject().getGradle().getGradleVersi
2 个 gradle 项目,A 和 B,其中 A 定义了对 B 的编译依赖。为 maven 和 gradle 项目启用了 JAR 的重新映射。我试过启用和禁用自定义工具模型。我在 init.d 目录下
如何从 gradle 运行另一个 gradle 脚本。我有多个 gradle 脚本可以在 /test 下运行测试目录。 /build.gradle使用要运行的测试 gradle 文件的名称调用。例如
我已经看到了多模块项目的不同布局,其中有些项目只有一个 build.gradle。而其他项目将有 build.gradle在根和 build.gradle在每个子项目中。我想知道有什么区别以及首选哪种
我对 Gradle 生命周期有一个基本的询问。我的项目是一个多模块项目。 我注意到以下命令: ./gradlew clean bignibou-server:run 不等于运行以下两个命令按顺序运行:
我有一个项目,其中包含一个子项目,如下所示: Root Project |----gradle.build |----SubProject |----|----gradle.build 这里的子项目包
我有 gradle 项目,我想向不使用 gradle 或 maven 等构建工具的项目添加依赖项。 目录结构如下: commonfolder\ gradleProject\ b
我想创建一个类来帮助我加载不同类型的属性(local.properties,gradle.properties,$GRADLE_HOME/gradle.properties,环境变量,系统属性和自定义
我有一个多模块项目,其目录结构如下: proj |-modA |-modB |-modMain \-modSysTest 依赖项是: modB -> modA modMain -> modB modM
我正在尝试创建一个可以在 --offline 模式下工作的 gradle 项目的副本。除了一个步骤,我已经自动化了所有步骤。我无法自动将插件 jar 下载到 gradle 缓存中。 我的离线分发通过指
基本上我想这样做: Use Gradle function from other gradle file 也就是说,从另一个 gradle 脚本中调用一个函数。问题是我的 build.gradle 在
我有一个简单的 gradle 插件,我想试用一下,但我不确定如何“请求”gradle 运行我的测试 这是我要修改的 block (在我的 gradle 构建文件的顶部) buildscript {
在 Android Studio 中创建项目时,我收到以下错误消息。 Failed to import new Gradle project: Could not install Gradle dis
我是一名优秀的程序员,十分优秀!