Saturday, July 9, 2016

Android compileReleaseNdk 에러 해결

NDK를 사용할때 JNI라는 폴더가 있으면 다음과 같이 최신의 experimental plugin을 사용하라고 에러메세지가 뜬다.

Error:Execution failed for task ':imagefilter:compileReleaseNdk'.
> Error: NDK integration is deprecated in the current plugin.  Consider trying the new experimental plugin.  For details, see http://tools.android.com/tech-docs/new-build-system/gradle-experimental.  Set "android.useDeprecatedNdk=true" in gradle.properties to continue using the current NDK integration.

그럴때는 gradle에서 다음과 같이 선언하면 jni폴더를 무시하게 되고, 에러가 발생하지 않으며, 콘솔에서 ndk-build로 빌드할 수가 있다.

    sourceSets {
        main {
            // eclipse의 폴더명과 동일하게 사용함, 왜냐면 기본적으로 ndk-build의 결과는 libs안에 들어가게 된다.
            jniLibs.srcDirs = ["src/main/libs"]

            // android studio가 직접 컴파일하지 않게 함
            jni.srcDirs = []
        }
    }

No comments:

Post a Comment