sh1r0 / caffe-android-demo

An android caffe demo app exploiting caffe pre-trained ImageNet model for image classification
https://github.com/sh1r0/caffe-android-lib
MIT License
255 stars 164 forks source link

Can't run demo project #60

Closed kirilamenski closed 6 years ago

kirilamenski commented 7 years ago

Greatings! I am getting following exception when I try to run demo project on android:

FATAL EXCEPTION: main
Process: com.sh1r0.caffe_android_demo, PID: 4572
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.sh1r0.caffe_android_demo-1/base.apk", 
zip file "/data/app/com.sh1r0.caffe_android_demo-1/split_lib_slice_0_apk.apk", 
zip file "/data/app/com.sh1r0.caffe_android_demo-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.sh1r0.caffe_android_demo-1/split_lib_slice_2_apk.apk", 
zip file "/data/app/com.sh1r0.caffe_android_demo-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.sh1r0.caffe_android_demo-1/split_lib_slice_4_apk.apk", 
zip file "/data/app/com.sh1r0.caffe_android_demo-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.sh1r0.caffe_android_demo-1/split_lib_slice_6_apk.apk", 
zip file "/data/app/com.sh1r0.caffe_android_demo-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.sh1r0.caffe_android_demo-1/split_lib_slice_8_apk.apk", 
zip file "/data/app/com.sh1r0.caffe_android_demo-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.sh1r0.caffe_android_demo-1/lib/x86, 
/vendor/lib, /system/lib]]] couldn't find "libcaffe.so"
                       at java.lang.Runtime.loadLibrary(Runtime.java:367)
                       at java.lang.System.loadLibrary(System.java:1076)
                       at com.sh1r0.caffe_android_demo.MainActivity.<clinit>(MainActivity.java:57)
                       at java.lang.Class.newInstance(Native Method)
                       at android.app.Instrumentation.newActivity(Instrumentation.java:1067)
                       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2317)
                       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
                       at android.app.ActivityThread.-wrap11(ActivityThread.java)
                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
                       at android.os.Handler.dispatchMessage(Handler.java:102)
                       at android.os.Looper.loop(Looper.java:148)
                       at android.app.ActivityThread.main(ActivityThread.java:5417)
                       at java.lang.reflect.Method.invoke(Native Method)
                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

I was builded project as as described here and already checked all similar issues but not successfully. I was running app on lollipop 5.1 API 21 and marshmallow 6.0 API 23 also I tried to push manually that file and added into app/build.gradle this:

splits {
        abi {
            enable true
            reset()
            include 'x86', 'armeabi-v7a'
            universalApk true
        }
    }

But still got error. Os - Parrot Os(based on debian); Cmake version 3.7.2

Also I would like to know how exactly I can build for older devices with API below 23 ?

Regards!

sh1r0 commented 7 years ago

What's your target abi?

kirilamenski commented 7 years ago

@sh1r0 armeabi-v7a

sh1r0 commented 7 years ago

Have you build caffe-android-lib with ANDROID_ABI="armeabi-v7a-hard-softfp with NEON"? Currently, only libs for abi x86_64 and arm64-v8a are pre-built and included in this project.

kirilamenski commented 7 years ago

@sh1r0 Sorry for a silly question, how exactly I can do this? I tried to create Application.mk in the folder app/src/main/jni with APP_ABI := armeabi armeabi-v7a x86 x86_64 mips but still get an error

sh1r0 commented 7 years ago

@KirilaMenski caffe-android-lib is not integrated in this demo project, please refer to https://github.com/sh1r0/caffe-android-lib#build for building instructions.

kirilamenski commented 7 years ago

@sh1r0 I was alreaddy installed it but still not working. Anyway thanks for the help

sh1r0 commented 7 years ago

@KirilaMenski Did you get any errors when building caffe-android-lib?

kirilamenski commented 7 years ago

@sh1r0 Nope it was building perfectly

sh1r0 commented 6 years ago

Hi @KirilaMenski, please refer to the latest commit of caffe-android-lib (https://github.com/sh1r0/caffe-android-lib/commit/b9b0ba7deae5e0c298af9ffe78feec1c0567ee91), I've added docker support for building the project.

sh1r0 commented 6 years ago

Close as inactivity.