Mr.Smile filled pit production so remember --ndk library, ndk-build is not an internal or external command. . . mistake

This thought probably require the following steps:

1. Download ndk

2. Configure ndk environment variables

3. add some ndk configuration in android studio

4. Write c file

The library so generated

6. Call the library so


Most of the problems mentioned above, you can find a solution in the following two articles

http://blog.csdn.net/u010976213/article/details/50816956

http://blog.csdn.net/u010976213/article/details/53424364


The main purpose of this article is to record what I encountered the pit!

Let me talk about after the pit face, and that is in accordance with the two articles mentioned above, do all the work, run ndk-build, has not given an internal or external command.


1. Add the module at the defaultConfig gradle

ndk{
        moduleName "testNDK"			//名字自己取
        abiFilters "armeabi", "armeabi-v7a"	//这里是你想生成什么类型的就自己添加
    }
2. Add in the gradle module

externalNativeBuild {
        ndkBuild {
            path 'jni/Android.mk'	//这个是Android.mk文件的路径
        }
    }

After completion you can run ndk-build, generate a .so




The first writing, just for the record pit their own problems, if able to help, all the better














Published 22 original articles · won praise 29 · views 60000 +

Guess you like

Origin blog.csdn.net/Keep_Holding_On/article/details/69524288