[RN오류해결] could not find build of variant which supports density 420 and an ABI in arm64-v8a

Minju Kim·2022년 6월 28일
0

React Native

목록 보기
4/4
> Task :app:installDebug FAILED
06:14:23 V/ddms: execute: running am get-config
06:14:23 V/ddms: execute 'am get-config' on 'emulator-5554' : EOF hit. Read: -1
06:14:23 V/ddms: execute: returning
Skipping device 'Pixel_2_API_29(AVD) - 10' for 'app:debug': Could not find build of variant which supports density 420 and an ABI in arm64-v8a

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.2/userguide/command_line_interface.html#sec:command_line_warnings
333 actionable tasks: 2 executed, 331 up-to-date

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:installDebug'.
> Failed to install on any devices.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

info Run CLI with --verbose flag for more details.
 ✘ minju 🦄   ~/Desktop/pai/voiceenr_client   feature/minju  

📍 문제상황

Skipping device 'Pixel_2_API_29(AVD) - 10' for 'app:debug': Could not find build of variant which supports density 420 and an ABI in arm64-v8a
arm64-v8a를 찾는데 이게 없다는 뜻

✅ 해결방법

/android/app/bundle.gradle여기에 열어보면 ndk가 있는데 그 안에 arm64-v8a가 없어서 나는 오류였다.
따라서 여기에 추가해 주니 정상적으로 실행이 되었다.

 ndk {
      	abiFilters "armeabi-v7a", "x86", "arm64-v8a"
     }

👍 추가 학습

  1. 안드로이드에는 CPU 종류 4개가 있는데 그게 바로 "armeabi-v7a", "x86", "arm64-v8a", "x86_64"이다.

  2. 다양한 Android 기기는 각기 다른 CPU를 사용하므로 서로 다른 명령 집합을 지원합니다. CPU와 명령 세트의 각 조합에는 고유한 ABI(Application Binary Interface)가 있습니다. ABI에는 사용할 수 있는 CPU 명령 집합(및 확장)을 포함하여 여러가지 정보가 들어있다.

  3. app/build.gradle 에 이런 설정이 있는데

splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86", "arm64-v8a"
        }
    }

저기서 enableSeparateBuildPerCPUArchitecture 라는 값이
def enableSeparateBuildPerCPUArchitecture 를 참조합니다.
그래서 enableSeparateBuildPerCPUArchitecture 값이 true 면 위에 splits 하위에 include에 작성된 CPU별로 apk가 따로 생성되고,
enableSeparateBuildPerCPUArchitecture 값이 false면 apk가 하나만 생성되네요.
그리고 universalApktrue이면 include에 작성된 cpu 별 apk이외에 app-universal-release.apk 가 추가로 생성됩니다. 안드로이드 기기가 하나밖에 없어서 각 apk를 테스트 해보지는 못했는데, app-universal-release.apk는 기기 관계 없이 설치되는 것 같습니다.
결론은 방금 확인하신 abi별로 apk가 다르다

🔗 참고링크

https://developer.android.com/ndk/guides/abis?hl=ko

profile
⚓ A smooth sea never made a skillful mariner

1개의 댓글

comment-user-thumbnail
2022년 7월 4일

Thanks for your sharingg free solitaire

답글 달기