Android Studio opencv C++ compile link libraries error at runtime -


i'm using android studio 1.3.2 gradle 2.6 experimental ndk.

this error:

dlopen("/data/app/face.rt.jeanc.facert-2/lib/arm/libface.so", rtld_lazy) failed: dlopen failed: "/data/app/face.rt.jeanc.facert-2/lib/arm/libface.so" has unexpected e_machine: 40 

also, lib face should appears libface.so in folders (armabi, armabi-v7, etc) doesn't appear (compile ?)

here build.gradle:

apply plugin: 'com.android.model.application'  model {     android {         compilesdkversion = 23         buildtoolsversion = "23.0.1"          defaultconfig.with {             applicationid = "face.rt.jeanc.facert"             minsdkversion.apilevel = 19             targetsdkversion.apilevel = 19             versioncode = 1             versionname = "1.0.1"         }      }      android.buildtypes {         release {             minifyenabled = false             proguardfiles += file('proguard-rules.txt')         }     }      android.ndk { // keeping make correctly support c++ code editing , debugging         modulename = "face"         ldlibs += ['log']         cppflags += "-std=c++11"         cppflags += "-fexceptions"         cppflags += "-i${file("src/main/jni/prebuilts/include")}".tostring()         cppflags  += "-i${file("c:/android-dev/sdks/opencv-android-sdk/sdk/native/jni/include")}".tostring()         cppflags  += "-i${file("c:/android-dev/sdks/opencv-android-sdk/sdk/native/jni/include/opencv")}".tostring()         cppflags  += "-i${file("c:/android-dev/sdks/opencv-android-sdk/sdk/native/jni/include/opencv2")}".tostring()         ldlibs += ["android", "egl", "glesv2", "dl", "log", "z"]// , "ibopencv_core"          stl = "gnustl_shared" //"stlport_static"     }       android.productflavors {     // detailed abifilter descriptions, refer "supported abis" @     // https://developer.android.com/ndk/guides/abis.html#sa     create("arm") {             ndk.with {                 abifilters += "armeabi"                  file curdir = file('./')                 curdir = file(curdir.absolutepath)                 string libsdir = curdir.absolutepath+"\\src\\main\\jnilibs\\armeabi\\" //"-l" +                  ldlibs += libsdir + "libnative_camera_r4.3.0.so"                 ldlibs += libsdir + "libopencv_contrib.a"                 ldlibs += libsdir + "libopencv_core.a"                 ldlibs += libsdir + "libopencv_highgui.a"                 ldlibs += libsdir + "libopencv_imgproc.a"                 ldlibs += libsdir + "libopencv_info.so"                 ldlibs += libsdir + "libopencv_java.so"                 ldlibs += libsdir + "libopencv_legacy.a"                 ldlibs += libsdir + "libopencv_ml.a"                 ldlibs += libsdir + "libopencv_ts.a"              }         }         create("armv7") {             ndk.with {                 abifilters += "armeabi-v7a"                  file curdir = file('./')                 curdir = file(curdir.absolutepath)                 string libsdir = curdir.absolutepath+"\\src\\main\\jnilibs\\armeabi-v7a\\" //"-l" +                  ldlibs += libsdir + "libnative_camera_r4.3.0.so"                 ldlibs += libsdir + "libopencv_contrib.a"                 ldlibs += libsdir + "libopencv_core.a"                 ldlibs += libsdir + "libopencv_highgui.a"                 ldlibs += libsdir + "libopencv_imgproc.a"                 ldlibs += libsdir + "libopencv_info.so"                 ldlibs += libsdir + "libopencv_java.so"                 ldlibs += libsdir + "libopencv_legacy.a"                 ldlibs += libsdir + "libopencv_ml.a"                 ldlibs += libsdir + "libopencv_ts.a"              }         }          create("x86") {             ndk.with {                 abifilters += "x86"                  file curdir = file('./')                 curdir = file(curdir.absolutepath)                 string libsdir = curdir.absolutepath+"\\src\\main\\jnilibs\\x86\\" //"-l" +                  ldlibs += libsdir + "libnative_camera_r4.3.0.so"                 ldlibs += libsdir + "libopencv_contrib.a"                 ldlibs += libsdir + "libopencv_core.a"                 ldlibs += libsdir + "libopencv_highgui.a"                 ldlibs += libsdir + "libopencv_imgproc.a"                 ldlibs += libsdir + "libopencv_info.so"                 ldlibs += libsdir + "libopencv_java.so"                 ldlibs += libsdir + "libopencv_legacy.a"                 ldlibs += libsdir + "libopencv_ml.a"                 ldlibs += libsdir + "libopencv_ts.a"             }         }         create("mips") {             ndk.with {                 abifilters += "mips"             }         }         create("fat") {          }     } }  dependencies {     compile filetree(include: ['*.jar'], dir: 'libs')     compile 'com.android.support:appcompat-v7:23.0.1'     compile project(':opencvlibrary2411') } 

this part of code "should" load different libraries:

////// jni c++ static {system.loadlibrary("face");}  //externals c++ libraries static {system.loadlibrary("libnative_camera_r4.3.0.so");} static {system.loadlibrary("libopencv_contrib.a");} static {system.loadlibrary("libopencv_core.a");} static {system.loadlibrary("libopencv_highgui.a");} static {system.loadlibrary("libopencv_imgproc.a");} static {system.loadlibrary("libopencv_info.so");} static {system.loadlibrary("libopencv_java.so");} static {system.loadlibrary("libopencv_legacy.a");} static {system.loadlibrary("libopencv_ml.a");} static {system.loadlibrary("libopencv_ts.a");} 

i'm kinda stuck , need help.

edit: in version of android studio , experimental plugin don't have android.mk file compile jni c++. wondering if or have compile manually ?

if manually how do since don't have android.mk ?

your build succeed, don't copy shared libs opencv libs directory of app. follow advice in how use opencv in android studio using gradle build tool?

note possible combine full power of android.mk experimental plugin: see define local_src_files in ndk{} dsl.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -