EGHDK
EGHDK

Reputation: 18120

My Android Studio project keeps running my old project/application

I had an Android Studio project I created. The project was named App2-1. After I was done with that project I wanted to move onto my next project named App2-2 that is based off of App2-1. I copied and pasted the directory containing my project "App2-1" and named the new directory "App2-2". Then I opened up the directory using open project in Android Studio. No errors or anything. I made a whole bunch of changes and then I ran the app and it keeps opening my old app. Almost like it has a reference to it or something. Ideas?

Things I've tried:

I'm guessing my workflow of creating a new project based on an old project was incorrect. Appreciate any tips.

Upvotes: 15

Views: 13106

Answers (7)

Dimas Silva
Dimas Silva

Reputation: 1

I had same problem, later I found that MainActivity selected, as shown in the screenshot below, therefore MainActivity ran instead of app. Took me half hour to figure this out. I should have inadvertently selected Main and did not pay attention when click to run.

Android Studio run/debug button

Upvotes: 0

Nazar Normurodov
Nazar Normurodov

Reputation: 11

For me Build -> Clean project, and then Rebuild project worked

Upvotes: 0

Sanchit Malhotra
Sanchit Malhotra

Reputation: 1

For me using AVD Manager -> Actions -> Wipe data made it work.

Upvotes: 0

araldhafeeri
araldhafeeri

Reputation: 187

Tools > AVD manager > click the downward arrow next to your emulator > cold boot now

This should fix all of emulator problems.

Upvotes: 1

Andreas Gnyp
Andreas Gnyp

Reputation: 1840

There might be a new functionality. For me worked:

File -> Invalidate Caches / Restart -> Invalidate and Restart

Upvotes: 1

Defozo
Defozo

Reputation: 3092

For me, 'Gradle -> Tasks -> other -> clean' worked.

Upvotes: 2

Andy B
Andy B

Reputation: 753

I would make a copy of the project in a new folder and in this copy delete the following;

  • .iml file
  • .gradle folder
  • .idea folder
  • build folder

then open Android Studio and select 'File > Import Project...' and select the new projects settings.gradle file and click 'open'

You might have to check the dependencies and re-build but hopefully this should set things up in AS from scratch.

Upvotes: 11

Related Questions