Application crashes when using tesseract OCR Engine sample project for ANDROID - android

Hi am running Android tesseract sample project by adding tess-two as library project as prerequisite for this project
also i put google translator api key and bing translator api key in this project
but when am going to run this project it shows me following error in logcat
can you please help me to out from this situation
thanks in advance
FATAL EXCEPTION: main
E/AndroidRuntime(20521): java.lang.ExceptionInInitializerError
E/AndroidRuntime(20521): at edu.sfsu.cs.orange.ocr.CaptureActivity.initOcrEngine(CaptureActivity.java:711)
E/AndroidRuntime(20521): at edu.sfsu.cs.orange.ocr.CaptureActivity.onResume(CaptureActivity.java:368)
E/AndroidRuntime(20521): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1153)
E/AndroidRuntime(20521): at android.app.Activity.performResume(Activity.java:3858)
E/AndroidRuntime(20521): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2122)
E/AndroidRuntime(20521): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2147)
E/AndroidRuntime(20521): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1680)
E/AndroidRuntime(20521): at android.app.ActivityThread.access$1500(ActivityThread.java:121)
E/AndroidRuntime(20521): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:943)
E/AndroidRuntime(20521): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(20521): at android.os.Looper.loop(Looper.java:130)
E/AndroidRuntime(20521): at android.app.ActivityThread.main(ActivityThread.java:3770)
E/AndroidRuntime(20521): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(20521): at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime(20521): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:912)
E/AndroidRuntime(20521): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:670)
E/AndroidRuntime(20521): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(20521): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load lept: findLibrary returned null
E/AndroidRuntime(20521): at java.lang.Runtime.loadLibrary(Runtime.java:429)
E/AndroidRuntime(20521): at java.lang.System.loadLibrary(System.java:554)
E/AndroidRuntime(20521): at com.googlecode.tesseract.android.TessBaseAPI.<clinit>(TessBaseAPI.java:44)
E/AndroidRuntime(20521): ... 17 more

Your problem is with:
Caused by: java.lang.UnsatisfiedLinkError: Couldn't load lept: findLibrary returned null
You need to include the 'lept' jar and native c++ files in your project and reference them in your build path.
Also, take a look at best OCR (Optical character recognition) example in android

Related

FFmpegMediaPlayer: findLibrary returned null

I use https://github.com/wseemann/FFmpegMediaPlayer in my application, but some Android device throw exception:
java.lang.ExceptionInInitializerError
at ru.mypackage.PlayService.initPlayer(PlayService.java:74)
at ru.mypackage.PlayService.onCreate(PlayService.java:68)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:1949)
at android.app.ActivityThread.access$2500(ActivityThread.java:117)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:989)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3687)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.UnsatisfiedLinkError: Couldn't load avutil: findLibrary returned null
at java.lang.Runtime.loadLibrary(Runtime.java:429)
at java.lang.System.loadLibrary(System.java:554)
at wseemann.media.FFmpegMediaPlayer.<clinit>(FFmpegMediaPlayer.java:620)
... 13 more
My project:
Can somebody explain me what's wrong there?
On my device and some other device the app working nice, but on some device (for example: Galaxy Ace (GT-S5830i) Android 2.3.3 - 2.3.7) it throw the exception.
p.s. about "lib" prefix I understood ( https://developer.android.com/reference/java/lang/System.html#mapLibraryName(java.lang.String) )
You have to place the armeabi file under jnilibs folder (you will have to create it) in app/src/main/.
Hope it helps.

Android Studio seems to build old version of project

I am wondering if this is some bug in Android Studio or I am simply lack od knowladge but straight to the point.
I am writing simple client-server via bluetooth app on android. At some point I encoured following problem:
07-11 18:59:20.553 10364-10364/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.IllegalStateException: Could not find a method parujUrzadzenia(View) in the activity class com.example.pc.klient_serwerbluetooth.Klient for onClick handler on view class android.widget.Button with id 'button6'
at android.view.View$1.onClick(View.java:3775)
at android.view.View.performClick(View.java:4421)
at android.view.View$PerformClick.run(View.java:18190)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:175)
at android.app.ActivityThread.main(ActivityThread.java:5279)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NoSuchMethodException: parujUrzadzenia [class android.view.View]
at java.lang.Class.getConstructorOrMethod(Class.java:460)
at java.lang.Class.getMethod(Class.java:915)
at android.view.View$1.onClick(View.java:3768)
at android.view.View.performClick(View.java:4421)
at android.view.View$PerformClick.run(View.java:18190)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:175)
at android.app.ActivityThread.main(ActivityThread.java:5279)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(Native Method)
07-11 19:34:00.498 449-522/? E/ActivityManager﹕ The package com.example.pc.klient_serwerbluetooth is not found. Failure starting process com.example.pc.klient_serwerbluetooth
For what I understand Android Studio can't find method parujUrzadzenia(View) that is marked in button6's properties as onClick method...the funny thing is i deleted this button in my way of solving this problem.
I can't post picture of my project due to low reputation but like I said. I've deleted the reference to method from .xml and method from .java file and got an error saying that there is no required onClick method. So I deleted this whole button and still got this error.
Any advices will be greatly appreciated.

Vuforia jPCT integration and build jni

I getting following error while running imagetarge vuforia jPCT project
W/dalvikvm(3469): threadid=1: thread exiting with uncaught exception (group=0xa4c4e648)
E/AndroidRuntime(3469): FATAL EXCEPTION: main
E/AndroidRuntime(3469): java.lang.UnsatisfiedLinkError: Native method not found: com.qualcomm.ar.pl.CameraPreview.newFrameAvailable:(IIII[B)V
E/AndroidRuntime(3469): at com.qualcomm.ar.pl.CameraPreview.newFrameAvailable(Native Method)
E/AndroidRuntime(3469): at com.qualcomm.ar.pl.CameraPreview.onPreviewFrame(CameraPreview.java:805)
E/AndroidRuntime(3469): at android.hardware.Camera$EventHandler.handleMessage(Camera.java:791)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(3469): at android.app.ActivityThread.main(ActivityThread.java:5103)
E/AndroidRuntime(3469): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(3469): at java.lang.reflect.Method.invoke(Method.java:525)
E/AndroidRuntime(3469): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
E/AndroidRuntime(3469): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
E/AndroidRuntime(3469): at dalvik.system.NativeStart.main(Native Method)
I read all vuforia blog and google search but not able to solve problem
Please help me...
Used latest vaforia.jar to solve problem
Download latest sdk from https://developer.vuforia.com/resources/sdk/android

NDK App Crashing After Uploading on Play Store

I uploaded an app to the playstore. The app contains native C code. I compiled it successfully using NDK, created the signed apk. I also installed the signed apk and checked. Everything worked fine.
After uploading it I downloaded it from playstore and it crashed.
Following is the stack trace:
java.lang.ExceptionInInitializerError
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1319)
at android.app.Instrumentation.newActivity(Instrumentation.java:1057)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2015)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
at android.app.ActivityThread.access$600(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4898)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.UnsatisfiedLinkError: Couldn't load hello-jni: findLibrary returned null
at java.lang.Runtime.loadLibrary(Runtime.java:365)
at java.lang.System.loadLibrary(System.java:535)
at com.somepackage.anotherpackage.SomeActivity.<clinit>(SomeActivity.java:56)
... 15 more
The error states that System.loadLibrary returned null. But the same code when run using eclipse works fine.
Thanks for any help
Seems like your apk is missing libhello-jni.so. Maybe it was not packaged during apk build.
If you open your apk with a zip software, you should have a folder libs containing libhello-jni.so : if you don't have it, then you forgot something at build time.

How to upload file on google drive using my android application

I start with google drive sdk. I follows steps which describe in that post.
But I face problem in Step 3: Create and Configure an Android Project
I cant find options in my eclipse so I add plugins for google. After installation of plugins, Eclipse give errors and we now update my SDK also. So for that I update my SDK but now All projects giving me error in eclipse. I cant run any projects. So I use my old SDK back.
Now I stuck with this How to create Project for Google Drive and how to integrate it.
I need to upload file from my android application to Google Drive.
Please help me to find this.
EDIT
Now I successfully create project with error free. But when I run project it give me following errors.
12-12 11:05:08.788: E/AndroidRuntime(377): java.lang.NoClassDefFoundError: com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential
12-12 11:05:08.788: E/AndroidRuntime(377): at com.rarenoice.screen.MainActivity.onCreate(MainActivity.java:42)
12-12 11:05:08.788: E/AndroidRuntime(377): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
12-12 11:05:08.788: E/AndroidRuntime(377): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
12-12 11:05:08.788: E/AndroidRuntime(377): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
12-12 11:05:08.788: E/AndroidRuntime(377): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
12-12 11:05:08.788: E/AndroidRuntime(377): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
12-12 11:05:08.788: E/AndroidRuntime(377): at android.os.Handler.dispatchMessage(Handler.java:99)
12-12 11:05:08.788: E/AndroidRuntime(377): at android.os.Looper.loop(Looper.java:123)
12-12 11:05:08.788: E/AndroidRuntime(377): at android.app.ActivityThread.main(ActivityThread.java:4627)
12-12 11:05:08.788: E/AndroidRuntime(377): at java.lang.reflect.Method.invokeNative(Native Method)
12-12 11:05:08.788: E/AndroidRuntime(377): at java.lang.reflect.Method.invoke(Method.java:521)
12-12 11:05:08.788: E/AndroidRuntime(377): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
12-12 11:05:08.788: E/AndroidRuntime(377): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
12-12 11:05:08.788: E/AndroidRuntime(377): at dalvik.system.NativeStart.main(Native Method)
At Following line :-
private GoogleAccountCredential credential;
credential = GoogleAccountCredential.usingOAuth2(MainActivity.this,
DriveScopes.DRIVE);
You need to add the Google Play Services jars to your project, as explained in Step 3 of the quickstart guide you are following.
You can also watch this video where I go through all the steps to build the same quickstart application for Android: http://www.youtube.com/watch?v=Ied1CjJ0iP0

Categories

Resources