Android-runtime: enable abi split doesn't work

Created on 14 Jun 2018  路  10Comments  路  Source: NativeScript/android-runtime

Tell us about the problem

app doesn't build if you enable abi split

Which platform(s) does your issue occur on?

Android

Please provide the following version numbers that your issue occurs with:

  • CLI: 4.1.0
  • Runtime(s): 4.1.1

Please tell us how to recreate the issue in as much detail as possible.

I enable abi split here: app/App_Resources/Android/app.gradle
with following code:

splits {
    abi {
      enable true //enables the ABIs split mechanism
      reset() //reset the list of ABIs to be included to an empty string
      include 'arm64-v8a', 'armeabi-v7a', 'x86'
      universalApk true
    }
  }
FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Conflicting configuration : 'armeabi-v7a,x86' in ndk abiFilters cannot be present when splits abi filters are set : x86,armeabi-v7a,arm64-v8a

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 7s
Command ./gradlew failed with exit code 1
docs

Most helpful comment

I'm getting the following error:
A problem occurred evaluating project :app.
Cannot invoke method clear() on null object

All 10 comments

I can confirm that it does not work anymore with latest cli. You can't have split with abiFilters.
For now i had to disable split. I hope this gets fixed soon.
Thanks

@farfromrefug
There isn't a problem with abi splits. Please enable it at app/App_Resources/Android/app.gradle with following code:

android {
....
  ndk {
    abiFilters.clear()
  }
  splits {
    abi {
      enable true //enables the ABIs split mechanism
      reset() //reset the list of ABIs to be included to an empty string
      include 'arm64-v8a', 'armeabi-v7a', 'x86'
      universalApk true
    }
  }
....

@miroslavaivanova it fails to build if use the "ndk" section. Seems like it does not know it.
Any idea?

@miroslavaivanova still having the issue. gradle does not recognise ndk

@farfromrefug, @miroslavaivanova

Contrary to what the {N} documentation shows, the ndk section should be nested inside the defaultConfig section and not inside android:

android {
  defaultConfig {
    generatedDensities = []
    applicationId = "org.nativescript.testapp"

    ndk {
      abiFilters.clear()
    }
  }

  splits {
    abi {
      enable true //enables the ABIs split mechanism
      reset() //reset the list of ABIs to be included to an empty string
      include 'arm64-v8a', 'armeabi-v7a', 'x86'
      universalApk true
    }
  }
}

We will update the documentation to make it more clear.

@darind amazing I can confirm that it works!
Thanks

I'm getting the following error:
A problem occurred evaluating project :app.
Cannot invoke method clear() on null object

I'm getting the following error:
A problem occurred evaluating project :app.
Cannot invoke method clear() on null object

I got same problem

@KunNiu try this

        ndk {
            abiFilters "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
            abiFilters.clear()
        }

Same problem. But neither the path "app_resources", not the file "app.grade" are existing in my project folder structure...

Was this page helpful?
0 / 5 - 0 ratings