gradle - Include .so library in apk in android studio -


this question has answer here:

i trying hands on developing simple android application in trying use sqlcipher, uses .so libraries internally. have read documentation on how use sqlcipher android app. have followed steps , compiles without error. but, @ runtime throws unsatisfiedlinkerror.

googling around it, found that, gradle doesn't support .so libraries yet, found hack here trying use. throws compile time error @ line #40 on gist is,

tasks.withtype(com.android.build.gradle.packageapplicationtask) { pkgtask ->     pkgtask.jnidir new file(builddir, 'native-libs') } 

saying

could not find property 'com' on project 'myproject'

here posting code build.gradle file.

buildscript {     repositories {         maven { url 'http://repo1.maven.org/maven2' }     }     dependencies {         classpath 'com.android.tools.build:gradle:0.4'     } } apply plugin: 'android'  dependencies {     compile files('libs/android-support-v4.jar')     compile files('libs/commons-codec.jar')     compile files('libs/guava-r09.jar')     compile files('libs/sqlcipher.jar') }  targetcompatibility = 1.6 sourcecompatibility = 1.6  android {     target = 'android-14'      compilesdkversion 17     buildtoolsversion "17.0.0"      defaultconfig {         minsdkversion 9         targetsdkversion 16     }      }  task copynativelibs(type: copy) {     from(new file(project(':myproject').builddir, 'native-libs')) { include '**/*.so' }     new file(builddir, 'native-libs') }  tasks.withtype(compile) { compiletask -> compiletask.dependson copynativelibs }  clean.dependson 'cleancopynativelibs'  tasks.withtype(com.android.build.gradle.packageapplicationtask) { pkgtask ->     pkgtask.jnidir new file(builddir, 'native-libs') } 

can, please me on have done wrong or should include .so libraries in apk?

as new android development , gradle, please apologize me if have misunderstood something.

i had same problem. check out comment in https://gist.github.com/khernyo/4226923#comment-812526

it says:

for gradle android plugin v0.3 use "com.android.build.gradle.tasks.packageapplication"

that should fix problem.


Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -