티스토리 뷰

반응형

Stack Overflow에 자주 검색, 등록되는 문제들과 제가 개발 중 찾아 본 문제들 중에서 나중에도 찾아 볼 것 같은 문제들을 정리하고 있습니다.

Stack Overflow에서 가장 먼저 확인하게 되는 가장 높은 점수를 받은 Solution과 현 시점에 도움이 될 수 있는 가장 최근에 업데이트(최소 점수 확보)된 Solution을 각각 정리하였습니다.

 

아래 word cloud를 통해 이번 포스팅의 주요 키워드를 미리 확인하세요.

Failed to install android-sdk: "java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema"

android-sdk를 설치하는데 실패했습니다: "java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema"

 문제 내용 

When installing the android sdk tools the following error is emitted:

안드로이드 SDK 도구를 설치할 때 다음 오류가 발생합니다:

 

java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema

 

Why is this happening and how can it be fixed?

이게 왜 발생하는 건가요? 어떻게 고칠 수 있을까요?

 

Debug output:

디버그 출력:
$ java --version
java 9
Java(TM) SE Runtime Environment (build 9+181)
Java HotSpot(TM) 64-Bit Server VM (build 9+181, mixed mode)
$ brew cask install android-sdk
==> Caveats
We will install android-sdk-tools, platform-tools, and build-tools for you.
You can control android sdk packages via the sdkmanager command.
You may want to add to your profile:
  'export ANDROID_SDK_ROOT=/usr/local/share/android-sdk'

This operation may take up to 10 minutes depending on your internet connection.
Please, be patient.

==> Satisfying dependencies
==> Downloading https://dl.google.com/android/repository/sdk-tools-darwin-3859397.zip
Already downloaded: /Users/tomasnovella/Library/Caches/Homebrew/Cask/android-sdk--3859397,26.0.1.zip
==> Verifying checksum for Cask android-sdk
==> Installing Cask android-sdk
==> Exception in thread "main"
==> java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
==>     at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
==>     at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
==>     at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
==>     at com.android.sdklib.tool.SdkManagerCli.main(SdkManagerCli.java:117)
==>     at com.android.sdklib.tool.SdkManagerCli.main(SdkManagerCli.java:93)
==> Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
==>     at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
==>     at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:185)
==>     at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
==>     ... 5 more
Error: Command failed to execute!

==> Failed command:
/usr/local/Caskroom/android-sdk/3859397,26.0.1/tools/bin/sdkmanager tools platform-tools build-tools;26.0.1

==> Standard Output of failed command:


==> Standard Error of failed command:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
    at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
    at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
    at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
    at com.android.sdklib.tool.SdkManagerCli.main(SdkManagerCli.java:117)

 

 

 높은 점수를 받은 Solution 

Just had this error, solved by downloading the Android SDK Command-line Tools (latest) on Android Studio, under Preferences > Appearance & Behavior > System Settings > Android SDK > SDK Tools and re-running flutter doctor --android-licenses

방금 이 오류가 발생했는데, Android 스튜디오에서 Preferences > Appearance & Behavior > System Settings > Android SDK > SDK Tools 아래에서 최신 Android SDK Command-line Tools를 다운로드하고 flutter doctor --android-licenses를 다시 실행하여 해결했습니다.

 

Android SDK path on Android Studio

Command-line Tools

 

Finally, add the new tools to your PATH, in your .bashrc, .zshrc or similar, before the obsolete tools:

마지막으로 새로운 도구를 .bashrc, .zshrc 또는 유사한 파일에 오래된 도구보다 먼저 PATH에 추가하세요.
export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin

 

 

 가장 최근 달린 Solution 

While building the flutter application an error occurred saying android sdk licenses not accepted. So, while accepting the license this error occurred.

Flutter 애플리케이션을 빌드하는 도중 "android sdk licenses not accepted" 오류가 발생했습니다. 따라서 라이선스를 수락하는 도중 이 오류가 발생했습니다.

 

Reason for this error in my case was I haven't installed sdkmanager command line tools which is required to accept the license.

제 경우에 이 오류의 원인은 라이선스를 수락하는 데 필요한 sdkmanager 명령줄 도구를 설치하지 않았기 때문이었습니다.

 

So, to install command line tools easiest way is:

그래서, 명령줄 도구를 설치하는 가장 쉬운 방법은 다음과 같습니다:

 

  1. Open android studio.
  2. Open SDK Manager (refer image below): enter image description here
1. 안드로이드 스튜디오를 열어주세요.
2. SDK 매니저를 열어주세요. (아래 이미지를 참고하세요):

 

  1. Select SDK tools inside it in bar.
  2. Tick the option Android SDK Command-line Tools (latest)
  3. Apply it.
  4. Run flutter doctor -android-licenses if using flutter or you can continue with the process where the error occurred.
3. 바 내부에 있는 SDK tools을 선택하세요.
4. Android SDK Command-line Tools (latest) 옵션을 선택하세요.
5. 선택한 내용을 적용하세요.
6. Flutter를 사용하고 있다면 flutter doctor -android-licenses 명령어를 실행하세요. 그렇지 않으면 오류가 발생한 곳에서 계속 진행하면 됩니다.

 

 

 

출처 : https://stackoverflow.com/questions/46402772/failed-to-install-android-sdk-java-lang-noclassdeffounderror-javax-xml-bind-a

반응형
댓글
공지사항
최근에 올라온 글