OpenCV for Android: ClassNotFound Exception Class Example

I am trying to run a sample from opencv for Android. He does not work.

 java.lang.RuntimeException: Unable to instantiate activity
ComponentInfo{org.opencv.samples.puzzle15/org.opencv.samples.
puzzle15.Puzzle15Activity}: java.lang.ClassNotFoundException: Didn't find class
"org.opencv.samples.puzzle15.Puzzle15Activity" on path:
DexPathList[[zip file "/data/app/org.opencv.samples.puzzle15-
 1.apk"],nativeLibraryDirectories=
[/data/app-lib/org.opencv.samples.puzzle15-1, /vendor/lib, /system/lib]]

What does it mean and how to fix it? I would like to take concrete steps to fix this.

Full log:

     10-25 14:03:09.794: E/AndroidRuntime(958): FATAL EXCEPTION: main
     10-25 14:03:09.794: E/AndroidRuntime(958): java.lang.RuntimeException: Unable to     
     instantiate activity ComponentInfo{org.opencv.samples.puzzle15/
     org.opencv.samples.puzzle15.Puzzle15Activity}: java.lang.ClassNotFoundException:      
     Didn't find class "org.opencv.samples.puzzle15.Puzzle15Activity" on path:  
     /data/app/org.opencv.samples.puzzle15-2.apk
     10-25 14:03:09.794: E/AndroidRuntime(958):     at    
     android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
     10-25 14:03:09.794: E/AndroidRuntime(958):     at 
     android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
     10-25 14:03:09.794: E/AndroidRuntime(958):     at   
     android.app.ActivityThread.access$600(ActivityThread.java:141)
     10-25 14:03:09.794: E/AndroidRuntime(958):     at 
     android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
     10-25 14:03:09.794: E/AndroidRuntime(958):     at 
     android.os.Handler.dispatchMessage(Handler.java:99)
     10-25 14:03:09.794: E/AndroidRuntime(958):     at 
     android.os.Looper.loop(Looper.java:137)
     10-25 14:03:09.794: E/AndroidRuntime(958):     at 
     android.app.ActivityThread.main(ActivityThread.java:5041)
     10-25 14:03:09.794: E/AndroidRuntime(958):     at 
     java.lang.reflect.Method.invokeNative(Native Method)
     10-25 14:03:09.794: E/AndroidRuntime(958):     at 
     java.lang.reflect.Method.invoke(Method.java:511)
     10-25 14:03:09.794: E/AndroidRuntime(958):     at     
     com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
     10-25 14:03:09.794: E/AndroidRuntime(958):     at 
     com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
     10-25 14:03:09.794: E/AndroidRuntime(958): dalvik.system.NativeStart.main(NativeMethod)
     10-25 14:03:09.794: E/AndroidRuntime(958): Caused by: java.lang.ClassNotFoundException: 
     Didn't find class "org.opencv.samples.puzzle15.Puzzle15Activity" on path: 
    /data/app/org.opencv.samples.puzzle15-2.apk
    10-25 14:03:09.794: E/AndroidRuntime(958):  at 
    dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
    10-25 14:03:09.794: E/AndroidRuntime(958):  at 
    java.lang.ClassLoader.loadClass(ClassLoader.java:501)
    10-25 14:03:09.794: E/AndroidRuntime(958):  at 
    java.lang.ClassLoader.loadClass(ClassLoader.java:461)
    10-25 14:03:09.794: E/AndroidRuntime(958):  at 
    android.app.Instrumentation.newActivity(Instrumentation.java:1054)
    10-25 14:03:09.794: E/AndroidRuntime(958):  at 
    android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
+3
source share
1 answer

After importing from OpenCV for android and download the ADT Bundle

Instead of this:

   Warning : After the initial import, on a non-Windows (Linux and Mac OS) operating system Eclipse will still show build errors for applications with native C++ code. To resolve the issues, please do the following:
Open Project Properties -> C/C++ Build, and replace "Build command" text to "${NDKROOT}/ndk-build" (remove .cmd at the end).

try the following steps:

Download ndk build Android NDK

Indicate the location of the NDK:

Windows Preferences → →> Android → NDK → Specify the location of the NDK (which you downloaded from the link above)

Get project location:

→ > properties → resource → location

: : D:\OpenCV-2.4.6-android-sdk-r2\OpenCV-2.4.6-android-sdk\samples\15-puzzle

cmd:

D:\OpenCV-2.4.6---r2\OpenCV-2.4.6--SDK\Samples\15- > D:\Android--9\NDK-

D:\android-ndk-r9\ndk-build ( NDK)

. , OpenCV Manager

0

All Articles