简体   繁体   English

如何将 Android Studio 项目从 Windows 转移到 Mac OS X?

[英]How to transfer an Android Studio Project from Windows to Mac OS X?

I am trying to transfer my Android Studio project from my Windows computer over to a Mac.我正在尝试将我的 Android Studio 项目从我的 Windows 计算机转移到 Mac。

I am going into my Android Studio Projects, selecting the entire folder "MyApplication", and then copying to an external hard drive.我将进入我的 Android Studio 项目,选择整个文件夹“MyApplication”,然后复制到外部硬盘驱动器。

When I am on the Mac, I try to open the file on Android Studio.当我在 Mac 上时,我尝试在 Android Studio 上打开文件。
I go to File > Open... and find my application folder on the external hard drive, open.我转到文件 > 打开...并在外部硬盘驱动器上找到我的应用程序文件夹,打开。

Then I get this error:然后我收到这个错误:

Sync Android SDKs同步 Android SDK

The path 'C:\\Users\\Owner\\AppData\\Local\\Android\\Sdk' does not belong to a directory.路径“C:\\Users\\Owner\\AppData\\Local\\Android\\Sdk”不属于目录。 Android Studio will use this Android SDK instead: '/Users/user/Library/Android/sdk' and will modify the project's local.properties file. Android Studio 将改用此 Android SDK:'/Users/user/Library/Android/sdk' 并将修改项目的 local.properties 文件。

I click "OK", and nothing happens.我单击“确定”,然后什么也没有发生。

I assume I am transferring unnecessary local files from my Windows machine, but I don't know which ones I should copy over, which to leave, where to find them, and if there is a simple process for this (like an Export Project).我假设我正在从我的 Windows 机器传输不必要的本地文件,但我不知道我应该复制哪些文件,留下哪些文件,在哪里找到它们,以及是否有一个简单的过程(如导出项目) .

Sorry not exactly a coding question, but I can't seem to figure this out, and other answers make me feel like this should be super easy.抱歉,这不完全是一个编码问题,但我似乎无法弄清楚这一点,其他答案让我觉得这应该非常简单。
I already checked this and this .我已经检查过这个这个

At the very least, you only need至少,你只需要

app/
    src/
    build.gradle
build.gradle 
settings.gradle

You can keep the gradlew files, or you can install Gradle separately您可以保留gradlew文件,也可以单独安装 Gradle

If you have a local.properties , you must install Android SDK separately on the second machine, then point the sdk.dir property to that如果您有local.properties ,则必须在第二台机器上单独安装 Android SDK,然后将sdk.dir属性指向该属性

As far as transferring projects, I recommend using Git rather than external hard drives至于转移项目,我建议使用 Git 而不是外部硬盘驱动器

You have to get the settings for your project.您必须获取项目的设置。 For this, you can 'Export Settings' from Android studio in Windows and 'Import Settings' in Mac.为此,您可以在 Windows 中从 Android Studio 中“导出设置”,在 Mac 中“导入设置”。 A similar type of question is answered.回答了类似类型的问题。

Check this out: Moving Android Studio Projects and Configurations from Windows 7 to OS X看看这个: 将 Android Studio 项目和配置从 Windows 7 迁移到 OS X

去找到你的项目存放的地方,在项目上右击,然后为它创建一个zip文件夹,然后把zip文件夹移动到mac上解压,这是最好的方式也是最常用的方式

I did a Mac finder search on "c:\\" on a project imported from Window, and found a file named build-info.xml, that I renamed (temporarily in my mind) build-info-ko.xml ... and then everything went fine, I was able to Run, install APP (which initially failed, before the rename) and launch.我在从 Window 导入的项目中对“c:\\”进行了 Mac finder 搜索,并找到了一个名为 build-info.xml 的文件,我将其重命名(暂时在我脑海中)build-info-ko.xml ...和然后一切顺利,我能够运行,安装 APP(最初失败,在重命名之前)并启动。 (of course, using Mac own local Android SDK, ignoring the initial path with c:\\ ) (当然,使用 Mac 自己的本地 Android SDK,忽略初始路径 c:\\ )

Android Studio > File > Export to Zip File... Android Studio > 文件 > 导出到 Zip 文件...

and that's it... unzip the file over at MACOS and open with Android Studio.就是这样......在 MACOS 解压文件并使用 Android Studio 打开。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM