I have a problem with my Android studio 2. That's whenever I want to clean or rebuild my android project, I always get this message
Error:Execution failed for task ':app:clean'.
Unable to delete directory: C:\Users\MyPC\Desktop\SharePlace\app\build\intermediates
and can not fix it. what I only can do is go to File explorer and delete it.
then come back android studio and rebuild again. Sometime, that way also does not work.
I need some help to fix that Android studio. Please.
Thank inadvance!
Solution 1 :
you are using Android Studio 2.0 Beta, this issue might appear (more likely if you are working on NTFS filesystem) and it seems like the "Instant Run" is the culprit. Search for "Instant Run" in settings and uncheck the box.
I have filed an issue on the bug tracker.
Solution 2 :
You need to go to the source file directly. Close the studio and go to the path the issue is located at and delete the folder there.
I got a lot of faults like this.
Try to refresh all gradle projects: in Android Studio click on the "Gradle" tab on the right side of the window. When the gradle menu is shown, click on two blue mixed arrows icon. Then wait a moment until gradle completes refreshing and try cleaning or rebuilding again.
For me it was fixed by running Android Studio as administrator.
Manually deleted folder( build\generated and build\intermediates) after closing android studio works for me.
Found the solution. For windows, goto Task Manager and find your Android Studio. Expand it and end task for OpenJDK Platform Binary as depicted below
screenshot.
Then re-run your app in Android Studio again. It should work, and you don't have to restart your Android Studio all the time. More productivity~
Related
I cloned a project from git and built it in android studio without any problems but I don't have (Run app) in android studio and also when I run run-android I get this error:
Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`
but I can run my emulator from AVD manager!
I did every solutions that I found with search but they didn't work for me
For me, the reason was one of the following:
Gradle sync was in progress
Gradle sync had failed
For the second case, go to your top-level or app build file and click Try again or Sync button on the notification shown at the top of the file.
You could also just try to sync the IDE with Gradle with either of these buttons:
I faced a similar error. I was trying to import a built apk to profile it and ran into the scenario where the run button was grayed out.
Ultimately what worked. I went to File > Manage IDE Settings > Restore default settings.. and redid the android studio setup.
Note: Doing this will RESET the entire Android Studio and redownload everything.
1- Give the SDK path (to find the emulator path), Usually in User\YourUsername\AppData (is hidden by default)\Local\Android\Sdk. in File->Project structure, SDK location. Also the Java\Jdk path for (JDKs) and the path "...java\util\concurrent" exist
Do not reset the IDE Settings (because you need to reinstall a lot of things and it will not solve)
2 possibility - from File->Setting->Tools->Emulator to check the Launch in a tool window
3 possibility -
Does anyone have such problems as:
Cannot install debug-apk because cannot find Application file, which exists in Androidmanifest.xml or:
The APK file /home/skullper/AndroidStudioProjects/app_pay/app/build/outputs/apk/app-debug.apk does not exist on disk.
Error while Installing APK
Of course I can fix this with ./gradlew assembleDebug, but I should launch this each time before run, otherwise it will run only assembleDebug build
Issue with kotlin std in projects with Java only
When I was using 3.0 everything was ok and I haven't such issues. What should I do to run my project???
UPDATE
Everything works. Answer in comments under question.
Thank to all who was trying to help
Try rebuilding your project and reinstall if nothing helps, I had this bug on my old computer and rebuilded helped.
Though if you reinstall Android Studio, make sure you delete the AVR folder properly! Otherwise the bits remaining from the previous version will alter the new installation completely useless.
did you try to go to Android Studio's File menu and select Invalidate Caches / Restart... option, then restart Android Studio?
If so try this:
1- Remove the directory ~/.gradle/caches/. It's OK to do this while Android Studio is opened. (Refer pm installing wrong package name)
2- Press "Sync project with Gradle files" icon on Android Studio
3- Run the project and the remote path will be correct.
Try this:
1 - Go to "Run/Debug configurations"
2 - In "Before launch" click in the "+"
3 - Add "Gradle-Aware Make"
4 - Click OK
Image here
Hope it helps
my project was working well but suddenly when I ran it on my phone, Android Studio freezes and I should stop it from task manager.
before this happens I installed "Geny motion" & "Virtual Box", but when the error occurred I uninstalled them. but the problem insisted.
Solutions I've tried
I uninstalled it and installed it again
I unplugged and plugged in my device
I disabled android indexing from setting
None of the above solutions worked.
I had today this exact problem. None of the above helped me until I found simple solution here
Just run File -> Invalidate Cache and Restart
That simple and it works!!!
Delete all Android Studio data - .gradle .android .androidstudio folders from your home folder. And all project build folders gradle and iml files.
This worked for me.
1.Close the project
2.Remove the project
3.Close Android Studio
4.Open it again
5.Open the project
Enjoy Coding!
I checked my java file and I saw somehow all the code in one of my java files was replaced with "NULL NULL NULL NULL....."
I deleted the file and the application runs without a problem.
Android Studio (3.1.3) froze on me while editing a source file. I waited and finally killed the process in Task Manager (Windows). Twice I tried to start up again and both times it got stuck with the "indexing..." message in the lower right. Both times I ended the process in Task Manager.
I looked in the source folder of the project I was working on. The source file I had been editing when it froze was "Receipt.java". There was another file in the src folder "Receipt.java__jb_tmp__". I deleted that file and Android Studio started up fine. It looks like I lost some edits, though.
When I did start up, it detected there had been some error and offered to submit a report.
If the project is large & has a lot of modules, you might need to increase the Allocated Heap Size for Android Studio.
Go to Edit Custom VM Options from Help menu and increase the value for -Xms and -Xmx
This is what I'm using
-Xms2048m
-Xmx8192m
-XX:MaxPermSize=2048m
-XX:ReservedCodeCacheSize=1024m
-XX:+UseCompressedOops
In my case color was declared as invalid, Android Studio ignored that and during building it froze. I had to remove the file, let it index, paste it back and fix the color string (it gave me error when I entered the pasted file)
just rename project folder then open IDE, it will show
now rename back to origin folder name, click open project
it work on my case
I have older project with sdk version 22, when I open it in android studio 3.1.2 on macOS. It keep indexing forever, everything was installed and configured properly but indexing loop never stopped.
Following worked for me
File > Invalidate caches/restart… > Invalidate caches/restart
Go to the File menu and click the option Invalidate Caches / Restart This will solve the problem ! Enjoy ;)
I was using my android Studio very well. I don't know what happened and now I am getting only Building "xxxx" Gradle project info whenever I want to create my new project. I am unable to open any new project. Please help. I don't have even 10 reputations to upload the screenshot.
I think my Gradle is not working. How can I reset or restart my Gradle ?
I think you have updated your gradle build tool.
Go to file>setting>build,execution deployment> gradle> check your gradle tool version
I had many hours trying to figure this out.
I have followed just about every Stack-overflow article on the issue.
The cause for me was my Anti-virus and Firewall settings. I turned these off, and restarted my Android Studio opened my application I was trying to build it all downloaded what it needed and sync'd nicely. Problem solved, relief as I have been literally days on this.
Add this line
File -> Settings -> Compiler -> Gradle -> VM Options:
-Xmx256m
I was failing a class because of this issue. I solved it by
1) Do not delete the Android Studio Version You Downloaded, Leave it intact
2) Google search an older version of Android Studio, in my case, 2.1.1
3) Download it and install, CHOOSE CUSTOM INSTALL
4) A message should appear saying approximately "Another version of Android Studio has been discovered, the installer will only download the missing files"
5) Confirm by starting a new project
I faced the same problem. Had to wait for 30 minutes for the project to built. But then it was working properly again. So maybe waiting is a solution.
My laptop crashed while Android Studio was running.
Now, When I tried to open project in Android Studio it gives me weird error and no project is opening.
Cannot load project: java.lang.RuntimeException: java.io.IOException: java.lang.AssertionError: Unexpected content storage modification"**
Edit: Also I'm in the welcome screen of Android Studio and have no access to Menu options to Invalidate Caches and restart Android Studio.
I had really big issue as I was not able to open project in Android Studio. Every time I start Android Studio dialog box appear that says:
Cannot load project: java.lang.RuntimeException: java.io.IOException: java.lang.AssertionError: Unexpected content storage modification
I solved it by doing following steps:
Close Android Studio
Go to the directory home_dir/.AndroidStudio/system/cache
Remove all the files in the cache directory.
Then restart IntelliJ
No guarantee this will work, but I have previously fixed a problem which is similar to this by invalidating the cache.
In Android Studio this is under File -> Invalidate Caches / Restart
For Android Studio 2.O follow these steps:
Close Android studio
Go to ~/.android/cache
Delete content
Restart android studio
Hope this will help
In C\users\.Androidstudio delete gradle.jar and try
Backup the jar before proceeding.
I got the same issue and this is related to IDE .
Android Studio has to do a fix.
I found the same issue but I found a fix, and all it took was renaming/deleting the .AndroidStudio hidden folder in Windows, under your home directory.
C:\Users\YOURUSERNAME.AndroidStudio
I renamed mine and I'm back up and running.
I could solve this issue in android studio by selecting File-> Invalidate caches/Restart .
Start Android Studio, close any open project.
On the right side, click on Configure -> Settings.
On the left side, in Compiler->Gradle set VM Options to -Xmx512m
Press OK, then create a project. Worked for me.
also because of that
It turns out it's a Windows 8 issue with the available virtual memory. It seems like a few new processes (like Superfetch) eat up a ton of processing power to constantly scan your drive for changes, so searching is faster.
The solution is to change the min and max virtual memory values. Here's how to do that:
http://windows.microsoft.com/en-us/windows/change-virtual-memory-size#1TC=windows-7