SoSa
SoSa

Reputation: 115

How to create a distinct duplicate of a project in Android Studio

I had an android project in this address:

D:\AppsFolder\MyApp

Then I copied the containing folder (via Windows file explorer) to this address on my Desktop:

C:\Users\User\Desktop\AppsFolder\MyApp

When I made some changes to Java classes of the copied project, the changes were also applied to the original project. I noticed that in the Android Studio's title bar, the address is a mixed of both:

MyApp [C:\Users\ ...\MyApp] - D:\AppsFolder\MyApp\app\src\main\java\ ...\MyClass.java [app]

What is the problem? How can I create a fresh new duplicate which does not affect the original project? And now how can I revert the changes of the original files?

Upvotes: 0

Views: 1246

Answers (2)

SoSa
SoSa

Reputation: 115

Oh, my mistake (which I'm not proud of!).

The issue was not about how I copied the project, rather it was about how I open the duplicate project.

When opening the duplicate project the first time, instead of going to

File > Open...

I should first import it:

File > New > Import Project...

This will build a new project that refers to the duplicate files, not the original files.

Once imported, you can then open the project as usual with the File > Open... command.

I know it's very basic, but assume an annoying trap for the beginners.

Upvotes: 0

Andrea Ebano
Andrea Ebano

Reputation: 573

Go to the Android Studio Projects folder on your computer. Copy the project's folder which you want to use. Create it's copy and rename the folder with a new name.

Open the Android Studio App. Go to the Open tab and open the project with the new name.

It's enough for me, hope it helps.

This link can also help: Android Studio - How to copy a project?

Upvotes: 1

Related Questions