【studio】整理了下studio中make Project、clean Project、Rebuild Project的区别

以前在用eclipse的时候,项目遇到了问题,我们一般点击“Project—>Clean..”就可以搞定,但到了studio后,Build下面一下子出来了好几个:

  • Make Project
  • Make Module
  • Clean Project
  • Rebuild Project
  • Build APK
  • Sync now

真是搞懵了

以前用Clean,现在找相似的,我就是在Clean Project和Rebuild Project之间选着用,具体选哪个,完全看心情。

Make Project:完全不明白是什么鬼,真不知美帝是怎么想的。

Make Module:就更让我晕了。顺便讲个笑话,我刚开始分不请Project和Module是什么关系,从来不用Module,一个程序建一个Project,现在想想当初好傻好天真。

Sync now:这个我一般没怎么用,我一般都是在gradle中遇到问题,它自己弹出来,我才点的。

其他几个就不说了。

下面进入重点。

我去网上搬运几个关于它们的区别,先上stackOverFlow的:

Most of the time you should use Make Project. Sometimes, after adding libraries and making big changes to the project you should use Rebuild Project.

If you look at the menu, you’ll see that Make Project and Compile have keyboard shortcuts, that suggests that they are often used. Others are seldom used.

It is the same as IntelliJ Idea.

Compile All the source files in the specified scope are compiled. The scope in this case may be a file, a package, etc.

Make Project All the source files in the entire project that have been modified since the last compilation are compiled. Dependent source files, if appropriate, are also compiled. Additionally, the tasks tied to the compilation or make process on modified sources are performed. For example, EJB validation is performed if the corresponding option is enabled on the Validation page.

Make Module Compiled are all the source files that have been modified since the last compilation in the selected module as well as in all the modules it depends on recursively.

Rebuild Project All the source files in the project are recompiled. This may be necessary when the classpath entries have changed, for example, SDKs or libraries being used added, removed or altered

前面三段我还勉强能看懂,后边就看不下去了,接下来,我去搬运一点中文版的区别。

  1. Make Project:编译Project下所有Module,一般是自上次编译后Project下有更新的文件,不生成apk。
  2. Make Selected Modules:编译指定的Module,一般是自上次编译后Module下有更新的文件,不生成apk。
  3. Clean Project:删除之前编译后的编译文件,并重新编译整个Project,比较花费时间,不生成apk。
  4. Rebuild Project:先执行Clean操作,删除之前编译的编译文件和可执行文件,然后重新编译新的编译文件,不生成apk,这里效果其实跟Clean Project是一致的,这个不知道Google搞什么鬼~~
  5. Build APK:前面4个选项都是编译,没有生成apk文件,如果想生成apk,需要点击Build APK。
  6. Generate Signed APK:生成有签名的apk。

注意:

对于Clean和Rebuild看到最后的效果是一样的。
平时小的改动直接用Make Project就可以,可以看到只有它有快捷方式,表明这个功能要经常用。对于一些大的改动比如更新lib,大功能修改等,用Clean或Rebuild,毕竟这两个编译起来要费时间。
如果有的时候死活编译不过,多试试Clean吧,会有意想不到的效果!

这些东西看完之后我还是有点懵,但是比以前要清醒一点点,也许以后就会懂了吧。

stackOverFlow

中文的

  • 10
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 10
    评论
这个错误通常是由于访问权限问题引起的。它表示无法访问私有的final字段java.io.File.path。这个错误可能会在Android Studio的Java代码出现。要解决这个错误,你可以尝试以下几种方法: 1. 检查访问权限:确保你正在尝试访问的字段具有正确的访问权限。如果你正在尝试从另一个类访问该字段,确保它具有public或protected访问权限。 2. 使用反射:如果你确实需要访问私有字段,你可以使用Java的反射机制来绕过访问权限限制。通过反射,你可以获取并修改私有字段的值。下面是一个使用反射访问私有字段的示例代码: ```java import java.lang.reflect.Field; // 获取私有字段的值 public static String getPrivateFieldValue(Object object, String fieldName) throws NoSuchFieldException, IllegalAccessException { Field field = object.getClass().getDeclaredField(fieldName); field.setAccessible(true); return (String) field.get(object); } // 修改私有字段的值 public static void setPrivateFieldValue(Object object, String fieldName, String newValue) throws NoSuchFieldException, IllegalAccessException { Field field = object.getClass().getDeclaredField(fieldName); field.setAccessible(true); field.set(object, newValue); } ``` 请注意,使用反射可能会导致代码更加复杂和容易出错,因此请谨慎使用。 3. 检查依赖项:如果你在使用第三方库或框架时遇到这个错误,可能是因为你的依赖项版本不兼容。尝试更新或降级相关的库以解决冲突。 4. 清除和重新构建项目:有时,清除和重新构建项目可以解决编译错误。在Android Studio,你可以选择“Build”菜单的“Clean Project”选项,然后再选择“Rebuild Project”选项。 希望这些方法能帮助你解决这个错误。如果你有任何进一步的问题,请随时提问。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 10
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值