Cannot connect to local XMPP server using aSmack - android

I am trying connect to a local XMPP server (Vysper) from an Android App using this code:
// ...
ConnectionConfiguration connectionConfig = new ConnectionConfiguration("192.168.1.107", 5222);
// load file from "Pictures" directory from Internal Memory
File file = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
file.mkdirs();
connectionConfig.setSecurityMode(ConnectionConfiguration.SecurityMode.required);
System.setProperty("javax.net.ssl.trustStore", file + "/clientkeystore");
Log.i("Info", file.getAbsolutePath());
XMPPConnection connection = new XMPPTCPConnection(connectionConfig);
SASLAuthentication.supportSASLMechanism("PLAIN", 0);
connection.connect();
//...
This is the stack trace:
01-27 20:41:07.489 3229-3229/ E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.bm.sam, PID: 3229
java.lang.IllegalStateException: Could not execute method of the activity
at android.view.View$1.onClick(View.java:3823)
at android.view.View.performClick(View.java:4438)
at android.view.View$PerformClick.run(View.java:18422)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at android.view.View$1.onClick(View.java:3818)
at android.view.View.performClick(View.java:4438)
at android.view.View$PerformClick.run(View.java:18422)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException: println needs a message
at android.util.Log.println_native(Native Method)
at android.util.Log.e(Log.java:232)
at com.bm.sam.LoginActivity.onClickLoginButton(LoginActivity.java:187)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at android.view.View$1.onClick(View.java:3818)
at android.view.View.performClick(View.java:4438)
at android.view.View$PerformClick.run(View.java:18422)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
I am using aSmack 4.0.6 and the Android API 19.
Android network permissions and file permissions have been granted:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
What is wrong?

Your error log says you have a Log.e that is empty, so check that Log first:
Caused by: java.lang.NullPointerException: println needs a message
at android.util.Log.println_native(Native Method)
at android.util.Log.e(Log.java:232)

Related

NullPointerException in pre-launch report

I am now having several failures in the google-play pre-launch report. But I am not sure what to do about this as I do not have the crashing part under control.
This is the stacktrace
FATAL EXCEPTION: main
Process: com.google.android.apps.docs, PID: 12587
java.lang.NullPointerException
at com.google.android.apps.docs.shareitem.UploadSharedItemActivityDelegate.a(UploadSharedItemActivityDelegate.java:352)
at com.google.android.apps.docs.shareitem.UploadSharedItemActivityDelegate.b(UploadSharedItemActivityDelegate.java:315)
at gm.run(BaseActivity.java:236)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5097)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
Seems to affect Motorola mainly:

Getting the crash in this library "com.crashlytics.sdk.android:crashlytics:2.6.5#aar" library in android studio gradle

I have added the above crashlytics library in the AndroidStudio project, but its getting the below error
FATAL EXCEPTION: main
Process: com.pw.health.live_patient, PID: 28520
java.lang.NoClassDefFoundError: com.po.dm.input.DeviceType
at com.po.sdk.NWFactory.initDeviceInfo(NWFactory.java:293)
at com.po.sdk.NWFactory.access$500(NWFactory.java:79)
at com.po.sdk.NWFactory$2.receiveResponseData(NWFactory.java:267)
at com.po.sdk.http.handler.impl.RequestExecutor.onPostExecute(RequestExecutor.java:128)
at com.po.sdk.http.handler.impl.RequestExecutor.onPostExecute(RequestExecutor.java:29)
at android.os.AsyncTask.finish(AsyncTask.java:632)
at android.os.AsyncTask.access$600(AsyncTask.java:177)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:645)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5086)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
12-16 12:37:25.478 28520-28555/com.pw.health.live_patient I/CrashlyticsCore: Crashlytics report upload complete: 5856754392F0-0001-6F68-9E8808E56C06
Refer This it is working fine for me
https://fabric.io/kits/android/crashlytics/install

java.io.FileNotFoundException on posting data from Android

I am trying to post data from my android device to server through HTTPS Url, I am getting this error
java.io.FileNotFoundException:https://URL
at com.android.okhttp.internal.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:186)
at com.android.okhttp.internal.http.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:246)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5086)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
Can anyone help me?

Dev Tools app on Android Emulator crashing on sdcard scanning?

So I open Dev Tools app to refresh emulator's sd card. The sd card has been re-created, is not read-only and I can create folders on it, move files, etc.
And when I click on "Scan SD Card" button
the app crashes.
Did anyone have issues like this on the Emulator? Emulator is running SDK 19 (4.4.2), it's x86 image with XXHDPI resolution.
I am running Android Studio 1.0 and AVD was created using Android Studio 0.8 or something.
It's odd that I cannot find similar issues on Internet, like it's happening to me only.
EDIT
Logcat Error I get is
Process: com.android.development, PID: 2035
java.lang.IllegalStateException: Could not execute method of the activity
at android.view.View$1.onClick(View.java:3823)
at android.view.View.performClick(View.java:4438)
at android.view.View$PerformClick.run(View.java:18422)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at android.view.View$1.onClick(View.java:3818)
            at android.view.View.performClick(View.java:4438)
            at android.view.View$PerformClick.run(View.java:18422)
            at android.os.Handler.handleCallback(Handler.java:733)
            at android.os.Handler.dispatchMessage(Handler.java:95)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5017)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
            at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.intent.action.MEDIA_MOUNTED from pid=2035, uid=10021
at android.os.Parcel.readException(Parcel.java:1465)
at android.os.Parcel.readException(Parcel.java:1419)
at android.app.ActivityManagerProxy.broadcastIntent(ActivityManagerNative.java:2373)
at android.app.ContextImpl.sendBroadcast(ContextImpl.java:1127)
at android.content.ContextWrapper.sendBroadcast(ContextWrapper.java:365)
at com.android.development.MediaScannerActivity.startScan(MediaScannerActivity.java:123)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at android.view.View$1.onClick(View.java:3818)
            at android.view.View.performClick(View.java:4438)
            at android.view.View$PerformClick.run(View.java:18422)
            at android.os.Handler.handleCallback(Handler.java:733)
            at android.os.Handler.dispatchMessage(Handler.java:95)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5017)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
            at dalvik.system.NativeStart.main(Native Method)
Try running it from the 'ADB Command Prompt'
This command did the trick for me:
adb shell am broadcast -a android.intent.action.MEDIA_MOUNTED -d file:///mnt/sdcard/DCIM/100ANDRO/
Now, I can see images uploaded from the Android Device Monitor.

Exception: Unable to communicate with RAS

I get this exception while tinkering with Google Play Game Services - real time multiplayer. I was trying to create a room for automatch and this happen. This is strange because I have successfully created a multiplayer room many times before. I don't know what it is and how to avoid this?
07-30 14:48:06.103 1063-1063/com.google.android.gms E/RoomServiceClientStateMachine﹕ Unable to communicate with RAS
android.os.RemoteException: Service disconnected
at ffz.onServiceDisconnected(SourceFile:79)
at android.app.LoadedApk$ServiceDispatcher.doDeath(LoadedApk.java:1115)
at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1129)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
07-30 14:48:06.103 636-660/system_process W/DropBoxManagerService﹕ Dropping: SYSTEM_TOMBSTONE (1161 > 0 bytes)
07-30 14:48:06.113 1063-1063/com.google.android.gms I/RoomServiceClientStateMachine﹕ Unable to kill RAS (may already be dead)
android.os.DeadObjectException
at android.os.BinderProxy.transact(Native Method)
at ecm.a(SourceFile:388)
at ffv.b(SourceFile:111)
at ffz.onServiceDisconnected(SourceFile:79)
at android.app.LoadedApk$ServiceDispatcher.doDeath(LoadedApk.java:1115)
at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1129)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
07-30 14:48:06.113 636-965/system_process I/ActivityManager﹕ Process com.google.android.gms.room (pid 12294) has died.
07-30 14:48:06.143 180-180/? D/Zygote﹕ Process 12294 terminated by signal (11)

Categories

Resources