[NativeScript] ns run android 명령어 실행이 되지 않는 경우(sdk 버전 미스)

2023. 9. 12. 23:17IT/Vue

반응형

NativeScript 로 하이브리드 앱을 코딩하고 빌드하고 실제 안드로이드 에뮬레이터에서 동작을 확인해보려고 하면, 실행이 잘 되지 않는 경우가 발생한다.

주로 개발컴에서 셋팅을 다 해두고 깃허브 같은 곳에 푸시한 다음, 집 컴퓨터에서 깃 클론으로 땡겨서 빌드하는 경우에 종종 발생할 수 있는데, 주로 원인은 SDK 버전과 Build Tool 버전이 안맞아서 발생한다.

 

그런 경우 아래와 같은 에러 로그를 볼 수 있다. 에러 문구를 잘 보면 컴파일에 호환되는 SDK 버전이 잘 맞지 않는다고 나오는 것을 알 수 있다.

Execution failed for task ':app:checkDebugAarMetadata'.
4 issues were found when checking AAR metadata:

  1.  Dependency 'androidx.appcompat:appcompat-resources:1.5.1' requires libraries and applications that
      depend on it to compile against version 32 or later of the
      Android APIs.

      :app is currently compiled against android-31.

      Recommended action: Update this project to use a newer compileSdkVersion
      of at least 32, for example 33.

      Note that updating a library or application's compileSdkVersion (which
      allows newer APIs to be used) can be done separately from updating
      targetSdkVersion (which opts the app in to new runtime behavior) and
      minSdkVersion (which determines which devices the app can be installed
      on).

  2.  Dependency 'androidx.appcompat:appcompat:1.5.1' requires libraries and applications that
      depend on it to compile against version 32 or later of the
      Android APIs.

      :app is currently compiled against android-31.

      Recommended action: Update this project to use a newer compileSdkVersion
      of at least 32, for example 33.

      Note that updating a library or application's compileSdkVersion (which
      allows newer APIs to be used) can be done separately from updating
      targetSdkVersion (which opts the app in to new runtime behavior) and
      minSdkVersion (which determines which devices the app can be installed
      on).

  3.  Dependency 'androidx.emoji2:emoji2-views-helper:1.2.0' requires libraries and applications that
      depend on it to compile against version 32 or later of the
      Android APIs.

      :app is currently compiled against android-31.

      Recommended action: Update this project to use a newer compileSdkVersion
      of at least 32, for example 33.

      Note that updating a library or application's compileSdkVersion (which
      allows newer APIs to be used) can be done separately from updating
      targetSdkVersion (which opts the app in to new runtime behavior) and
      minSdkVersion (which determines which devices the app can be installed
      on).

  4.  Dependency 'androidx.emoji2:emoji2:1.2.0' requires libraries and applications that
      depend on it to compile against version 32 or later of the
      Android APIs.

      :app is currently compiled against android-31.

      Recommended action: Update this project to use a newer compileSdkVersion
      of at least 32, for example 33.

      Note that updating a library or application's compileSdkVersion (which
      allows newer APIs to be used) can be done separately from updating
      targetSdkVersion (which opts the app in to new runtime behavior) and
      minSdkVersion (which determines which devices the app can be installed
      on).

Unable to apply changes on device: emulator-5554. Error is: Command gradlew.bat failed with exit code 1.

 

이 경우에는 안드로이드 스튜디오를 켜고 SDK Manager 를 켜서 필요한 SDK와 빌드툴을 설치하면 대부분 해결이 된다.

 

셋팅을 마무리 짓고 ns run android 를 하면 에뮬레이터가 자동으로 뜨고, 웹팩 빌드가 되면서 앱이 실행된다.

 

반응형