Androidstudio clean project 和 rebuild project 的区别
clean project : 会删除build文件夹
rebuild project:会删掉module下build文件夹,然后再创建build文件夹。
所以创建了aidl
文件后,可以rebuild project 一下,
这里会有一个问题,直接Build–Rebuild Project的话,会Rebuild 所有的 Project。这样耗时会很长,体验效果差。
那怎么只Clean/Rebuild 一个 module呢? 这样就需要用到gradle语句了。
Clean一个Project方法:
在 Terminal 标签下输入
gradlew :your_module_name:task_name
例如:
gradlew :testmyservice:clean
要写代码其实也很麻烦,但是要灵活很多。这种方式也告诉我们,所有的操作也是执行了相应的代码或命令
所以对比下Build窗口执行的命令就可以知道,就可以知道他们的区别了
Rebuild Project执行的代码:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40:clean UP-TO-DATE :app:clean UP-TO-DATE :base_lib:clean UP-TO-DATE :base_lib_yxputils:clean UP-TO-DATE :base_pro_https:clean UP-TO-DATE :base_lib_yxputils:preBuild UP-TO-DATE :base_lib_yxputils:preDebugBuild UP-TO-DATE :base_lib_yxputils:compileDebugAidl :base_lib_yxputils:compileDebugRenderscript :base_lib_yxputils:checkDebugManifest :base_lib_yxputils:generateDebugBuildConfig :base_lib_yxputils:generateDebugResValues :base_lib_yxputils:generateDebugResources :base_lib_yxputils:packageDebugResources :base_lib_yxputils:platformAttrExtractor :base_lib_yxputils:processDebugManifest :base_lib_yxputils:prepareLintJar UP-TO-DATE :base_lib_yxputils:generateDebugRFile :base_lib_yxputils:generateDebugSources :base_lib_yxputils:javaPreCompileDebug :base_lib_yxputils:compileDebugJavaWithJavacע: ijЩ�����ļ�ʹ�û????����ѹ�ʱ�� API�� ע: �й���ϸ��Ϣ, ��ʹ�� -Xlint:deprecation ���±��롣 :base_lib_yxputils:processDebugJavaRes NO-SOURCE :base_lib_yxputils:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug :base_pro_https:preBuild UP-TO-DATE :base_pro_https:preDebugBuild UP-TO-DATE :base_pro_https:compileDebugAidl :base_pro_https:compileDebugRenderscript :base_pro_https:checkDebugManifest :base_pro_https:generateDebugBuildConfig :base_pro_https:generateDebugResValues :base_pro_https:generateDebugResources :base_pro_https:packageDebugResources :base_pro_https:platformAttrExtractor :base_pro_https:processDebugManifest :base_pro_https:prepareLintJar UP-TO-DATE :base_pro_https:javaPreCompileDebug :base_pro_https:processDebugJavaRes NO-SOURCE
Clean Project执行的代码:
1
2
3
4
5
6:clean UP-TO-DATE :app:clean UP-TO-DATE :base_lib:clean UP-TO-DATE :base_lib_yxputils:clean UP-TO-DATE :base_pro_https:clean UP-TO-DATE
可以看出build project
包含clean project
的。
如果我们想要用gradlew
执行build project
操作 ,那么就要执行如下这么多操作:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16:base_pro_https:clean UP-TO-DATE :base_pro_https:preBuild UP-TO-DATE :base_pro_https:preDebugBuild UP-TO-DATE :base_pro_https:compileDebugAidl :base_pro_https:compileDebugRenderscript :base_pro_https:checkDebugManifest :base_pro_https:generateDebugBuildConfig :base_pro_https:generateDebugResValues :base_pro_https:generateDebugResources :base_pro_https:packageDebugResources :base_pro_https:platformAttrExtractor :base_pro_https:processDebugManifest :base_pro_https:prepareLintJar UP-TO-DATE :base_pro_https:javaPreCompileDebug :base_pro_https:processDebugJavaRes NO-SOURCE
这显然不显示,当然也有更简单的方法。如下:
点击右侧的Gradle窗口,直接找到想要的rebuild的项目,然后Tasks–build–双击modulename:build,就会执行build操作了,这样可以只build一个module。
最后需要注意的是:想要在terminal执行命令,需要工程根目录有这两个文件。
最后
以上就是沉静大炮最近收集整理的关于Androidstudio clean project 和 rebuild project 的区别的全部内容,更多相关Androidstudio内容请搜索靠谱客的其他文章。
发表评论 取消回复