通常,当我查看使用Android Studio构建的Android应用程序的git diff
输出时,我会看到以下内容。有时它会将languageLevel
从JDK_1_7
更改为JDK_1_8
。其他时候,它会将languageLevel
从JDK_1_8
更改为JDK_1_7
。为什么有这么多优柔寡断?
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -24,7 +24,7 @@
</value>
</option>
</component>
- <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
+ <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
发布于 2018-06-26 05:30:26
1)将其添加到您的应用程序build.gradle
(在android
元素内)
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
2)从Git中排除.idea
文件夹,将其添加到您的项目级.gitignore
中
# Ignore idea folder
.idea/
然后,您需要按照类似于this的方式刷新版本化文件
版本控制
.idea
文件夹只有在与您的团队共享一些设置时才有用,如果您单独工作,或者如果您没有共享的编码策略,则可以将其删除。
https://stackoverflow.com/questions/51031969
复制相似问题