Android app force closing when opening amarino connection - java

I am new to android development, and have run into a problem I seem unable to solve.
My android app should be able to communicate with my arduino device, sending info
to and retrieving info from my device. I have set up my connection between the two
with a bluetooth device and I am using amarino to facilitate the communication.
Now I can connect with amarino and send data and receive data, now I want to do this from
my app. The problem comes when I enter this line:
private static final String DEVICE_ADDRESS = "07:12:04:16:68:18";
Amarino.connect(this, DEVICE_ADDRESS);
The number is the MAC address of my bluetooth adapter connected to my arduino device.
As soon as I run my app on my phone it just force closes due to unexpected error.
Now as I said, I am a bit of a noob when it comes to android, so I installed logCat to try get some log info out of it. All I got from it was this somewhat unhelpful error message:
com.example.projectgreetv3/.StartingPlace
10-24 15:22:55.140 E/AndroidRuntime(4906): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.projectgreetv3/com.example.projectgreetv3.StartingPlace}: java.lang.ClassNotFoundException: com.example.projectgreetv3.StartingPlace in loader dalvik.system.PathClassLoader[/data/app/com.example.projectgreetv3-1.apk]
10-24 15:22:55.140 E/AndroidRuntime(4906): Caused by: java.lang.ClassNotFoundException: com.example.projectgreetv3.StartingPlace in loader dalvik.system.PathClassLoader[/data/app/com.example.projectgreetv3-1.apk]
10-24 15:22:55.148 W/ActivityManager(539): Force finishing activity com.example.projectgreetv3/.StartingPlace
10-24 15:21:51.726 I/UinboxLogger(4585): [UinboxReceiver] onReceive() >> intent.getData() : com.example.projectgreetv3
10-24 15:21:52.382 I/UninstallAppProgress(4575): Finished uninstalling pkg: com.example.projectgreetv3
10-24 15:22:52.523 D/PackageManager(539): Scanning package com.example.projectgreetv3
I hope someone can help me with this, as I am on wits end.
For more info on:
- Arduino:
- http://www.arduino.cc/
- Amarino:
http://www.amarino-toolkit.net/

If you look a bit further down on your stacktrace (in the logcat) you will probably see that the cause of this crash is an NetworkOnMainThreadException. (If you are running Android 3.0 or higher)
Please make sure that you do all your network communication on a separate thread (Thread/ASyncTask).
http://developer.android.com/reference/android/os/NetworkOnMainThreadException.html

Related

How to use Jingle Manager in android for implementing audio/video call

I’m new in here and trying to implement audio/video calling feature in our app with the help of Jingle Smack extension 4.4.6, I had already installed Jingle Plugin into my Openfire server 4.7.4 which configured on my local window’s machine.
I’m able to make connection with server and able to send and receive messages
Now want to add functionality for audio/video call
I tried to call jingleUtil.sendSessionPing method but got error item-not-found or below error
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:558)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
Caused by: org.jivesoftware.smack.XMPPException$XMPPErrorException: XMPP error reply received from harsh#host.docker.internal/25wwd9eoqq: XMPPError: item-not-found - cancel
at org.jivesoftware.smack.StanzaCollector.nextResultOrThrow(StanzaCollector.java:284)
at org.jivesoftware.smack.StanzaCollector.nextResultOrThrow(StanzaCollector.java:228)
at org.jivesoftware.smackx.jingle.JingleUtil.sendSessionPing(JingleUtil.java:330)
Can please suggest what I have to do on my client side for creating jingle session and initiate request or do I need to do some changes on my Openfire server configuration
Thanks in advance
If anyone have an idea about it how we can use Jingle node plugin and Jingle Manager in android app please help

Exception: Bluetooth Device is not ready

My java application makes a bluetooth server and waits for connection.My program works fine in windows.
but when I try to run it in Linux it gives this error.How can I resolve this?
BlueCove version 2.1.1-SNAPSHOT on bluez
javax.bluetooth.BluetoothStateException: Bluetooth Device is not ready. [1] Operation not permitted
at com.intel.bluetooth.BluetoothStackBlueZ.nativeSetLocalDeviceDiscoverable(Native Method)
at com.intel.bluetooth.BluetoothStackBlueZ.setLocalDeviceDiscoverable(BluetoothStackBlueZ.java:307)
at javax.bluetooth.LocalDevice.setDiscoverable(LocalDevice.java:206)
at bluetoothjava.WaitThread.waitForConnection(WaitThread.java:32)
at bluetoothjava.WaitThread.run(WaitThread.java:18)
at java.base/java.lang.Thread.run(Thread.java:834)
BlueCove stack shutdown completed

Google Play services missing or without correct permission

currently I am doing the user registration class by using Firebase authentication. However, the logcat showed this error. May I know how to solve this? I have install google play services in SDK tools and added in manifest file. Thank you:)
error1: load_driver(/vendor/lib/egl/libGLES_emulation.so): dlopen failed: library "/vendor/lib/egl/libGLES_emulation.so"
error2: Google Play services missing or without correct permission.
Error3: tid 3325: eglSurfaceAttrib(1354): error 0x3009 (EGL_BAD_MATCH)
Editted: those problem arised due to the emulator, but as long as you installed google play service on the emulator, the problem will solve
Try running it on a real device, emulator tends to cause errors.

Security Exception: android.permission.INTERACT_ACROSS_USERS

Just faced this exception under my application PID in the Android Monitor, while not doing anything special. First time I'm seeing such thing, any explanation/docs? Thanks
java.lang.SecurityException: Permission Denial:
broadcast from android asks to run as user -1 but is calling from user 0;
this requires android.permission.INTERACT_ACROSS_USERS_FULL or
android.permission.INTERACT_ACROSS_USERS
One of the possible solutions is to disable auto-fill, but it works only on Android Oreo. Check this link Disabling Android O auto-fill service for an application

Why does the android emulator camera stop unexpectedly?

I am using Android 2.2 (API Level 8). The camera is enabled in the manifest. When I try the camera icon provided by the emulator model, it runs for a few seconds showing a gray box moving around a black and white checkerboard, then dies with the error message:
Sorry! The application Camera (process
com.android.camera) has stopped
unexpectedly. Please try again.
Trying again, of course, doesn't help. I am using the provided emulator camera to compare behavior with a camera application I am working on. Why does the android emulator camera stop unexpectedly?
The emulator camera is flaky at best.
To get more details run "platform-tools/adb logcat" from the host command line. The base problem seems to be the camera thinking there are multiple clients connected. The camera also sets the rotation to landscape but after crashing fails to set it back:
I/ActivityManager( 70): Starting: Intent { act=android.media.action.IMAGE_CAPTURE cmp=com.android.camera/.Camera } from pid 875
I/ActivityManager( 70): Start proc com.android.camera for activity com.android.camera/.Camera: pid=888 uid=10031 gids={1006, 1015}
I/WindowManager( 70): Setting rotation to 1, animFlags=1
I/ActivityManager( 70): Config changed: { scale=1.0 imsi=310/260 loc=en_US touch=3 keys=2/1/2 nav=3/1 orien=2 layout=34 uiMode=17 seq=22}
V/CameraHolder( 888): open camera 0
W/CameraService( 34): CameraService::connect X (pid 888) rejected (existing client).
E/CameraHolder( 888): fail to connect Camera
E/CameraHolder( 888): java.lang.RuntimeException: Fail to connect to camera service
E/CameraHolder( 888): at android.hardware.Camera.native_setup(Native Method)
E/CameraHolder( 888): at android.hardware.Camera.<init>(Camera.java:258)
E/CameraHolder( 888): at android.hardware.Camera.open(Camera.java:220)
E/CameraHolder( 888): at com.android.camera.CameraHolder.open(CameraHolder.java:124)
E/CameraHolder( 888): at com.android.camera.Camera.ensureCameraDevice(Camera.java:1608)
E/CameraHolder( 888): at com.android.camera.Camera.startPreview(Camera.java:1660)
E/CameraHolder( 888): at com.android.camera.Camera.access$5500(Camera.java:95)
E/CameraHolder( 888): at com.android.camera.Camera$3.run(Camera.java:908)
E/CameraHolder( 888): at java.lang.Thread.run(Thread.java:1019)
W/dalvikvm( 888): threadid=11: thread exiting with uncaught exception (group=0x40015560)
E/AndroidRuntime( 888): FATAL EXCEPTION: Thread-12
See also question "4799183"
I would imagine because the emulator doesn't have a real camera, the hardware is simulated by the checkerbox you speak of. Because there is no hardware driver for real it most likely tries to check for capabilities, or set features that can't be done because the simulated hardware doesn't support it. Your best bet it to debug the camera or compile it yourself and add some debug output to find out what exactly is going on.
Does it work in 2.1 and earlier?
In the DDMS perspective I can see the exception shown here:
Emulator's camera built-in app buggy in Froyo / 2.2?
although I haven't tried the code change suggested in the article.
It might just be that the emulator camera is flaky :)
I have realized that camera simulation on the Emulator is stable on the API level 4 (Android 1.6) and below without crashing.

Categories

Resources