Problems building Android Library with native code -


i trying build android library project native code. per "known limitations" section under http://tools.android.com/tech-docs/new-build-system/gradle-experimental hybrid library projects supported. don't seem see native files being generated under libs folder of library aar file.

here how project setup looks like

  1. followed steps in http://tools.android.com/tech-docs/new-build-system/gradle-experimental ndk support
  2. added library modules statically loads native file , exposes capabilities via methods
  3. added module uses native module. set module dependencies include library project.

when run app unsatisfiedlinkerror, expected see no native files being generated in aar file.

this how library build.gradle file looks like

apply plugin: 'com.android.model.library'  model {      android {          compilesdkversion = 23          buildtoolsversion = "23.0.1"      }      android.ndk {          modulename = "native"          cppflags = ['-std=c++11']          stl = "gnustl_shared"      } } 

this how app module's build.gradle looks like

apply plugin: 'com.android.model.application' model {     android {         compilesdkversion = 23         buildtoolsversion = "23.0.1"     } } dependencies {     compile project(':mylibrary') } 

this common problem in gradle experimental 0.2.0 , 0.2.1. had same problem, upgraded 0.3.0-alpha4 , worked (just replace 0.2.0 0.3.0-alpha4 in project's build.gradle). upgrade need gradle 2.6 (right click on module/open module settings/ select project submenu/ set gradle version field 2.6). note using android studio 1.4 rc3.


Comments