Android Studio:重新下载依赖项并同步项目 [英] Android Studio: Re-download dependencies and sync project
问题描述
我从Github下载了一个开源游戏" ChaseWhisplyProject ".
I downloaded an open source game "ChaseWhisplyProject" source code from Github.
我将项目导入了Android Studio(版本1.5.1).
I imported the project in my Android Studio (Version 1.5.1).
它显示以下错误消息:
错误:无法打开zip文件.
Gradle的依赖项缓存可能已损坏(有时会在网络连接超时后发生.)
重新下载依赖项并同步项目(需要网络)
重新下载依赖项并同步项目(需要网络)
Error:Failed to open zip file.
Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)
Re-download dependencies and sync project (requires network)
我将所有依赖项版本都更改为最新版本,但仍显示相同的消息.
I changed all the dependency versions to latest one bu still it is showing the same message.
它在主要项目下有两个模块1)BaseGameUtils& 2)追逐. 上面的模块没有以粗体显示(我认为应该像模块"app"那样以粗体显示).
It has two modules under the main project 1) BaseGameUtils & 2)ChaseWhisply. The above modules are not shown in bold letters (I think it should be shown in bold letters like module "app").
以下是gradle文件.
Following are the gradle files.
1)Root Gradle:
1) Root Gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
allprojects {
repositories {
jcenter()
}
}
2)BaseGameUtils模块摇篮
2) BaseGameUtils Module Gradle
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
}
dependencies {
compile 'com.android.support:support-v4:23.1.1'
compile 'com.google.android.gms:play-services:8.4.0'
}
3)ChaseWhisply模块摇篮:
3) ChaseWhisply Module Gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
}
apply plugin: 'com.android.application'
dependencies {
compile 'com.android.support:gridlayout-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.nineoldandroids:library:2.4.0'
compile project(':BaseGameUtils')
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
lintOptions {
// TODO fix and remove !
disable 'MissingTranslation', 'DuplicateIds', 'ExtraTranslation'
}
defaultConfig {
minSdkVersion 14
targetSdkVersion 23
versionCode 22
versionName "0.3.6"
}
}
4)Settings.gradle
4) Settings.gradle
include ':ChaseWhisply', ':BaseGameUtils'
这是怎么了?请帮忙.
推荐答案
在导入libGDX项目时,我从Android Studio 2.2收到了相同的消息.
While importing a libGDX project I got the same message from Android Studio 2.2.
转到文件->项目结构,然后选择 Project 并设置
Gradle版本
和
Android插件版本
的值与我最近使用Android Studio 2.2创建并更新了SDK的另一个项目相同.然后可以同步gradle. Build-> Build Clean 没有问题.然后执行 Run-> Clean and Rerun ,然后项目运行正常.
to values identical to another project I had recently created with Android Studio 2.2 and updated SDK. Could then sync gradle. Did Build->Build Clean with no issues. Then did Run->Clean and Rerun and project ran fine.
希望这会有所帮助.
这篇关于Android Studio:重新下载依赖项并同步项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!