Gradle using different abiFilters for debug and release
Asked Answered
K

1

10

here's a piece of my build.gradle file:

android {
    //...

    defaultConfig {
        //...

        externalNativeBuild {

                ndkBuild {
                    targets "MyGame"
                    arguments "NDK_MODULE_PATH=$cocospath:$cocospath/cocos:$cocospath/external:$cocospath/cocos/prebuilt-mk:$cocospath/extensions"
                    arguments "-j" + Runtime.runtime.availableProcessors()

                    buildTypes {
                        debug {
                            abiFilters "armeabi", "armeabi-v7a", "arm64-v8a"
                        }

                        release {
                            abiFilters "armeabi"
                        }
                    }

                }
        }
    }
    //.........

I'm trying to use three abi filters (armeabi, armeabi-v7a and arm64-v8a) while building app in debug mode and use only one (armeabi) while building release apk. But it doesn't work. Either debug and release version are using all three abiFilters.

What's wrong with my gradle file?

edit:

It turns out when I had all three abi filters and successfully build app I wanted to leave just armeabi and... still all three were added. I had to manually delete contents of app/build directory.

Kraigkrait answered 13/1, 2017 at 8:53 Comment(0)
M
21

You put your aabiFIlters in a wrong block. This is how it will work:

android {
  //...

  defaultConfig {
    //...

    externalNativeBuild {
      ndkBuild {
         targets "MyGame"
         arguments …
      }
    }
  }

  buildTypes {
    release {
       ndk {
            abiFilters "armeabi-v7a"
        }

        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
    debug {
        ndk {
            abiFilters "x86", "armeabi-v7a"
        }
    }
  }
}
Marking answered 14/2, 2018 at 15:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.