从不同的 PC 打开 Android Studio 项目时如何更改 Gradle\SDK 设置 [英] How to change Gradle\SDK settings when opening Android Studio project from a different PC

查看:37
本文介绍了从不同的 PC 打开 Android Studio 项目时如何更改 Gradle\SDK 设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从我的工作 PC 复制了我的 Android Studio 项目并将其复制到我的家用 PC.当我打开项目时,出现以下错误:

I Copied my Android Studio project from my work PC and copied it to my home PC. When I opened the project I got the following error:

无法导入 Gradle 项目:无法获取类型的模型使用 Gradle 分发版的IdeaProject"'http://services.gradle.org/distributions/gradle-1.6-bin.拉链'.建造文件'C:\Users\Tom\AndroidStudioProjects\CongressProject\Congress\build.gradle'行:9 评估项目 ':Congress' 时出现问题.一个问题发生了评估项目 ':Congress'.SDK 目录 'D:\ProgramFiles\Android\android-studio\sdk' 不存在.

Failed to import Gradle project: Could not fetch model of type 'IdeaProject' using Gradle distribution 'http://services.gradle.org/distributions/gradle-1.6-bin.zip'. Build file 'C:\Users\Tom\AndroidStudioProjects\CongressProject\Congress\build.gradle' line: 9 A problem occurred evaluating project ':Congress'. A problem occurred evaluating project ':Congress'. The SDK directory 'D:\Program Files\Android\android-studio\sdk' does not exist.

我猜这是因为我的所有 SDK\JDK 和所有其他设置都位于我的工作 PC 和家用 PC 的不同位置.我每次尝试重建项目时都会遇到此错误.

I guess that's because all my SDK\JDK and all other settings are in different locations in my work PC and home PC. I get this error all the time I try to rebuild my project.

如何解决这个问题,以便我可以在家和工作中处理同一个项目?我想让从我的 2 台不同的 PC 上复制项目变得容易.

How do I fix this so I can work on the same project from home and work? I want to make it easy to copy the project from my 2 different PC's.

谢谢!

推荐答案

我发现了一个类似的问题:更新 Android Studio 后出现 Gradle 构建错误

I found a similar question in: Gradle build errors after updating Android Studio

在项目根目录的local.properties文件中,修改sdk.dir的值.

in the local.properties file in the root of the project, change the sdk.dir value.

这篇关于从不同的 PC 打开 Android Studio 项目时如何更改 Gradle\SDK 设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆