Java 如何将 Android Studio 项目导出为 zip 文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28030784/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to export an Android Studio project as a zip file?
提问by user3608814
How do I export a project in ZIP format in Android Studio?
如何在 Android Studio 中以 ZIP 格式导出项目?
I have always worked with Eclipse that has this feature.
我一直在使用具有此功能的 Eclipse。
采纳答案by yole
Starting with Android Studio 3.0, you can use File | Export to Zip File... to export your project. If you're using an older version, you can use the file manager of your operating system to pack the directory of your project into a .zip file.
从 Android Studio 3.0 开始,您可以使用 File | 导出到 Zip 文件...以导出您的项目。如果您使用的是旧版本,则可以使用操作系统的文件管理器将项目目录打包为 .zip 文件。
回答by HymansonIsaac
You can first push the project to Github and then download the project as zip. Only the necessary code will be pushed to Github, hence making it easier for others to go through the code.
您可以先将项目推送到 Github,然后将项目下载为 zip。只有必要的代码才会被推送到 Github,因此其他人可以更轻松地浏览代码。
Steps to push to Github:
1. In the Project Window, select Android. Only the app folder and necessary code can be seen.
2. Click on VCS
-> Import from Version Control
-> Share Project on Github
.
3. Enter project name and description.
4. Enter a commit message. You can select/deselect files to be pushed.
推送到 Github 的步骤:
1. 在项目窗口中,选择 Android。只能看到应用程序文件夹和必要的代码。
2. 点击VCS
-> Import from Version Control
-> Share Project on Github
。
3. 输入项目名称和描述。
4. 输入提交消息。您可以选择/取消选择要推送的文件。
Note:You will have to setup Github first in Android Studio.
注意:您必须先在 Android Studio 中设置 Github。
After this you will see a notification on top right of the IDE saying 'Project pushed to Github' and a hyperlink to the Github repository.
在此之后,您将在 IDE 的右上角看到一条通知,上面写着“项目推送到 Github”和一个指向 Github 存储库的超链接。
You can then download the repository as zip. This might seem to be a long process but it would help in the long run as your code can be easily managed using VCS within Android Studio itself.
然后,您可以将存储库下载为 zip。这似乎是一个漫长的过程,但从长远来看它会有所帮助,因为您可以在 Android Studio 中使用 VCS 轻松管理您的代码。
回答by Abhishek
- right click on app folder
- then send to
- then compressed via zip
- 右键单击应用程序文件夹
- 然后发送到
- 然后通过zip压缩
回答by Ilia Philipov
Following worked for me, Android Studio 2.0, assuming there are no libs.
以下为我工作,Android Studio 2.0,假设没有库。
A. From the source project
1. Copy /app/build.gradle
2. Copy /app/src/* including subdirectories (only contains manifest, java and resources)
A.从源项目
1.复制/app/build.gradle
2.复制/app/src/*包括子目录(只包含manifest、java和resources)
B. Create new project with the same package name, minSDK etc.
1. Replace /app/build.gradle
2. Replace /app/src/* including subdirectories
B. 新建项目,包名相同,minSDK 等。
1. 替换 /app/build.gradle
2. 替换 /app/src/* 包括子目录
C. Synchronize
C. 同步
D. Clean Project
D. 清洁工程
回答by phnmnn
It's easy, if you use git:
很简单,如果你使用 git:
git archive -o latest.zip HEAD
回答by Rakshit Tanti
Setup Git if you haven't already in Android Studio. Its free. From the terminal provided in the Android Studio go to a new fresh directory. Run this command: git clone <app directory path>
如果您尚未使用 Android Studio,请设置 Git。免费。从 Android Studio 中提供的终端转到一个新的新目录。运行此命令:git clone <app directory path>
This will copy all the required file to load the project and also the commit history to the current new directory.
这会将加载项目所需的所有文件以及提交历史复制到当前的新目录。
回答by Sagar Maiyad
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 tooption
- now select compressed via zip
- 右键单击您的项目文件夹
- 然后选择发送到选项
- 现在选择通过 zip 压缩
回答by rust
If you want to export your project to a .zipyou'll need to upgrade your version of Android Studio to version 3.0
如果要将项目导出为.zip,则需要将 Android Studio版本升级到3.0
回答by VVB
- Go to File
- Choose option Export to Zip File
- 转到文件
- 选择选项导出到 Zip 文件