- Put your Android Studio on a diet
- How to make a deep clean of your Android Studio & Gradle junk files to fix up the mess.
- Clear your project directory
- Gradle cleaning
- Android Studio cleanup
- Extra cleaning
- Should I delete unused Android studio directories?
- What are unused Android Studio directories?
- Is it safe to delete build folder in Android Studio?
- Where are unused files in Android Studio?
- Is it safe to delete .gradle folder?
- How do I clean my Android build?
- Can I remove .android folder?
- How do I clear Android cache?
- What does rebuild project do in Android Studio?
- Is it safe to delete Android SDK?
- Can I delete system images Android studio?
- Is Android SDK safe?
- How do I delete unused files on Android?
- How do I remove unused strings in Android?
- How do I find unused classes in Intellij?
- Project Marble: Android Studio 3.3 Stable Release
- Develop
- Build
- Optimize
Put your Android Studio on a diet
How to make a deep clean of your Android Studio & Gradle junk files to fix up the mess.
Do you know that when you’re updating your Android Studio, Gradle or even dependencies, some old files are still present on your machine and can waste some disk free space?
On our laptops, disk space is limited and clearing those files will make you gain a lot of free space available. Having too many junk files may also slow down your machine and your builds!
In my case, I was also having strange build errors or gradle sync failures when it was working on my colleague’s machine.
It was time to do some deep cleaning and put our Android Studio on a diet by following some simple steps.
Clear your project directory
- Obviously, try to clean your project from android studio : “ Build -> Clean Project”. This will clear your build folders.
- Clear the cache of Android Studio using “ File -> Invalidate Caches / Restart” choose “ Invalidate and restart option” and close Android Studio.
- Remove your .gradle directory from the root of your project. It contains some Gradle cache files.
- Delete also the .idea directory ( make a backup before). It contains some project configuration files.
- Restart Android Studio.
Big project directories can weight around 500MB to 1GB.
Gradle cleaning
Now let’s take a look at Gradle files. If none of the above suggestions fix your problem, try these:
/.gradle directory. This is the Gradle home directory, containing caches, daemons and wrappers files. This is a really huge one, mine was
Inside those directories, you’ll have sub-directories for each version of Gradle you’ve been using. So, the more projects you have with different Gradle versions, the more sub-directories you will have.
You can delete those 3 directories:
- caches: Gradle cache files.
- daemon: essentially logs files of Gradle daemons.
- wrapper: different distributions of Gradle downloaded on you machine.
Android Studio cleanup
- Go to your Android home, usually
/.android and clear build-cache and cache directories. There are few MB to free here (
100MB for me)
In the
/Library/ directories, you will find the Android Studio preferences files, settings and plugins. You can clear the directories of previous version of Android Studio (> 1GB per version of AS). Starting with version 3.3, Android Studio will propose you to remove them after an update.
Android SDK cleaning
On Android Studio, check the SDK Manager and remove the following items:
- Old SDKs you don’t use anymore. I guess you’ll not miss the Android 3.0 SDK files.
- Remove the emulators you don’t use as they’re quite heavy ( some GB).
- I recommend to keep “Sources for Android xx” items as it will allow you to check the source code of the SDK from a previous version of Android & help you debugging.
- On the SDK Tools tab, click on “Show Packages Details” and uncheck the old build-tools or NDK versions.
- Delete unused emulators using the AVD.
You can gain easily 10GB with these steps.
Extra cleaning
There is some extra stuff you can clean too:
- Your download directory: you may have downloaded a lot of GIFs, video, Android Studio binaries that you can remove.
- Clear your local git branches that have been merged (don’t remove the ones that you still need!).
- Delete all those photoshopped pictures of your colleagues ( ͡° ͜ʖ ͡°).
- Clear your recycle bin.
That’s it ! You’ve gained some precious disk space on your machine and maybe fixed some weird issues with your Android Studio.
I don’t recommend to do a full clean everyday, you’ll waste time and your build time will be quite longer so you’ll be less productive. Take it only as a “spring cleaning” ritual.
I hope it helped you, and don’t forget to follow the Marie Kondo mantra and only keep things that spark joy.
Источник
Should I delete unused Android studio directories?
They can be deleted at any time and Android Studio will still be runnable, but previous settings may be lost. As long as you selected “import previous settings” when updating Android Studio, deleting folders from older versions will do no harm at all.
What are unused Android Studio directories?
Delete unused Android Studio directories
When you run a major version of Android Studio for the first time, it looks for directories containing caches, settings, indices, and logs for versions of Android Studio for which a corresponding installation can’t be found.
Is it safe to delete build folder in Android Studio?
Yes, you can delete the Build folder. If you are running Windows and you are not able to delete the folder, make sure you are the owner of the folder. Go to folder properties/security and check if your name is listed as the owner.
Where are unused files in Android Studio?
16 Answers. You can easily search for unused resources from Android Studio. Just press Ctrl Alt Shift i and type “unused resources” (without quotes).
Is it safe to delete .gradle folder?
gradle folder. Inside you can find all settings and other files used by gradle to build the project. You can delete these files without problems. Gradle will recreate it.
How do I clean my Android build?
Clear your project directory
- Obviously, try to clean your project from android studio : “Build -> Clean Project”. …
- Clear the cache of Android Studio using “File -> Invalidate Caches / Restart” choose “Invalidate and restart option” and close Android Studio.
- Remove your . …
- Delete also the . …
- Restart Android Studio.
Can I remove .android folder?
zip, which it will also allow you to rename if you choose to. Then you can delete the original folder. This will give you the ability to restore it if some application on your computer down the road complains that it cannot find the folder.
How do I clear Android cache?
In the Chrome app
- On your Android phone or tablet, open the Chrome app .
- At the top right, tap More .
- Tap History. Clear browsing data.
- At the top, choose a time range. To delete everything, select All time.
- Next to “Cookies and site data” and “Cached images and files,” check the boxes.
- Tap Clear data.
What does rebuild project do in Android Studio?
Rebuild removes the build folder’s contents. And builds some binaries; not including the APK!
Is it safe to delete Android SDK?
System images are pre-installed Android operating systems, and are only used by emulators. If you use your real Android device for debugging, you no longer need them, so you can remove them all. The cleanest way to remove them is using SDK Manager. Open up SDK Manager and uncheck those system images and then apply.
Can I delete system images Android studio?
The Process is relatively simple and is as follows: Select the image from Android SDK Manager. Remove the unnecessary system image by selecting the image and then clicking Delete package.
Is Android SDK safe?
SDKs can be unsafe (because they are implemented within apps, but yet run separate code). Malicious SDKs (with honest intentions or not) can violate users’ data privacy, damage app performance, or even cause apps to be banned from Google Play or the App Store.
How do I delete unused files on Android?
Clear your junk files
- On your Android device, open Files by Google .
- On the bottom left, tap Clean .
- On the “Junk Files” card, tap Confirm and free up.
- Tap See junk files.
- Select the log files or temporary app files you want to clear.
- Tap Clear .
- On the confirmation pop up, tap Clear.
How do I remove unused strings in Android?
In Android Studio there is a shortcut available. This will open a dialog in which you can type “Unused” to see a number of options. I generally type “unused resources” and get a list including layouts, strings, drawables, etc. in menu select Refactor–>click on Remove Unused Resources…
How do I find unused classes in Intellij?
- Press Ctrl + Shift + A (in Mac Command + Shift + A )
- Enter “unused declar”
- Double-click on “Unused declaration”
Источник
Project Marble: Android Studio 3.3 Stable Release
Android Studio latest version 3.3 released in the stable version which developers are calling project marble.
In this release, focus areas are reducing the number of crashes, hangs, memory leaks, and user-impacting bugs. As the developers are saying “This release of Android Studio is a solid milestone for the product”. Download Android Studio 3.3.
- Navigation Editor
- IntelliJ 2018.2.2 Platform Update
- Kotlin 1.3.11 Update
- Clang-Tidy Support for C++
- New Project Wizard update
- Delete Unused IDE Directories
- IDE User Feedback
- Improved incremental Java compilation when using annotation processors
- Lazy task configuration
- Single-variant project sync
- Android App Bundles now supports Instant Apps
- Multiple Emulator AVD instance Launch
- Android 9 Pie — Emulator System Images
- Emulator Snapshot Save Speed Improvement
- Profiler Performance Improvements
- Memory Profiler: Allocation Tracking Options
- Network Profiler: Formatted Text
- CPU Profiler: Frame Rendering Data
Let’s discuss them one by one:
Develop
Navigation Editor — The Navigation Editor lets you quickly visualize and build navigation into your app by using the Navigation Architecture Component. It is a visual editor which allows you to construct XML resources. With the Navigation Editor and the Navigation Component, you can build predictable interactions between the screens and content areas of your app. Learn more.
IntelliJ 2018.2.2 Platform Update — The core Android Studio IDE updated with improvements from IntelliJ IDEA through the 2018.2.2 release. New preview editor, updated icons, MacBook Touch Bar support, plus enhanced version control integrations. Learn more.
Kotlin 1.3.11 Update — This release of Android Studio bundles Kotlin 1.3.11, with support for Kotlin coroutines and contracts plus IDE support for the recommend Kotlin coding style. Learn more.
Clang-Tidy Support for C++ — Android Studio now includes support for static code analysis using Clang-Tidy for projects that include native code. To enable support for Clang-Tidy, update your NDK to r18 or higher.
You can then enable or re-enable the inspections by opening the Settings or Preferences dialog and navigating to Editor > Inspections > C/C++ > General > Clang-Tidy. When selecting this inspection in the Settings or Preferences dialog, you can also see the list of Clang-Tidy checks that are enabled and disabled under the Options section of the right-most panel. To allow additional checks, add them to the list and click Apply.
To configure Clang-Tidy with additional options, click Configure Clang-Tidy Checks Options and add them in the dialog that opens. Learn more.
New Project Wizard update — The Create New Project wizard has a new look and contains updates that help streamline the creation of new Android Studio projects.
Delete Unused IDE Directories — When you run a major version of Android Studio for the first time, it looks for directories containing caches, settings, indices, and logs for versions of Android Studio for which a corresponding installation can’t found. Past versions of Android Studio left these old directories that were hard to find and remove on your hard drive.
The Delete Unused Android Studio Directories dialog then displays locations, sizes, and last-modified times of these unused directories and provides an option to delete them.
IDE User Feedback — If you’ve opted into sharing usage statistics to help improve Android Studio, you’ll see these two new icons in the status bar at the bottom of the IDE window:
Just click the icon that best represents your current experience with the IDE. When you do so, the IDE sends usage statistics that allow the Android Studio team to understand your sentiment better. In some cases, such as when you indicate a negative experience with the IDE, you’ll have an opportunity to provide additional feedback.
If you haven’t already done so, you can enable sharing usage statistics by opening the Settings dialog ( Preferences on a Mac), navigating to Appearance & Behavior > System Settings > Data Sharing, and checking to Send usage statistics to Google.
Build
Improved incremental Java compilation when using annotation processors — Android Studio 3.3 decreases build time by improving support for incremental Java compilation when using annotation processors. The optimization requires Android Gradle plugin 3.3.0 or higher. Learn more.
Lazy task configuration — The plugin uses Gradle’s new task creation API to avoid initializing and configuring tasks that are not required to complete the current build (or tasks not on the execution task graph). For example, if you have multiple build variants, such as “release” and “debug” build variants, and you’re building the “debug” version of your app, the plugin avoids initializing and configuring tasks for the “release” version of your app. Learn more.
Single-variant project sync — Along with build speed, project sync speed can be a development bottleneck to for those who have large app projects with multiple build variants. In this version of the IDE, you can you can limit syncing to only the active build variant. In order for this optimization to work, your project needs to use Android Gradle plugin 3.3.0 or higher. You can enable this option under the Experimental preferences in Android Studio 3.3. To enable this optimization manually, click File > Settings > Experimental > Gradle ( Android Studio > Preferences > Experimental > Gradle on a Mac) and select the Only sync the active variant checkbox.
Android App Bundles now supports Instant Apps — You can now build and deploy Google Play Instant experiences from a single Android Studio project, and include them in a single Android App Bundle. Learn more.
Multiple Emulator AVD instance Launch — Android Emulator 28.0 now supports the ability to launch multiple instances of the same Android Virtual Device (AVD). Each instance of the AVD uses a minimal set of system resources. For those developers with continuous integration (CI) testing environments, this can be a convenient way to run tests in parallel off one AVD configuration. On the command line run the following commands:
Android 9 Pie — Emulator System Images — Alongside Android Studio 3.3, you can also download Android 9 system images for your emulator for your app testing. The Google Play emulator system images not only passe the official Android Compatibility Test Suite (CTS), they also include support for Peer-to-Peer Wi-Fi direct connections between two emulators. To start using this feature, launch the emulator (v28.0.22 or higher) via the command line and ensure the two emulators share the same Wi-Fi server and client port command line arguments.
Emulator Snapshot Save Speed — The time taken to close the emulator and Quickboot save a snapshot was slow. To solve this, they optimized the way snapshots are saved and managed, using a mapped file to save guest RAM. From aggregate metrics, they found that this optimization led to driving down the average quickboot save time from the last stable version to now from 27 seconds down to 3 seconds — a 8x improvement. Learn more here.
Optimize
Profiler Performance Improvements — Based on our feedback, they have dramatically improved Android Studio performance while using the profilers in this release. They have seen improvements on average of 2x in frame rates in our local tests.
Memory Profiler: Allocation Tracking Options — In previous releases, our app performs significantly worse while profiling with the default settings. To address this, they have changed the default Memory Profiler capture mode on Android 8.0 Oreo (API level 26) and higher devices to sample for allocations periodically. You can adjust this setting in the Allocation Tracking dropdown menu. By default, they also now temporarily turn off allocation tracking during CPU recordings to minimize the impact on recording results. Learn more.
Network Profiler: Formatted Text — The Network profiler in Android Studio 3.3 now formats common text types found in network payloads by default, including HTML, XML and JSON. You can toggle between formatted and raw text by navigating to either the Response or Request tab, and click on the View Parsed / View Source link. Learn more.
CPU Profiler: Frame Rendering Data — The CPU Profiler now shows you the render time for each frame on the main UI thread and Render Thread when you record with Trace System Calls. If you are trying to investigate and understand the bottlenecks or the source of UI jank in your app, this data can come in handy to see where you can improve your app performance. Learn more.
Thanks for reading! If you find this reading useful, please click the 👏 button and share to help others find it! Feel free to leave a comment 💬 below.
Have feedback? Let’s be friends on Twitter .
Источник