문제 설명
Android 스튜디오 NDK 해결 방법 (Android Studio NDK workaround)
Android Studio에서 다음과 같이 해결 방법이 있다고 알려주는 NDK 프로젝트를 통합하려고 합니다.
경고: 기본 C/C++ 소스 코드를 찾았지만 NDK 옵션이 구성되지 않았습니다. Android.mk가 있는 경우 컴파일에 사용되지 않습니다. 권장되는 해결 방법은 다음을 추가하여 기본 jni 소스 코드 디렉토리를 제거하는 것입니다.
android { sourceSets { main { jni.srcDirs = [] } } }
build.gradle에 수동으로 ndk‑build를 사용하여 코드를 컴파일한 다음 결과 공유 객체를 src/main/jniLibs에 배치합니다.
ndk 빌드 후 armeabi‑v7a, mips 및 x86 폴더에서 .so 파일을 찾을 수 있는 두 곳이 있음을 발견했습니다.
/libs
/obj/local
위의 두 폴더 중 실제 . so 파일을 복사하시겠습니까?
이 작업을 수행하려면 다른 구성을 해야 합니까? Android Studio의 import ADT 메소드를 통해 프로젝트를 가져왔습니다. 감사합니다!
참조 솔루션
방법 1:
The suggested workaround assumes that you manually copy the contents of libs directory to src/main/jniLibs.
Alternative workaround is to add the following enchantment to the build.gradle file:
jniLibs.srcDirs = [ 'libs' ]
This line goes together with jni.srcDirs as stated in the message you quote.