development

Android N에서 IDE를 Java 1.8 이상으로 실행해야합니까?

big-blog 2020. 7. 18. 09:30
반응형

Android N에서 IDE를 Java 1.8 이상으로 실행해야합니까?


XML이 오류 메시지와 함께 레이아웃이 렌더링되지 않습니다. 이미 Java 8을 사용하고 있습니다.

여기에 이미지 설명을 입력하십시오

또한 Gradle의 최신 빌드 도구를 사용합니다.

android {
    compileSdkVersion 'android-N'
    buildToolsVersion 24.0.0 rc1
    ...
}

XML 오류-

여기에 이미지 설명을 입력하십시오


설명 한 것과 동일한 오류가 있지만 OS X에서는이 문제가 해결되지 않을 수 있음을 알고 있습니다 (Windows와 동등한 것을 모르기 때문에) .OS별로 다르기 때문에 OS X 동료를위한 해결책을 남기고 있습니다. 저 밖에. 파일을 편집하고 /Applications/Android\ Studio.app/Contents/Info.plist1.6 버전을 제거하십시오 (필자의 경우) 1.6 이상, 1.7 이상 또는 1.8 중 원하는 것을 배치 할 수 있습니다. 광산은 이렇게 끝났습니다

...
<key>JVMVersion</key>
<string>1.7+</string>
...

Java 버전 1.8_60 ~ 1.8_75 ( IDEA-146691 )의 드래그 앤 드롭과 호환되지 않는 버전이 있음을 유의 하십시오. 버전은 성공적으로 버전을 변경하면 IDE에서보고합니다.

터미널이 아닌 사용자

  1. Android Studio.app파일을 찾으십시오 . 도크에 있으면 마우스 오른쪽 버튼으로 클릭하고을 선택할 수 있습니다 Options > Show in Finder.
  2. 마우스 오른쪽 버튼으로 클릭하고을 선택하십시오 Show package content.
  3. 언급 된 파일 ( Contents/Info.plist)로 이동하십시오 .
  4. 자주 사용하는 텍스트 편집기로 파일을 편집하십시오.

미리보기 창의 Android 아이콘 옆에있는 문자 N을 클릭하고 API 레벨 23 이하를 선택하십시오. 해결해야합니다.

rpeview 창의 아이콘의 첫 번째 행


설정 JDK_HOMEJAVA_HOME환경 변수, 내 경우 C:\Program Files\Java\jdk1.8.0_60.

여기에 이미지 설명을 입력하십시오

에서 Java 버전을 확인하십시오 Help > About. 방금 설정 한 JRE 버전이 표시되어야합니다.

여기에 이미지 설명을 입력하십시오

즉, 이제에서 레이아웃을 미리 볼 수 있습니다 N.


들어 Mac 사용자 이 문제 (내가 OS X 10.11.5 안드로이드 스튜디오 2.1.2을 실행하는거야)와, 여기 당신이 그것을 해결할 수있는 방법은 다음과 같습니다

Currently, the Mac version of Android Studio is run with Java 6 (not necessarily the same as the JDK version for the app), because Java 6 has better font rendering than Java 7 & 8, and that's apparently more important than rendering your layout.

First of all, make sure you have JDK 8 installed.

Then run the following commands:

$ export STUDIO_JDK=/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk
$ open /Applications/Android\ Studio.app/

You may need to change the 91 in jdk1.8.0_91.jdk to a different version. You can see which JDK versions you have with:

$ ls /Library/Java/JavaVirtualMachines/

Unfortunately, this method requires opening the app from the terminal, but you could always create a script for it.

More info

Edit: And if you really don't want to open it from the terminal:

  1. Create an AppleScript with contents: do shell script "export STUDIO_JDK=/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk; open /Applications/Android\\ Studio.app/"
  2. File > Save Choose file format Application. Save it somewhere.
  3. If you want to change the icon, see here.
  4. Drag the app to your launchpad if you like.

I met the same issue.

I installed jdk1.6,jdk1.7,jdk1.8, and deployed Studio as what you did.

My solution is uninstall jdk1.6 and jdk1.7, only leave jdk1.8

sudo rm -rf ${path to jdk1.6}
sudo rm -rf ${path to jdk1.7}

That's all.


I'm using Ubuntu 14.04 and I was facing a similar error, with the difference I don't have NDK. My solution was, after setting up Java 8 in project definition, reboot Android Studio, no more.

Check system Java version, in console "java -version", output should say something like this

java version "1.8.0_91"

Had the same problem with Ubunutu. The problem was not running the IDE with Java8.

I fixed it with updating the default java program of the OS, using:

sudo update-alternatives --config java

And choosing the relevant Java8 path.


I faced the problem "Android N requires the IDE to be running with Java 1.8 or later." The error kept showing up in spite of setting C:\Program Files\Java\jdk1.8.0_92 as the project's JDK in File > Project Structure.

I solved it by updating JAVA_HOME in my environment variables from C:\Program Files\Java\jdk1.7.0_67 to C:\Program Files\Java\jdk1.8.0_92. When I did that and restarted Android Studio, the design mode became available.

OS: Windows 10

Android Studio: 2.1.2


I have solved it in these way.(AS+MAC OX El Capitan)

  1. Updating SDK Tools>Android SDK platform tools
  2. Go to Help>Edit Custom Properties> A dialog will prompt(press yes) then write

    JVMVersion=1.8 
    

Then close Android Studio fully and reload the project


From the docs: https://developer.android.com/studio/intro/studio-config.html#file_location

STUDIO_JDK: set the JDK with which to run Studio

I prefer using the STUDIO_JDK variable and leave other default java home variables alone.


My issue was that the Android N was "partially installed".

My solution was to go to - Preferences/Appearances and Behavior/System Settings/Android SDK and check the Status. If it's "partially installed" then you have to uninstall then reinstall. (Uncheck the checkbox and hit apply; it will uninstall; then you can check the box and install it again) Worked for me. If you go to lower version(like 23) then you have to change the buildToolsVersion variable to "23.0.0" in the build.gradle.


I was facing the same problem recently. Try changing the API preview level to 23 or lower. That worked for me.


I had faced the same problem. Please make sure that you are rendering the XML layout for the compiled SDK version (Must not be greater) . Means you will face this if you are compiling the code using Targeted SDK version 23 and your trying to render the XML in SDK version 24.


There are several thing to remember when set the STUDIO_JDK on Mac OS:

  • by default Apple's Java 1.6 is used to start the Android Studio
  • when the STUDIO_JDK is set to Oracle's Java it will be used by the Android Studio to run

The difference between two is that Apple's Java IMO provides nicer and better fonts antialiasing in the IDE.

A reply here is referencing a bug in Android Studio regarding the fonts antialiasing. The ticket is already closed but still rendering is different for Apple Java and Oracle SDK (I have v1.8.0_102). And the former still has better perception than the last.


machine: windows8 64bit in my case the jdk1.7 I had installed was 32bit hence I was using studio.exe (32bit) so even when I downloaded the new jdk1.8 (64bit) the studio instance I was using (32bit) couldn't detect it, but when I uninstalled the older jdk and tried to rerun studio.exe I was told to install a 32bit jdk. so I ran studio64.exe and it ran smoothly. ensure you have the correct path in your environment variables. cheers android N


Make sure you have installed jdk for x64 and not x84 when starting Android Studio (x64)

여기에 이미지 설명을 입력하십시오

참고 : https://stackoverflow.com/questions/35928580/android-n-requires-the-ide-to-be-running-with-java-1-8-or-later

반응형