What happens after launching a recovery project in Android Studio?

The document http://www.jetbrains.com/idea/help/rebuilding-project.html?search=reb tells me how to rebuild the project.

I don’t know what it means to rebuild the project ( Menu --> Build --> Rebuild Project ), will it clear the entire editing cache? I found that the size of the project was reduced after the start of the rebuild project

What does it mean to clean up a project in Android Studio?

+6
source share
2 answers

In Android Studio, almost every voice in the build menu is mapped to (possibly more than one) gradle actions, where gradle is the official build system for Android. In particular, when you clean up a project, you delete some files from the build folder inside your application module, and when you select rebuild, which is the equivalent of doing gradle cleanup and build. For more information on the topic, I offer this Udacity course, which you can view for free. It teaches you gradle and how it integrates with android studio.

https://www.udacity.com/course/gradle-for-android-and-java--ud867

+4
source

The Android App is a Gradle project that uses the com.android.application plugin. When you press the restore button, the clear button, or the start button. He will execute a sequence of commands. Note that not the whole team is a Gradle Task. For example, the start and debug button will launch adb behind the scenes.

In Rebuild you run several Gradle tasks. You can see it in the lower right corner of Android Studio.

Gradle console tab

In this case, Android Studio will perform the following Gradle tasks: clean, :app:generateDebugSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:generateDebugAndroidTestSources, :app:compileDebugSources, :app:compileDebugUnitTestSources, :app:compileDebugAndroidTestSources

What you see before the colon (:) is the name of the module. app:generateDebugSource will run the generateDebugSource task in the app module.

But what happens if you have several modules?

Several modules

Android Studio seems to perform this task on every module.

 Executing tasks: [clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:compileDebugSources, :app:compileDebugAndroidTestSources, :app:compileDebugUnitTestSources, :myandroidlib:generateDebugSources, :myandroidlib:mockableAndroidJar, :myandroidlib:prepareDebugUnitTestDependencies, :myandroidlib:generateDebugAndroidTestSources, :myandroidlib:compileDebugSources, :myandroidlib:compileDebugUnitTestSources, :myandroidlib:compileDebugAndroidTestSources] 

Will it clear the entire editing cache? I find that the size of the project is reduced after starting the recovery project?

It will clear the files in the build folder. Usually this is not included in the project (added to .gitignore ). In the build folder, your final apk , R files, a report file (for example, a lint / JUnit test report) and generated classes (from a dagger / retrofit) will be presented. That is why it will reduce the size of your project.

By the way, what does it mean to clear a project in Android studio?

If you mean clear project , then clean project .

Clear project

Android Studio will perform the following tasks, which essentially remove the build folder.

Executing tasks: [clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :myandroidlib:generateDebugSources, :myandroidlib:mockableAndroidJar, :myandroidlib:prepareDebugUnitTestDependencies, :myandroidlib:generateDebugAndroidTestSources]

0
source

Source: https://habr.com/ru/post/988561/


All Articles