問(wèn)題描述
我從 Github 下載了一個(gè)開源游戲ChaseWhisplyProject"源代碼.
I downloaded an open source game "ChaseWhisplyProject" source code from Github.
我在我的 Android Studio(版本 1.5.1)中導(dǎo)入了該項(xiàng)目.
I imported the project in my Android Studio (Version 1.5.1).
它顯示以下錯(cuò)誤消息:
錯(cuò)誤:無(wú)法打開 zip 文件.
Gradle 的依賴緩存可能已損壞(這有時(shí)會(huì)在網(wǎng)絡(luò)連接超時(shí)后發(fā)生.)
重新下載依賴并同步項(xiàng)目(需要網(wǎng)絡(luò))
重新下載依賴并同步項(xiàng)目(需要網(wǎng)絡(luò))
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.
它在主項(xiàng)目下有兩個(gè)模塊 1) BaseGameUtils &2)ChaseWhisply.上面的模塊沒(méi)有用粗體顯示(我認(rèn)為應(yīng)該像模塊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) 根 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 模塊 Gradle
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 模塊 Gradle:
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'
這里有什么問(wèn)題嗎?請(qǐng)幫忙.
What is wrong over here? Please help.
推薦答案
在導(dǎo)入 libGDX 項(xiàng)目時(shí),我從 Android Studio 2.2 收到了相同的消息.
While importing a libGDX project I got the same message from Android Studio 2.2.
轉(zhuǎn)到文件->項(xiàng)目結(jié)構(gòu)然后選擇項(xiàng)目并設(shè)置
Gradle 版本
和
Android 插件版本
到與我最近使用 Android Studio 2.2 和更新的 SDK 創(chuàng)建的另一個(gè)項(xiàng)目相同的值.然后可以同步gradle.Build->Build Clean 沒(méi)有問(wèn)題.然后 Run->Clean and Rerun 項(xiàng)目運(yùn)行良好.
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.
希望這會(huì)有所幫助.
這篇關(guān)于Android Studio:重新下載依賴和同步項(xiàng)目的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!