Android .idea/misc.xml’s languageLevel tag keeps changing JDKs –

Development issue/problem:

The language level key changes from JDK_1_8 to JDK_1_7 for reasons I don’t know.

What can happen?

Does this affect the IDEs of other developers working on the project? Maybe they have another android studio.

This is what happens after I noticed that the files have changed under the control of the :

$ git diff
diff –git a/.idea/misc.xml b/.xml
index fbb6828…5d19981 100644
— a/.idea/misc.xml
+ +++ b/.idea/misc.xml
@ -37.7 @@@@@@@@ .


+

He’s my Gentile, if that’s important.

.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures

What do I have to do to keep it that way?

How can this problem be solved?

Decision No 1:

It drove me crazy for a while. I was able to fix it by explicitly installing the Java version in my build.gradle:

android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}.

Note that if you are using VERSION_1_7, the .idea/misc.xml file will be changed to use JDK_1_8 when you start Android Studio cold or switch to another project using VERSION_1_8. The synchronization of the graduations will return to JDK_1_7. If you are using VERSION_1_8, you will not have this problem.

It’s not perfect, but I thought it was enough for now.

Decision No 2:

Here we come from Google after the upgrade to Android Studio 2.2. It can be good for others.

Starting with Android Studio 2.2, the JDK is included instead of being downloaded and installed on your system. My JDK project started to change when I made the update to version 2.2, perhaps because of the confusion between the two versions now available – system and embedded.

See also  The Growing Popularity of APIs in Web Development –

If you open the File > Project Structure (Mac OS) menu in the SDK Location tab, the JDK is there. There is now a new setting for using the built-in JDK. When I went to him, he solved my problem.

Fill in the image description here

Decision No 3:

It seems that the file should be kept under version control. I suggest leaving it in the guitar, but ignore all local changes:

git update index — accept unmodified .idea/misc.xml files

There may be conflicts when changing branches in these files. You can then use the following imlreset script to modify the :

#!/bin/bash
when reading f
do
[ -f $f ] && git checkout $f
done Make a similar script to ignore these files if you do this often.

Decision No 4:

I solved this problem by deleting the .ideemap and not passing it to the source code.

The problem is that some of these files are machine-specific configurations, so sharing these files may be a problem.

Its removal and that of the other crushers was done in two phases:

1) Add this .gitignore (from https://stackoverflow.com/a/32942758/869936)

# collected application files
*.apk
*.ap_

# Files for dex VM
*.dex

# Java class files
#.class

# generated files
bin/
gen/

# Local configuration file (sdk-pad, etc.)
local.properties

# Window Sketch db
Thumbs.db

# OSX files
.DS_Store

# Streamline project files
.classpath
.project

# Android Studio
*.iws
*.iml
.idea
.gradle
build/
*/build/

2) For each .gitignore line, execute the git rm line from the command line.

For example:

git rm *.iws
$ git rm *.iml
$ git rm .idea
$ git rm .gradle
$ git rm build/
$ git rm */build/

Adding and recording changes

See also  7+ Best Gaming Keyboards in 2024 [Definitive Guide]

Now these files are generated when you open the Android Studio project, not added to Git.

Good luck!

Related Tags:

intellij change gradle jvm,intellij gradle jdk path,gradle sourcecompatibility,intellij jdk,gradle xml android,modules xml,idea folder android studio,android studio runconfigurations xml,arrangement_settings_migrated_to_191,android studio idea workspace xml,.idea/codestyles/project.xml gitignore,android studio idea libraries