Android studio 中的 NDK 集成

NDK integration in Android studio

今天我把我的android工作室更新到1.3,然后在local.properties(ndk.dir=C)输入NDK(android-ndk-r10e NDK版本) :\AndroidNDK\android-ndk-r10e\android-ndk-r10e) 但我收到了这个错误。

错误:任务“: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.

请帮我解决这个问题

gradle.properties 中设置 android.useDeprecatedNdk=true 以继续使用当前的 NDK 集成。

您只需按照错误中给您的说明进行操作即可。

r10e 在 CLI 上与 gradlew.

没问题

r10e 适用于 androidStudio 版本的 gradle(AS-1.3 中的 gradl-2.4)

只要你还在使用 'ph0b' 的 approach mention here。查看 'sample .gradle file' 并注意 IMO,也许在他看来也是如此 - 你仍然不想要默认的 AS ndk 进程(你想做一些额外的配置工作并自己保持完全控制)。ndk 上的 Ph0b 博客展示了如何自己做这一切,而不是依赖 AS 生成的 android.mk。我仍然使用我自己的 ndk exec 和我自己的 make 文件,如 ph0b 所解释的那样。 linux 上的 r10e / AS 1.3 都很好。

我的 CLI 标准输出....

: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

在您的 build.gradle

中添加以下代码
 sourceSets {
        main {
            jni.srcDirs = []
        }
    }

这可能会解决您的问题..