java – How to export an Android Studio project as a zip file?-ThrowExceptions

Exception or error:

How do I export a project in ZIP format in Android Studio?

I have always worked with Eclipse that has this feature.

How to solve:

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.

###

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.

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.

Note: You will have to setup Github first in Android Studio.

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.

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.

###

  1. right click on app folder
  2. then send to
  3. then compressed via zip

###

If you want to export your project to a .zip you’ll need to upgrade your version of Android Studio to version 3.0

###

Following worked for me, Android Studio 2.0, assuming there are no libs.

A. From the source project
1. Copy /app/build.gradle
2. Copy /app/src/* including subdirectories (only contains manifest, java and resources)

B. Create new project with the same package name, minSDK etc.
1. Replace /app/build.gradle
2. Replace /app/src/* including subdirectories

C. Synchronize

D. Clean Project

###

Windows:

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

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

###

  1. Go to File
  2. Choose option Export to Zip File

###

It’s easy, if you use git:

git archive -o latest.zip HEAD

###

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>

This will copy all the required file to load the project and also the commit history to the current new directory.

Leave a Reply

Your email address will not be published. Required fields are marked *