Android 스튜디오 NDK 해결 방법 (Android Studio NDK workaround)


문제 설명

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.

(by AavaasAlex Cohn)

참조 문서

  1. Android Studio NDK workaround (CC BY‑SA 2.5/3.0/4.0)

#C++ #android-ndk #Android #android-studio #java






관련 질문

파일의 암호화/복호화? (Encryption/ Decryption of a file?)

이상한 범위 확인 연산자가 있는 C++ typedef (C++ typedef with strange scope resolution operator)

개체 배열 매개변수--오류: '문자' 필드에 불완전한 유형이 있습니다. (Object array parameter--error: field ‘letters’ has incomplete type)

C++에서 메모리 삭제 (Deleting memory in c++)

C++ 프로그램을 실행할 수 없습니다. No se ejecuta el programa (C++ i can't run a program. No se ejecuta el programa)

컴파일 시 변수의 이름과 수명 (Name and lifetime of variables at compile time)

control-c 후 Visual Studio 콘솔 프로그램 충돌 (visual studio console program crashes after control-c)

멤버 변수에 std::enable_if 또는 유사한 메서드 사용 (Using std::enable_if or similar method on member variable)

ifstream input_file(filename); (I am receiving an error "no matching function to call" in the line ifstream input_file(filename);)

ESP8266에서 잠시 실행하면 JsonData 크기가 0이 됩니다. (JsonData size becomes zero after awhile of running in ESP8266)

합에 대한 속도 문제(제수의 합) (Speed problem for summation (sum of divisors))

벡터 벡터에서 하위 벡터의 첫 번째 값을 찾기 위해 begin() 및 end() 반복기의 범위를 지정하는 방법은 무엇입니까? (How to specify a range for begin() and end() iterators to find first value of sub vector in a vector of vectors?)







코멘트