【Android】指定Android Studio生成so的架构

本以为随便一搜就能找到了,还是找了一会儿。测试成功的如下:

使用Android Studio进行NDK开发时,默认会生成多个架构的so,如armeabi-v7a,arm64-v8a,x86,x86-64。

如果只需要部分架构,在build.gradle中增加如下一行配置:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "xxxx"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        externalNativeBuild {
            cmake {
                cppFlags ""
            }
        }
        ndk{                                            // add this
            abiFilters "armeabi-v7a", "arm64-v8a"       
        }
    }

参考:https://blog.csdn.net/wove55678/article/details/52313208

发布了242 篇原创文章 · 获赞 95 · 访问量 61万+

猜你喜欢

转载自blog.csdn.net/think_ycx/article/details/89855509