Makalele
Makalele

Reputation: 7521

Gradle using different abiFilters for debug and release

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.

Upvotes: 10

Views: 4543

Answers (1)

Alex Cohn
Alex Cohn

Reputation: 57173

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"
        }
    }
  }
}

Upvotes: 21

Related Questions