Why is Android studio not automatically cleaning my project - android-studio

I recently renamed my project by closing Android Studio, renaming the root project directory then opening A.S again.
A.S names the project using the new directory name, then I open it. A new .iml file is created with the new name. I deleted the old one and cleaned the project.
Everything went fine but now when I build it just deploys the app instead of cleaning it first. I have to manually clean it and it's annoying.
Is there a setting that might have gotten messed up?
Platform Details: Android Studio 3.0.1, Windows 10

Ok. So, apparently if you add flavors to your project then you have to manually clean the project otherwise when you build, Android Studio will launch the previous APK.

Related

Android Studio won't install from scratch and directly launches on running the .exe

I was facing some issues with my Android Studio, related to the SDK Manager and SDK itself. I tried to fix them but nothing worked. So I thought to uninstall Android Studio and set it up from scratch again.
But when I install the .exe file from the site and run it, it directly launches Android Studio without asking me to set it up again. I've deleted the Android folder, the gradle folder, everything I could think of to not have the app revert back to old settings. But it just launches on its own without letting me set everything up from scratch.
I tried uninstalling Android Studio from my system along with the files and folders I could think of. I tried installing Android Studio from the site, just the exe and also the zip file (also different versions of the same). But still, upon running the application it just launches Android Studio without asking me to set anything up.

Unknown Attribute Android: error on Android STUDIO 3.2.1

Things i have done to resolve this issue:
Clean Build & Rebuild
Deleted .idea file
Invalidated Caches/ Restart.. option
Turn On Power Save Mode.
SDk is up to date.
Sync Project with Gradle Files done.
Reinstall Android Studio done
recreate new project done
changed something in app Gradle file and synced the project again
android studio old version change also not help
Intellij shows to reset to default namespace, it will delete android namespace..
(In Project, Layout file corrections not reflecting into app)
Android Studio Version
Error Image
gradle image
Intelij Solution
This worked for me
Close Android studio
Delete all files from
C:\Users\.AndroidStudio3.2\system\caches
C:\Users\.AndroidStudio3.2\config //not importent
start android studio
Ran into the same issue. Seems to be something specifically related to Android Studio 3.2. My solution on Windows was to delete everything withing the cache/ folder in the .AndroidStudio3.2/ folder.
This problem happen for Android studio Cache & History.
Firstly In android studio go File -> Close Project and Exit Android Studio.
Then Delete below 2 Folders:
C:\Users\user-name.AndroidStudio3.X\system\caches
C:\Users\user-name.AndroidStudio3.X\config\terminal\history (optional)
Open the Android Studio and Enjoy!
Complete uninstall Android Studio (including system and cache files) and Reinstalling clears my bug...

Android studio location of caches/generated sources

I have switched to using Android Studio 3.1 RC2. I have detected that when I switch branches, I am running across generated sources from other branch. They still show up even if I do Build -> Clean Project. Or manually delete build folders in all my modules as well as top level build folder.
Only way to rectify this is delete .gradle folder in my project directory and my $HOME/.gradle , this is very time consuming.
Where does Android Studio keep its caches of generated files. I have tried Android Studio's clean "Invalidate Caches/Restart" without much help.
You can use
./gradlew cleanBuildCache
to clean up all caches under HOME/.gradle
See: https://developer.android.com/studio/build/build-cache.html

How to solve the issue of Android Studio 3 (3.1 canary) Preview: Cannot import project

I am working on Android Studio 3 Preview at the moment. However, whenever I tried to open an old project it says:
The project file specified already exists.
I have deleted:
Old code/project from hard disk (completely)
Removed the project from the project list.
Any tips on this?
This needs two steps:
You must delete the .idea folder under your project. It is a hidden directory. use ls -a to find it out.
Right click build.gradle and choose application. It probably popup a window asking for a program to open it, choose Android Studio.
I faced the same problem with 3.1 and .idea folder was also not there. Still it was not working. So instead of doing "Import Project" I did "Open an existing Android Studio project" and it worked.
I encounter same problem recently when opening existing Android Project,
deleting .idea or open directly build.gradle through Mac OS Finder work for me
Open the gradle file (select Android Studio if an application picker pops up) and it should bring up the "Import Project" dialog.
Just go to your Project Location Delete All files like .idea, .app etc and Relocate Your Project Location.

How to restore build.gradle and .Gradle folder

When I was trying to solve an issue with Android Studio I accidentally deleted .Gradle folder at the top of the project and build.gradle from within the app. I will post a screen shot of my project in Android Studio. The build tab also produces "make module my app project name" and "deploy module to app engine". The usual clean project, rebuild.... are not there.
How can I restore them?
If your are not using a VCS:
try use the local history to recovery the build.gradle file in your root folder (right click on the root folder)
If it fails. you can create a new project and copy the build.gradle. Usually this file contains generic info (like android gradle pluging and the repos to be used in the modules)
the .gradle folder is not a problem. Gradle wrapper will recreate this file
I copied both from a different project and pasted them in my project. That didn't solve the problem and I imported the project File->new->import project but that only created a duplicate within my project. I closed the project and deleted it from the list of project in Android studio. Then I created a project by importing it from Android Studio Projects folder. It took forever stuck in the gradle build and I have to restart AS manually. Now I have all my files and the project is compiling as it should.
You just need to reimport your project it will by default create the new gradle folder

Resources