Android NDK build with ANT script

后端 未结 2 2059
栀梦
栀梦 2020-12-13 15:12

Can we use the ANT script for Android NDK builds ? If Yes how? And if no, then why Not ?

I don\'t have any idea about it

2条回答
  •  情书的邮戳
    2020-12-13 15:37

    Call ndk-build from your -pre-build target, like this:

    
        
    
    
    
        
            
        
    
    

    Then you can set ndk.dir to point at the NDK directory from your local.properties file, or set it on the command line. I do this:

    ant -Dsdk.dir=/home/dg/apps/android-sdk-linux_x86-r11/ -Dndk.dir=/home/dg/apps/android-ndk-r6b release
    

    Now running ant will build your native code automatically. Plus, running 'ant clean' will clean your native code.

    Updated: Added failonerror="true" to the tasks --- this causes ant to abort if the make fails. Without it it'll just go right ahead and generate an APK with an invalid binary in it. Not good!

提交回复
热议问题