NDK integration in Android studio

2019-03-11 21:06发布

问题:

Today I updated my android studio to 1.3 and I enter the NDK (android-ndk-r10e NDK version) path in local.properties (ndk.dir=C:\AndroidNDK\android-ndk-r10e\android-ndk-r10e) but I got this error.

Error:Execution failed for task ':app:compileDebugNdk'.

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.

please help me to solve this issue

回答1:

Set android.useDeprecatedNdk=true in gradle.properties to continue using the current NDK integration.

You just have to follow the instruction which is given to you in the error.



回答2:

Add following code in your build.gradle

 sourceSets {
        main {
            jni.srcDirs = []
        }
    }

This may solve your problem..



回答3:

r10e is fine on CLI with gradlew.

r10e is fine with androidStudio's version of gradle (gradl-2.4 in AS-1.3)

as long as you still use the approach mention here by 'ph0b'. see the 'sample .gradle file' and note that IMO and maybe in his view as well - u still dont want the default AS ndk process ( you want to do some extra config work and maintain full control yourself ).Ph0b blogs on ndk show how to do it all yourself and not to rely on the android.mk gen'd by AS. I still use my own exec for ndk and my own make files as explain by ph0b. All good with r10e / AS 1.3 on linux.

my CLI stdout....

:app:ndkBuild
make: Entering directory `/home/rob/src/speechnw/app/src/main/jni'
[armeabi-v7a] Compile thumb  : audioboo-ogg <= bitwise.c
[armeabi-v7a] Compile thumb  : audioboo-ogg <= framing.c
[armeabi-v7a] StaticLibrary  : libaudioboo-ogg.a
[armeabi-v7a] Compile thumb  : audioboo-flac <= bitmath.c
[armeabi-v7a] Compile thumb  : audioboo-flac <= bitreader.c
[armeabi-v7a] Compile thumb  : audioboo-flac <= cpu.c
[armeabi-v7a] Compile thumb  : audioboo-flac <= crc.c
[armeabi-v7a] Compile thumb  : audioboo-flac <= fixed.c
[armeabi-v7a] Compile thumb  : audioboo-flac <= float.c
[armeabi-v7a] Compile thumb  : audioboo-flac <= format.c
[armeabi-v7a] Compile thumb  : audioboo-flac <= lpc.c
[armeabi-v7a] Compile thumb  : audioboo-flac <= md5.c
[armeabi-v7a] Compile thumb  : audioboo-flac <= memory.c
[armeabi-v7a] Compile thumb  : audioboo-flac <= metadata_iterators.c
[armeabi-v7a] Compile thumb  : audioboo-flac <= metadata_object.c
[armeabi-v7a] Compile thumb  : audioboo-flac <= ogg_decoder_aspect.c
[armeabi-v7a] Compile thumb  : audioboo-flac <= ogg_encoder_aspect.c
[armeabi-v7a] Compile thumb  : audioboo-flac <= ogg_helper.c
[armeabi-v7a] Compile thumb  : audioboo-flac <= ogg_mapping.c
[armeabi-v7a] Compile thumb  : audioboo-flac <= stream_decoder.c
[armeabi-v7a] Compile thumb  : audioboo-flac <= stream_encoder.c
[armeabi-v7a] Compile thumb  : audioboo-flac <= stream_encoder_framing.c
[armeabi-v7a] Compile thumb  : audioboo-flac <= window.c
[armeabi-v7a] Compile thumb  : audioboo-flac <= bitwriter.c
[armeabi-v7a] StaticLibrary  : libaudioboo-flac.a
[armeabi-v7a] Compile++ thumb: audioboo-native <= FLACStreamEncoder.cpp
[armeabi-v7a] Compile++ thumb: audioboo-native <= FLACStreamDecoder.cpp
[armeabi-v7a] Compile++ thumb: audioboo-native <= util.cpp
[armeabi-v7a] StaticLibrary  : libstdc++.a
[armeabi-v7a] SharedLibrary  : libaudioboo-native.so
[armeabi-v7a] Install        : libaudioboo-native.so => libs/armeabi-v7a/libaudioboo-native.so
[x86] Compile        : audioboo-ogg <= bitwise.c
[x86] Compile        : audioboo-ogg <= framing.c
[x86] StaticLibrary  : libaudioboo-ogg.a
[x86] Compile        : audioboo-flac <= bitmath.c
[x86] Compile        : audioboo-flac <= bitreader.c
[x86] Compile        : audioboo-flac <= cpu.c
[x86] Compile        : audioboo-flac <= crc.c
[x86] Compile        : audioboo-flac <= fixed.c
[x86] Compile        : audioboo-flac <= float.c
[x86] Compile        : audioboo-flac <= format.c
[x86] Compile        : audioboo-flac <= lpc.c
[x86] Compile        : audioboo-flac <= md5.c
[x86] Compile        : audioboo-flac <= memory.c
[x86] Compile        : audioboo-flac <= metadata_iterators.c
[x86] Compile        : audioboo-flac <= metadata_object.c
[x86] Compile        : audioboo-flac <= ogg_decoder_aspect.c
[x86] Compile        : audioboo-flac <= ogg_encoder_aspect.c
[x86] Compile        : audioboo-flac <= ogg_helper.c
[x86] Compile        : audioboo-flac <= ogg_mapping.c
[x86] Compile        : audioboo-flac <= stream_decoder.c
[x86] Compile        : audioboo-flac <= stream_encoder.c
[x86] Compile        : audioboo-flac <= stream_encoder_framing.c
[x86] Compile        : audioboo-flac <= window.c
[x86] Compile        : audioboo-flac <= bitwriter.c
[x86] StaticLibrary  : libaudioboo-flac.a
[x86] Compile++      : audioboo-native <= FLACStreamEncoder.cpp
[x86] Compile++      : audioboo-native <= FLACStreamDecoder.cpp
[x86] Compile++      : audioboo-native <= util.cpp
[x86] StaticLibrary  : libstdc++.a
[x86] SharedLibrary  : libaudioboo-native.so
[x86] Install        : libaudioboo-native.so => libs/x86/libaudioboo-native.so
make: Leaving directory `/home/rob/src/speechnw/app/src/main/jni'
:app:compileDebugJava