如何导出Android Studio项目?

时间:2023-01-17 09:17:18

I just started using the Android Studio IDE and I already released and published a simple APK to Google Play store. The problem is that I did this at work. Now I downloaded the Android Studio at my home and I want to continue working and fixing bugs on my Project. I see that there is Import Project in the Android Studio home screen, but from where I export the project in order to import it? I tried Zipping my whole Project folder and import it but it didn't work very well.

我刚刚开始使用Android Studio IDE,我已经发布了一个简单的APK到Google Play商店。问题是我在工作中这样做了。现在我在家里下载了Android Studio,我想继续工作并修复我的Project上的bug。我看到Android Studio主屏幕中有导入项目,但是从导出项目的位置导入它?我试着压缩我的整个Project文件夹并导入它,但它不能很好地工作。

6 个解决方案

#1


50  

In the Android Studio go to File then Close Project. Then take the folder (in the workspace folder) of the project and copy it to a flash memory or whatever. Then when you get comfortable at home, copy this folder in the workspace folder you've already created, open the Android Studio and go to File then Open and import this project into your workspace.

在Android Studio中,转到文件然后关闭项目。然后获取项目的文件夹(在工作区文件夹中)并将其复制到闪存或其他任何内容。然后,当您在家中感到舒适时,将此文件夹复制到您已创建的工作区文件夹中,打开Android Studio并转到文件然后打开并将此项目导入您的工作区。

The problem you have with this is that you're searching for the wrong term here, because in Android, exporting a project means compiling it to .apk file (not exporting the project). Import/Export is used for the .apk management, what you need is Open/Close project, the other thing is just copy/paste.

你遇到的问题是你在这里搜索错误的术语,因为在Android中,导出项目意味着将其编译为.apk文件(而不是导出项目)。导入/导出用于.apk管理,你需要的是打开/关闭项目,另一件事就是复制/粘贴。

#2


18  

As mentioned by other answers, as of now android studio does not provide this out of the box. However, there are ways to do this easily.

正如其他答案所述,截至目前,android studio并未提供开箱即用的功能。但是,有很多方法可以轻松完成。

As mentioned by @Elad Lavi, you should consider cloud hosting of your source code. Checkout github, bitbucket, gitlab, etc. All these provide private repositories, some free, some not.

正如@Elad Lavi所提到的,您应该考虑云托管您的源代码。结帐github,bitbucket,gitlab等。所有这些提供私人存储库,一些免费,一些不。

If all you want is to just zip the sources, you can achieve this using git's git archive. Here are the steps:

如果你想要的只是压缩源代码,你可以使用git的git archive来实现。以下是步骤:

git init       # on the root of the project folder
git add .      # note: android studio already created .gitignore
git commit -m 'ready to zip sources'
git archive HEAD --format=zip > /tmp/archive.zip

Note: If you intend to send this by email, you have to remove gradlew.bat from zip file.

注意:如果您打算通过电子邮件发送此邮件,则必须从zip文件中删除gradlew.bat。

Both these solutions are possible thanks to VCS like git.

由于像git这样的VCS,这两种解决方案都是可行的。

#3


3  

It seems as if Android Studio is missing some features Eclipse has (which is surprising considering the choice to make Android Studio official IDE).

似乎Android Studio缺少Eclipse所具有的一些功能(考虑到选择制作Android Studio官方IDE,这是令人惊讶的)。

Eclipse had the ability to export zip files which could be sent over email for example. If you zip the folder from your workspace, and try to send it over Gmail for example, Gmail will refuse because the folder contains executable. Obviously you can delete files but that is inefficient if you do that frequently going back and forth from work.

Eclipse能够导出可以通过电子邮件发送的zip文件。如果您从工作区压缩文件夹,并尝试通过Gmail发送该文件夹,Gmail将拒绝该文件夹,因为该文件夹包含可执行文件。显然你可以删除文件,但是如果你经常这样做,那就是效率低下。

Here's a solution though: You can use source control. Android Studio supports that. Your code will be stored online. A git will do the trick. Look under "VCS" in the top menu in Android Studio. It has many other benefits as well. One of the downsides though, is that if you use GitHub for free, your code is open source and everyone can see it.

这是一个解决方案:您可以使用源代码管理。 Android Studio支持这一点。您的代码将在线存储。一个git就可以了。在Android Studio的顶层菜单中查看“VCS”。它还有许多其他好处。但其中一个缺点是,如果你免费使用GitHub,你的代码是开源的,每个人都可以看到它。

#4


1  

Source control is best way to handle this problem, if you don't want to pay then try bitbucket

源代码控制是处理这个问题的最佳方法,如果你不想付费再试试bitbucket

It's free, allows private repo for upto 5 members team.

它是免费的,允许最多5个成员团队的私人回购。

#5


0  

Apparently, there's a lot of "dead wood" in the "build" directories of a project.

显然,项目的“构建”目录中有很多“死木”。

Under linux/unix, a simple way to get a clean, private backup is to use the "tar" command along with the "--exclude=String" option.

在linux / unix下,获得干净的私有备份的一种简单方法是使用“tar”命令以及“--exclude = String”选项。

For example, to create an archive of all my apps while excluding the build directories, I have a script that creates the following 2 commands :

例如,要在排除构建目录的同时创建所有应用程序的存档,我有一个脚本可以创建以下两个命令:

cd $HOME/android/Studio
tar cvf MyBackup-2017-07-13.tar Projects --exclude=build

#6


-1  

Windows:

视窗:

First Open Command Window and set location of your android studio project folder like:

首先打开命令窗口并设置android studio项目文件夹的位置,如:

D:\MyApplication>

then type below command in it:

然后在其中键入以下命令:

gradlew clean

then wait for complete clean process. after complete it now zip your project like below:

然后等待完整的清洁过程。完成后,现在将您的项目压缩如下:

  • right click on your project folder
  • 右键单击您的项目文件夹
  • then select send to option now
  • 然后选择发送到选项
  • select compressed via zip
  • 选择zip压缩

#1


50  

In the Android Studio go to File then Close Project. Then take the folder (in the workspace folder) of the project and copy it to a flash memory or whatever. Then when you get comfortable at home, copy this folder in the workspace folder you've already created, open the Android Studio and go to File then Open and import this project into your workspace.

在Android Studio中,转到文件然后关闭项目。然后获取项目的文件夹(在工作区文件夹中)并将其复制到闪存或其他任何内容。然后,当您在家中感到舒适时,将此文件夹复制到您已创建的工作区文件夹中,打开Android Studio并转到文件然后打开并将此项目导入您的工作区。

The problem you have with this is that you're searching for the wrong term here, because in Android, exporting a project means compiling it to .apk file (not exporting the project). Import/Export is used for the .apk management, what you need is Open/Close project, the other thing is just copy/paste.

你遇到的问题是你在这里搜索错误的术语,因为在Android中,导出项目意味着将其编译为.apk文件(而不是导出项目)。导入/导出用于.apk管理,你需要的是打开/关闭项目,另一件事就是复制/粘贴。

#2


18  

As mentioned by other answers, as of now android studio does not provide this out of the box. However, there are ways to do this easily.

正如其他答案所述,截至目前,android studio并未提供开箱即用的功能。但是,有很多方法可以轻松完成。

As mentioned by @Elad Lavi, you should consider cloud hosting of your source code. Checkout github, bitbucket, gitlab, etc. All these provide private repositories, some free, some not.

正如@Elad Lavi所提到的,您应该考虑云托管您的源代码。结帐github,bitbucket,gitlab等。所有这些提供私人存储库,一些免费,一些不。

If all you want is to just zip the sources, you can achieve this using git's git archive. Here are the steps:

如果你想要的只是压缩源代码,你可以使用git的git archive来实现。以下是步骤:

git init       # on the root of the project folder
git add .      # note: android studio already created .gitignore
git commit -m 'ready to zip sources'
git archive HEAD --format=zip > /tmp/archive.zip

Note: If you intend to send this by email, you have to remove gradlew.bat from zip file.

注意:如果您打算通过电子邮件发送此邮件,则必须从zip文件中删除gradlew.bat。

Both these solutions are possible thanks to VCS like git.

由于像git这样的VCS,这两种解决方案都是可行的。

#3


3  

It seems as if Android Studio is missing some features Eclipse has (which is surprising considering the choice to make Android Studio official IDE).

似乎Android Studio缺少Eclipse所具有的一些功能(考虑到选择制作Android Studio官方IDE,这是令人惊讶的)。

Eclipse had the ability to export zip files which could be sent over email for example. If you zip the folder from your workspace, and try to send it over Gmail for example, Gmail will refuse because the folder contains executable. Obviously you can delete files but that is inefficient if you do that frequently going back and forth from work.

Eclipse能够导出可以通过电子邮件发送的zip文件。如果您从工作区压缩文件夹,并尝试通过Gmail发送该文件夹,Gmail将拒绝该文件夹,因为该文件夹包含可执行文件。显然你可以删除文件,但是如果你经常这样做,那就是效率低下。

Here's a solution though: You can use source control. Android Studio supports that. Your code will be stored online. A git will do the trick. Look under "VCS" in the top menu in Android Studio. It has many other benefits as well. One of the downsides though, is that if you use GitHub for free, your code is open source and everyone can see it.

这是一个解决方案:您可以使用源代码管理。 Android Studio支持这一点。您的代码将在线存储。一个git就可以了。在Android Studio的顶层菜单中查看“VCS”。它还有许多其他好处。但其中一个缺点是,如果你免费使用GitHub,你的代码是开源的,每个人都可以看到它。

#4


1  

Source control is best way to handle this problem, if you don't want to pay then try bitbucket

源代码控制是处理这个问题的最佳方法,如果你不想付费再试试bitbucket

It's free, allows private repo for upto 5 members team.

它是免费的,允许最多5个成员团队的私人回购。

#5


0  

Apparently, there's a lot of "dead wood" in the "build" directories of a project.

显然,项目的“构建”目录中有很多“死木”。

Under linux/unix, a simple way to get a clean, private backup is to use the "tar" command along with the "--exclude=String" option.

在linux / unix下,获得干净的私有备份的一种简单方法是使用“tar”命令以及“--exclude = String”选项。

For example, to create an archive of all my apps while excluding the build directories, I have a script that creates the following 2 commands :

例如,要在排除构建目录的同时创建所有应用程序的存档,我有一个脚本可以创建以下两个命令:

cd $HOME/android/Studio
tar cvf MyBackup-2017-07-13.tar Projects --exclude=build

#6


-1  

Windows:

视窗:

First Open Command Window and set location of your android studio project folder like:

首先打开命令窗口并设置android studio项目文件夹的位置,如:

D:\MyApplication>

then type below command in it:

然后在其中键入以下命令:

gradlew clean

then wait for complete clean process. after complete it now zip your project like below:

然后等待完整的清洁过程。完成后,现在将您的项目压缩如下:

  • right click on your project folder
  • 右键单击您的项目文件夹
  • then select send to option now
  • 然后选择发送到选项
  • select compressed via zip
  • 选择zip压缩