Cartotype and Genymotion - android

I am developing an offline routing app in a team with Cartotype.
We’ve implemented the MapView successfully, and it is working when we test it on a real Android device.
But when i use the Genymotion Emu for testing it, the activity is crashing when called with the following error message in the log cat.
05-25 16:37:19.468: E/AndroidRuntime(1050): FATAL EXCEPTION: main
05-25 16:37:19.468: E/AndroidRuntime(1050): java.lang.ExceptionInInitializerError
05-25 16:37:19.468: E/AndroidRuntime(1050): at de.hshn.tourwest.classes.CMapView.init(CMapView.java:109)
05-25 16:37:19.468: E/AndroidRuntime(1050): at de.hshn.tourwest.classes.CMapView.onDraw(CMapView.java:245)
05-25 16:37:19.468: E/AndroidRuntime(1050): at android.view.View.draw(View.java:13458)
05-25 16:37:19.468: E/AndroidRuntime(1050): at android.view.View.getDisplayList(View.java:12409)
05-25 16:37:19.468: E/AndroidRuntime(1050): at android.view.View.getDisplayList(View.java:12453)
05-25 16:37:19.468: E/AndroidRuntime(1050): at android.view.View.draw(View.java:13182)
05-25 16:37:19.468: E/AndroidRuntime(1050): at android.view.ViewGroup.drawChild(ViewGroup.java:2929)
05-25 16:37:19.468: E/AndroidRuntime(1050): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2799)
05-25 16:37:19.468: E/AndroidRuntime(1050): at android.view.View.getDisplayList(View.java:12407)
05-25 16:37:19.468: E/AndroidRuntime(1050): at android.view.View.getDisplayList(View.java:12453)
05-25 16:37:19.468: E/AndroidRuntime(1050): at android.view.View.draw(View.java:13182)
05-25 16:37:19.468: E/AndroidRuntime(1050): at android.view.ViewGroup.drawChild(ViewGroup.java:2929)
05-25 16:37:19.468: E/AndroidRuntime(1050): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2799)
05-25 16:37:19.468: E/AndroidRuntime(1050): at android.view.View.getDisplayList(View.java:12407)
05-25 16:37:19.468: E/AndroidRuntime(1050): at android.view.View.getDisplayList(View.java:12453)
05-25 16:37:19.468: E/AndroidRuntime(1050): at android.view.View.draw(View.java:13182)
05-25 16:37:19.468: E/AndroidRuntime(1050): at android.view.ViewGroup.drawChild(ViewGroup.java:2929)
05-25 16:37:19.468: E/AndroidRuntime(1050): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2799)
05-25 16:37:19.468: E/AndroidRuntime(1050): at android.view.View.draw(View.java:13461)
05-25 16:37:19.468: E/AndroidRuntime(1050): at android.widget.FrameLayout.draw(FrameLayout.java:467)
05-25 16:37:19.468: E/AndroidRuntime(1050): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2183)
05-25 16:37:19.468: E/AndroidRuntime(1050): at android.view.View.getDisplayList(View.java:12409)
05-25 16:37:19.468: E/AndroidRuntime(1050): at android.view.View.getDisplayList(View.java:12453)
05-25 16:37:19.468: E/AndroidRuntime(1050): at android.view.HardwareRenderer$GlRenderer.draw(HardwareRenderer.java:1144)
05-25 16:37:19.468: E/AndroidRuntime(1050): at android.view.ViewRootImpl.draw(ViewRootImpl.java:2147)
05-25 16:37:19.468: E/AndroidRuntime(1050): at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2019)
05-25 16:37:19.468: E/AndroidRuntime(1050): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1830)
05-25 16:37:19.468: E/AndroidRuntime(1050): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:998)
05-25 16:37:19.468: E/AndroidRuntime(1050): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4212)
05-25 16:37:19.468: E/AndroidRuntime(1050): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
05-25 16:37:19.468: E/AndroidRuntime(1050): at android.view.Choreographer.doCallbacks(Choreographer.java:555)
05-25 16:37:19.468: E/AndroidRuntime(1050): at android.view.Choreographer.doFrame(Choreographer.java:525)
05-25 16:37:19.468: E/AndroidRuntime(1050): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
05-25 16:37:19.468: E/AndroidRuntime(1050): at android.os.Handler.handleCallback(Handler.java:615)
05-25 16:37:19.468: E/AndroidRuntime(1050): at android.os.Handler.dispatchMessage(Handler.java:92)
05-25 16:37:19.468: E/AndroidRuntime(1050): at android.os.Looper.loop(Looper.java:137)
05-25 16:37:19.468: E/AndroidRuntime(1050): at android.app.ActivityThread.main(ActivityThread.java:4745)
05-25 16:37:19.468: E/AndroidRuntime(1050): at java.lang.reflect.Method.invokeNative(Native Method)
05-25 16:37:19.468: E/AndroidRuntime(1050): at java.lang.reflect.Method.invoke(Method.java:511)
05-25 16:37:19.468: E/AndroidRuntime(1050): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
05-25 16:37:19.468: E/AndroidRuntime(1050): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
05-25 16:37:19.468: E/AndroidRuntime(1050): at dalvik.system.NativeStart.main(Native Method)
05-25 16:37:19.468: E/AndroidRuntime(1050): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load cartotype: findLibrary returned null
05-25 16:37:19.468: E/AndroidRuntime(1050): at java.lang.Runtime.loadLibrary(Runtime.java:365)
05-25 16:37:19.468: E/AndroidRuntime(1050): at java.lang.System.loadLibrary(System.java:535)
05-25 16:37:19.468: E/AndroidRuntime(1050): at com.cartotype.Framework.<clinit>(Framework.java:944)
05-25 16:37:19.468: E/AndroidRuntime(1050): ... 42 more
i have no android device around me, so that i need to use an emulator.
The libs are correct added:
<project>\libs\cartotype.jar
<project>\libs\armeabi\libcartotype.so

Genymotion runs on x86 architecture.
When the loadLibrary method is executed, the Runtime will try to find the library (.so) inside the folder app_data/libs/x86/
To run your app on this emulator Cartotype needs to support it.
When a library supports x86, the libs directory should look like:
<project>\libs\myLib.jar
<project>\libs\armeabi\myLib.so
<project>\libs\x86\myLib.so
It seems Cartotype does not support x86. So, you should ask to Cartotype to support this architecture as a growing number of devices are using x86 CPUs, including Genymotion.
Or you can try to find another offline maps library that supports x86.

Instead of using Genymotion, use the standard Android emulator in the SDK. Because that emulates an ARM CPU, rather than trying to run x86 code directly, it should cope with your library only being provided in ARM form.
Yes, I know this will be slower, but slower is better than not working at all in this case.

Related

Couldn't find libtensorflow_demo.so while importing Tensorflow example on Android

I am importing Tensorflow example to run it in Android 5 simulator on Windows, but I am getting this error. Do you know why that happens?
05-25 17:14:31.340: E/AndroidRuntime(1189): FATAL EXCEPTION: main
05-25 17:14:31.340: E/AndroidRuntime(1189): Process:
org.tensorflow.demo, PID: 1189 05-25 17:14:31.340:
E/AndroidRuntime(1189): java.lang.UnsatisfiedLinkError:
dalvik.system.PathClassLoader[DexPathList[[zip file
"/data/app/org.tensorflow.demo-2/base.apk"],nativeLibraryDirectories=[/vendor/lib,
/system/lib]]] couldn't find "libtensorflow_demo.so" 05-25
17:14:31.340: E/AndroidRuntime(1189): at
java.lang.Runtime.loadLibrary(Runtime.java:366) 05-25 17:14:31.340:
E/AndroidRuntime(1189): at
java.lang.System.loadLibrary(System.java:989) 05-25 17:14:31.340:
E/AndroidRuntime(1189): at
org.tensorflow.demo.TensorflowClassifier.(TensorflowClassifier.java:47)
05-25 17:14:31.340: E/AndroidRuntime(1189): at
org.tensorflow.demo.TensorflowImageListener.(TensorflowImageListener.java:55)
05-25 17:14:31.340: E/AndroidRuntime(1189): at
org.tensorflow.demo.CameraConnectionFragment.(CameraConnectionFragment.java:452)
05-25 17:14:31.340: E/AndroidRuntime(1189): at
org.tensorflow.demo.CameraConnectionFragment.newInstance(CameraConnectionFragment.java:271)
05-25 17:14:31.340: E/AndroidRuntime(1189): at
org.tensorflow.demo.CameraActivity.onCreate(CameraActivity.java:33)
05-25 17:14:31.340: E/AndroidRuntime(1189): at
android.app.Activity.performCreate(Activity.java:5937) 05-25
17:14:31.340: E/AndroidRuntime(1189): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
Below my AVD settings --

Genymotion Crash after a few minutes

I have built a demo application which works perfectly, and looks like the following:
Then after a few runs, Genymotion suddenly stops working, and a screen like the following appears:
.
The Logcat keeps recording the following lines:
05-25 13:58:24.326: E/eglCodecCommon(2163): writeFully: failed: Broken pipe
05-25 13:58:24.418: E/EGL_genymotion(2163): tid 2163: eglChooseConfig(544): error 0x3001 (EGL_NOT_INITIALIZED)
05-25 13:58:24.422: E/AndroidRuntime(2163): FATAL EXCEPTION: main
05-25 13:58:24.422: E/AndroidRuntime(2163): Process: com.nextgenintl.aimassistant, PID: 2163
05-25 13:58:24.422: E/AndroidRuntime(2163): java.lang.IllegalArgumentException: eglChooseConfig failed EGL_NOT_INITIALIZED
05-25 13:58:24.422: E/AndroidRuntime(2163): at android.view.HardwareRenderer$GlRenderer.chooseEglConfig(HardwareRenderer.java:1173)
05-25 13:58:24.422: E/AndroidRuntime(2163): at android.view.HardwareRenderer$GlRenderer.loadEglConfig(HardwareRenderer.java:1135)
05-25 13:58:24.422: E/AndroidRuntime(2163): at android.view.HardwareRenderer$GlRenderer.initializeEgl(HardwareRenderer.java:1117)
05-25 13:58:24.422: E/AndroidRuntime(2163): at android.view.HardwareRenderer$GlRenderer.initialize(HardwareRenderer.java:1057)
05-25 13:58:24.422: E/AndroidRuntime(2163): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1550)
05-25 13:58:24.422: E/AndroidRuntime(2163): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1000)
05-25 13:58:24.422: E/AndroidRuntime(2163): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5670)
05-25 13:58:24.422: E/AndroidRuntime(2163): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
05-25 13:58:24.422: E/AndroidRuntime(2163): at android.view.Choreographer.doCallbacks(Choreographer.java:574)
05-25 13:58:24.422: E/AndroidRuntime(2163): at android.view.Choreographer.doFrame(Choreographer.java:544)
05-25 13:58:24.422: E/AndroidRuntime(2163): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
05-25 13:58:24.422: E/AndroidRuntime(2163): at android.os.Handler.handleCallback(Handler.java:733)
05-25 13:58:24.422: E/AndroidRuntime(2163): at android.os.Handler.dispatchMessage(Handler.java:95)
05-25 13:58:24.422: E/AndroidRuntime(2163): at android.os.Looper.loop(Looper.java:136)
05-25 13:58:24.422: E/AndroidRuntime(2163): at android.app.ActivityThread.main(ActivityThread.java:5017)
05-25 13:58:24.422: E/AndroidRuntime(2163): at java.lang.reflect.Method.invokeNative(Native Method)
05-25 13:58:24.422: E/AndroidRuntime(2163): at java.lang.reflect.Method.invoke(Method.java:515)
05-25 13:58:24.422: E/AndroidRuntime(2163): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
05-25 13:58:24.422: E/AndroidRuntime(2163): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
05-25 13:58:24.422: E/AndroidRuntime(2163): at dalvik.system.NativeStart.main(Native Method)
If I shut down Genymotion and relaunch it, it works fine again.
What is the cause of this problem, and is anyone experiencing it too?
It's not really caused by your application, so don't worry.
It often happens when you computer goes in sleep mode and when you come back Genymotion will throw this exception (it happens to me very often).
In your specific case sounds like the device goes in sleep mode so a way to fix it is simply to enable "Always stay awake" in developers options.
Another way to fix it is just to turn off your emulator and relaunch. (as you already do)
The broken pipe error means there is a problem with the connection between emulator and host computer.
To fix it you can restart the emulator (or follow the advice from the other answer).
I had the same problem and fixed it choosing the same resolution of my virtual device. It says "Custom Tablet - 6.0.0 - API 23 - 2560x1600" and the resolution was lower than this. When I put the same, the device doesn't crash anymore

Exception with Android WebView

I have this exception:
java.lang.NullPointerException
at android.webkit.WebViewClassic.requestFocus(WebViewClassic.java:10003)
at android.webkit.WebView.requestFocus(WebView.java:2133)
at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2382)
at android.view.ViewGroup.requestFocus(ViewGroup.java:2338)
at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2382)
at android.view.ViewGroup.requestFocus(ViewGroup.java:2338)
at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2382)
at android.view.ViewGroup.requestFocus(ViewGroup.java:2341)
at android.view.View.requestFocus(View.java:6538)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1899)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1110)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4472)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
at android.view.Choreographer.doCallbacks(Choreographer.java:555)
at android.view.Choreographer.doFrame(Choreographer.java:525)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4918)
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:1004)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:771)
at dalvik.system.NativeStart.main(Native Method)
But it doesn't tell me what line it happened on or anything else. Any idea how to debug this?
Thanks,
Alex

Application Force Close after update sdk

I have updated my android sdk from r21 to r22. I also updated the adt. Before the updates, my application work perfectly without error and force close. But now, all of my apps are force close when run via avd or real phone. I don't know the problem, but, it seems that the compiler didn't found my MainActivity class. I have already checked it many times, and I'm sure that my MainActivity doesn't have any error and compile properly.
Here's the logcat error:
05-25 01:11:02.931: E/AndroidRuntime(7724): FATAL EXCEPTION: main
05-25 01:11:02.931: E/AndroidRuntime(7724): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{ca.slim.social/ca.slim.social.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "ca.slim.social.MainActivity" on path: /data/app/ca.slim.social-2.apk
05-25 01:11:02.931: E/AndroidRuntime(7724): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2223)
05-25 01:11:02.931: E/AndroidRuntime(7724): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2357)
05-25 01:11:02.931: E/AndroidRuntime(7724): at android.app.ActivityThread.access$600(ActivityThread.java:153)
05-25 01:11:02.931: E/AndroidRuntime(7724): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1247)
05-25 01:11:02.931: E/AndroidRuntime(7724): at android.os.Handler.dispatchMessage(Handler.java:99)
05-25 01:11:02.931: E/AndroidRuntime(7724): at android.os.Looper.loop(Looper.java:137)
05-25 01:11:02.931: E/AndroidRuntime(7724): at android.app.ActivityThread.main(ActivityThread.java:5224)
05-25 01:11:02.931: E/AndroidRuntime(7724): at java.lang.reflect.Method.invokeNative(Native Method)
05-25 01:11:02.931: E/AndroidRuntime(7724): at java.lang.reflect.Method.invoke(Method.java:511)
05-25 01:11:02.931: E/AndroidRuntime(7724): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
05-25 01:11:02.931: E/AndroidRuntime(7724): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:561)
05-25 01:11:02.931: E/AndroidRuntime(7724): at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:106)
05-25 01:11:02.931: E/AndroidRuntime(7724): at dalvik.system.NativeStart.main(Native Method)
[tpb]05-25 01:11:02.931: E/AndroidRuntime(7724): Caused by: java.lang.ClassNotFoundException: Didn't find class "ca.slim.social.MainActivity" on path: /data/app/ca.slim.social-2.apk[/tpb]
05-25 01:11:02.931: E/AndroidRuntime(7724): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
05-25 01:11:02.931: E/AndroidRuntime(7724): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
05-25 01:11:02.931: E/AndroidRuntime(7724): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
05-25 01:11:02.931: E/AndroidRuntime(7724): at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
05-25 01:11:02.931: E/AndroidRuntime(7724): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2214)
05-25 01:11:02.931: E/AndroidRuntime(7724): ... 12 more
NB: I'm using actionbarsherlock, slidingmenu, and viewpagerindicator.
Thank You
Lots of people are having this issue!
Try these solutions:
ClassNotFoundException after ADT update
Try going to Project -> Properties -> Java Build Path -> Order & Export and ensure Android Private Libraries are checked for your project and for all other library projects you are using. Clean all projects afterwards and see what happens.
Eclipse giving error, missing R.java file after recent update
After updating to SDK Tools to rev. 22 for the first time, you may need to relaunch Android SDK Manager again and install a new item: Android SDK Build-tools.
Which version of java you are using? Try to update your JDK to 1.7 and let us know if that helps. You could also try the suggestions in this link to help troubleshoot your problem.

Android FC report: interface not implemented

Just received the below crash report on the Android dev console, however it doesn't hit my code and reports doesn't show Android version:
Checked source code for 4.1.x and 4.0.x, line 345 is this and length() is defined in an interface:
return getText().length();
How could this actually be missing? I'm assuming I've used a setText() on something and it's not ok, but do I investigate, while I've no clue where it's actually happening!?
java.lang.IncompatibleClassChangeError: interface not implemented
at android.text.BoringLayout.getLineStart(BoringLayout.java:345)
at android.text.Layout.drawText(Layout.java:229)
at android.text.Layout.draw(Layout.java:205)
at android.text.BoringLayout.draw(BoringLayout.java:400)
at android.widget.TextView.onDraw(TextView.java:4886)
at android.view.View.draw(View.java:13470)
at android.view.View.draw(View.java:13354)
at android.view.ViewGroup.drawChild(ViewGroup.java:2929)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2799)
at android.view.View.draw(View.java:13352)
at android.view.ViewGroup.drawChild(ViewGroup.java:2929)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2799)
at android.view.View.draw(View.java:13352)
at android.view.ViewGroup.drawChild(ViewGroup.java:2929)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2799)
at android.view.View.draw(View.java:13575)
at android.widget.FrameLayout.draw(FrameLayout.java:467)
at android.widget.ScrollView.draw(ScrollView.java:1569)
at android.view.View.draw(View.java:13354)
at android.view.ViewGroup.drawChild(ViewGroup.java:2929)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2799)
at android.view.View.draw(View.java:13352)
at android.view.ViewGroup.drawChild(ViewGroup.java:2929)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2799)
at android.view.View.draw(View.java:13352)
at android.view.ViewGroup.drawChild(ViewGroup.java:2929)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2799)
at android.view.View.draw(View.java:13352)
at android.view.ViewGroup.drawChild(ViewGroup.java:2929)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2799)
at android.view.View.draw(View.java:13473)
at android.widget.FrameLayout.draw(FrameLayout.java:467)
at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2185)
at android.view.ViewRootImpl.drawSoftware(ViewRootImpl.java:2258)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:2153)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2021)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1832)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1000)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4214)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
at android.view.Choreographer.doCallbacks(Choreographer.java:555)
at android.view.Choreographer.doFrame(Choreographer.java:525)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4899)
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:791)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:558)
at dalvik.system.NativeStart.main(Native Method)
This could possibly be due to change in library that android.text.BoringLayout is a part of. May be the interfaces that class implements have changed it's method signature or have added new methods or have changed it's accessibility rights (public protected private).
The devices this might be happening on may be hosting custom roms developed by independent users with different definitions given to one of the interfaces implemented by BinaryLayout or one of it's superclasses.
A backward binary compatibility case

Categories

Resources