An error occurred while connecting to camera in android - android-camera

During integration of zxing library in android app every thing works fine but when i try to call camera repeatedly facing this problem with camera
here is my logcat
02-24 20:49:34.775: W/CameraBase(15622): An error occurred while connecting to camera: 0
02-24 20:49:34.785: W/CaptureActivity(15622): Unexpected error initializing camera
02-24 20:49:34.785: W/CaptureActivity(15622): java.lang.RuntimeException: Fail to connect to camera service
02-24 20:49:34.785: W/CaptureActivity(15622): at android.hardware.Camera.<init>(Camera.java:545)
02-24 20:49:34.785: W/CaptureActivity(15622): at android.hardware.Camera.open(Camera.java:385)
02-24 20:49:34.785: W/CaptureActivity(15622): at com.google.zxing.client.android.camera.open.OpenCameraInterface.open(OpenCameraInterface.java:53)
02-24 20:49:34.785: W/CaptureActivity(15622): at com.google.zxing.client.android.camera.CameraManager.openDriver(CameraManager.java:80)
02-24 20:49:34.785: W/CaptureActivity(15622): at com.google.zxing.client.android.CaptureActivity.initCamera(CaptureActivity.java:652)
02-24 20:49:34.785: W/CaptureActivity(15622): at com.google.zxing.client.android.CaptureActivity.surfaceCreated(CaptureActivity.java:370)
02-24 20:49:34.785: W/CaptureActivity(15622): at android.view.SurfaceView.updateWindow(SurfaceView.java:607)
02-24 20:49:34.785: W/CaptureActivity(15622): at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:184)
02-24 20:49:34.785: W/CaptureActivity(15622): at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:921)
02-24 20:49:34.785: W/CaptureActivity(15622): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2169)
02-24 20:49:34.785: W/CaptureActivity(15622): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1196)
02-24 20:49:34.785: W/CaptureActivity(15622): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6675)
02-24 20:49:34.785: W/CaptureActivity(15622): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:777)
02-24 20:49:34.785: W/CaptureActivity(15622): at android.view.Choreographer.doCallbacks(Choreographer.java:590)
02-24 20:49:34.785: W/CaptureActivity(15622): at android.view.Choreographer.doFrame(Choreographer.java:560)
02-24 20:49:34.785: W/CaptureActivity(15622): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:763)
02-24 20:49:34.785: W/CaptureActivity(15622): at android.os.Handler.handleCallback(Handler.java:739)
02-24 20:49:34.785: W/CaptureActivity(15622): at android.os.Handler.dispatchMessage(Handler.java:95)
02-24 20:49:34.785: W/CaptureActivity(15622): at android.os.Looper.loop(Looper.java:145)
02-24 20:49:34.785: W/CaptureActivity(15622): at android.app.ActivityThread.main(ActivityThread.java:5944)
02-24 20:49:34.785: W/CaptureActivity(15622): at java.lang.reflect.Method.invoke(Native Method)
02-24 20:49:34.785: W/CaptureActivity(15622): at java.lang.reflect.Method.invoke(Method.java:372)
02-24 20:49:34.785: W/CaptureActivity(15622): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1388)
02-24 20:49:34.785: W/CaptureActivity(15622): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1183)
Here is code for integrating zxing library please check it
#Override
public void onScanClicked(int position) {
barCodePosition = position;
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.putExtra("SCAN_MODE", "SCAN_MODE");
startActivityForResult(intent, 123);
}
#Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// We came from the scanning activity; the return intent contains a
// RESULT_EXTRA key
// whose value is an ArrayList of BarcodeResult objects that we found
// while scanning.
// Get the list of objects and add them to our list view.
System.out
.println(requestCode + "DDDDDDDDDDDDDDDDDDDDDDD" + resultCode);
switch (requestCode) {
case SCAN_CODE:
if (resultCode == RESULT_OK) {
ArrayList<BarcodeResult> barcodes = data
.getParcelableArrayListExtra(BarcodeScanActivity.RESULT_EXTRA);
if (barcodes != null && barcodes.size() > 0) {
BarcodeResult barCodeResult = barcodes.get(0);
String barCodeNumber = barCodeResult.barcodeString;
Toast.makeText(getApplicationContext(), barCodeNumber,
Toast.LENGTH_LONG).show();
scanAdapter.addBarcodes(barCodeNumber, barCodePosition);
}
}
break;
case SCANNER_REQ_CODE:
if (resultCode == RESULT_OK) {
String contents = data.getStringExtra("SCAN_RESULT");
System.out.println(contents
+ "TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT");
scanAdapter.addBarcodes(contents, barCodePosition);
}
break;
case gps_code:
switch (resultCode) {
case Activity.RESULT_OK:
Bundle bund = data.getExtras();
outletLatitude = bund.getString("LATITUDE");
outletLongitude = bund.getString("LONGITUDE");
diag = ProgressDialog.show(this, "Please wait",
"saving data...");
thd = new Thread(StockCountActivity.this);
thd.start();
break;
default:
}
case product_code:
switch (resultCode) {
case Activity.RESULT_OK:
Bundle bund = data.getExtras();
// purchaseVolume.setText(bund.getString("SALES_VOLUME"));
// purchaseValue.setText(bund.getString("SALES_VALUE"));
// salesDetails = bund.getString("SALES_DETAILS");
break;
case Activity.RESULT_CANCELED:
break;
default:
}
}
}

Add the permission in AndroidManifest.xml:
<uses-permission android:name="android.permission.CAMERA"/>

Look here: W/CameraBase﹕ An error occurred while connecting to camera: 0
Beginning in Android 6.0 (API level 23), users grant permissions to apps while the app is running, not when they install the app. This approach streamlines the app install process, since the user does not need to grant permissions when they install or update the app. It also gives the user more control over the app's functionality; for example, a user could choose to give a camera app access to the camera but not to the device location. The user can revoke the permissions at any time, by going to the app's Settings screen. http://developer.android.com/training/permissions/requesting.html

Related

Sending email with attachments via flutter_email_sender is not working on Android

I'm trying to send an email with a pdf attachment using flutter_email_sender, it works fine on iOS but throws Failed to find configured root error on Android. Below is the code.
Future<void> _downloadFile(String url, String filename) async {
var request = await httpClient.getUrl(Uri.parse(url));
var response = await request.close();
var bytes = await consolidateHttpClientResponseBytes(response);
String dir = (await getApplicationDocumentsDirectory()).path;
File file = new File('$dir/$filename');
await file.writeAsBytes(bytes);
setState(() {
_file = file;
});
}
final Email email = Email(
body: 'Email body',
subject: 'Email subject',
recipients: ['email#gmail.com'],
attachmentPath: _file.path,
);
await FlutterEmailSender.send(email);
and the stack trace:
E/MethodChannel#flutter_email_sender: Failed to handle method call
java.lang.IllegalArgumentException: Failed to find configured root that contains /data/data/com.xxx.xx/app_flutter/account_opening.pdf at androidx.core.content.FileProvider$SimplePathStrategy.getUriForFile(FileProvider.java:739)
at androidx.core.content.FileProvider.getUriForFile(FileProvider.java:418)
at com.sidlatau.flutteremailsender.FlutterEmailSenderPlugin.sendEmail(FlutterEmailSenderPlugin.kt:95)
at com.sidlatau.flutteremailsender.FlutterEmailSenderPlugin.onMethodCall(FlutterEmailSenderPlugin.kt:38)
at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:222)
at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:96)
at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:643)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:326)
at android.os.Looper.loop(Looper.java:160)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
2019-09-11 13:44:42.484 26003-26003/com.xxx.xx W/ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy#98fb11f
2019-09-11 13:44:42.505 26003-26003/com.xxx.xx D/AndroidRuntime: Shutting down VM
2019-09-11 13:44:42.512 26003-26003/com.xxx.xx E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.xxx.xx, PID: 26003
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xxx.xx/com.kiwi.fluttercrashlytics.CrashActivity}: com.kiwi.fluttercrashlytics.FlutterException: PlatformException(error, Failed to find configured root that contains /data/data/com.xxx.xx/app_flutter/account_opening.pdf, null)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: com.kiwi.fluttercrashlytics.FlutterException: PlatformException(error, Failed to find configured root that contains /data/data/com.xxx.xx/app_flutter/account_opening.pdf, null)
at StandardMethodCodec.decodeEnvelope(package:flutter/src/services/message_codecs.dart:564)
at MethodChannel.invokeMethod(package:flutter/src/services/platform_channel.dart:316)
at FlutterEmailSender.send(package:flutter_email_sender/flutter_email_sender.dart:10)
at _EmailWidgetState.build.<fn>(package:gsec/shared/widgets/manualPDFWidget/email_widget.dart:136)
at OnboardingNextButtonWidget.build.<fn>(package:gsec/onboardingScreen/onboard_next_button_widget.dart:84)
at GestureRecognizer.invokeCallback(package:flutter/src/gestures/recognizer.dart:182)
at TapGestureRecognizer._checkUp(package:flutter/src/gestures/tap.dart:365)
at TapGestureRecognizer.acceptGesture(package:flutter/src/gestures/tap.dart:312)
at GestureArenaManager.sweep(package:flutter/src/gestures/arena.dart:156)
at _WidgetsFlutterBinding&BindingBase&GestureBinding.handleEvent(package:flutter/src/gestures/binding.dart:222)
at _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent(package:flutter/src/gestures/binding.dart:198)
at _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent(package:flutter/src/gestures/binding.dart:156)
at _WidgetsFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue(package:flutter/src/gestures/binding.dart:102)
at _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket(package:flutter/src/gestures/binding.dart:86)
at ._rootRunUnary(dart:async/zone.dart:1136)
at _CustomZone.runUnary(dart:async/zone.dart:1029)
at _CustomZone.runUnaryGuarded(dart:async/zone.dart:931)
at ._invoke1(dart:ui/hooks.dart:250)
at ._dispatchPointerDataPacket(dart:ui/hooks.dart:159)
It is not possible to attach files from ApplicationDocumentsDirectory since this directory is only accessible from your app. You have to use a directory like ExternalStorageDirectory to be able to send from it. If you do so don't forget to add WRITE_EXTERNAL_STORAGE permission to your app before release.
Cheers.

Caused by: java.lang.IllegalStateException: Cannot obtain Writer because OutputStream is already in use

I am getting the below error when trying to download file in liferay
05:03:35,867 ERROR [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'][PortletRequestDispatcherImpl:115] org.springframework.web.util.NestedServletException: View rendering failed; nested exception is java.lang.IllegalStateException: Cannot obtain Writer because OutputStream is already in use
org.springframework.web.util.NestedServletException: View rendering failed; nested exception is java.lang.IllegalStateException: Cannot obtain Writer because OutputStream is already in use
at org.springframework.web.servlet.ViewRendererServlet.processRequest(ViewRendererServlet.java:96)
at org.springframework.web.servlet.ViewRendererServlet.doGet(ViewRendererServlet.java:67)
Caused by: java.lang.IllegalStateException: Cannot obtain Writer because OutputStream is already in use
at com.liferay.portlet.MimeResponseImpl.getWriter(MimeResponseImpl.java:90)
at com.liferay.portlet.PortletServletResponse.getWriter(PortletServletResponse.java:207)
at com.netcracker.portal.framework.spring.templates.view.SoyDataView.renderMergedOutputModel(SoyDataView.java:93)
and below is the code, i tried searching online but none of them have worked
String defaultFileName = "hello.pdf";
resourceResponse.setContentType("application/octet-stream");
resourceResponse.addProperty(GenericServiceTransport.CONTENT_DISPOSITION, "attachment; filename= hello.pdf" );
resourceResponse.flushBuffer();
try {
out = resourceResponse.getPortletOutputStream();
out.write(backendFile.getContent());
out.flush();
out.close();
} catch (IOException e) {
logger.error(e.getMessage());
}
return;
As first item I'd try to remove the flushBuffer call. You probably get the exception in the line following it, and flushing the buffer surely will use the output stream.
If that doesn't help, please add mute code, e.g. the complete method including its signature

Catching messages thrown by classes in a lower level

There are four levels in my application: (1) My application, (2) pivot4j, (3) olap4j, and (4) Mondrian
If I run this code in Scala:
try {
renderer.render(model, new HtmlRenderCallback(sw))
}
catch {
case ex: Exception => println(ex.getMessage)
}
The application prints the error thrown by pivot4j:
org.olap4j.OlapException: mondrian gave exception while parsing query
If I don't catch the error, the stack trace is (in bold the relevant messages):
play.api.http.HttpErrorHandlerExceptions$$anon$1: Execution
exception[[PivotException: org.olap4j.OlapException: mondrian gave
exception while parsing query]]
at play.api.http.HttpErrorHandlerExceptions$.throwableToUsefulException(HttpErrorHandler.scala:293)
at play.api.http.DefaultHttpErrorHandler.onServerError(HttpErrorHandler.scala:220)
at play.api.GlobalSettings$class.onError(GlobalSettings.scala:160)
at play.api.DefaultGlobal$.onError(GlobalSettings.scala:188)
at play.api.http.GlobalSettingsHttpErrorHandler.onServerError(HttpErrorHandler.scala:100)
at play.core.server.netty.PlayRequestHandler$$anonfun$2$$anonfun$apply$1.applyOrElse(PlayRequestHandler.scala:100)
at play.core.server.netty.PlayRequestHandler$$anonfun$2$$anonfun$apply$1.applyOrElse(PlayRequestHandler.scala:99)
at scala.concurrent.Future$$anonfun$recoverWith$1.apply(Future.scala:346)
at scala.concurrent.Future$$anonfun$recoverWith$1.apply(Future.scala:345)
at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:36) Caused
by: org.pivot4j.PivotException: org.olap4j.OlapException: mondrian
gave exception while parsing query
at org.pivot4j.impl.PivotModelImpl.getCellSet(PivotModelImpl.java:598)
at org.pivot4j.ui.table.TableRenderer.render(TableRenderer.java:425)
at olap.process.RunOlap.doRunMdx(RunOlap.scala:91)
at olap.process.RunOlap$$anonfun$runMdx$1.apply(RunOlap.scala:53)
at olap.process.RunOlap$$anonfun$runMdx$1.apply(RunOlap.scala:51)
at login.Authentication$LoggedAction$$anonfun$invokeBlock$1.apply(LoggedAction.scala:47)
at login.Authentication$LoggedAction$$anonfun$invokeBlock$1.apply(LoggedAction.scala:42)
at scala.concurrent.Future$$anonfun$flatMap$1.apply(Future.scala:253)
at scala.concurrent.Future$$anonfun$flatMap$1.apply(Future.scala:251)
at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:36) Caused
by: org.olap4j.OlapException: mondrian gave exception while parsing
query
at mondrian.olap4j.MondrianOlap4jConnection$Helper.createException(MondrianOlap4jConnection.java:858)
at mondrian.olap4j.MondrianOlap4jStatement.parseQuery(MondrianOlap4jStatement.java:375)
at mondrian.olap4j.MondrianOlap4jStatement.executeOlapQuery(MondrianOlap4jStatement.java:346)
at org.pivot4j.impl.PivotModelImpl.executeMdx(PivotModelImpl.java:646)
at org.pivot4j.impl.PivotModelImpl.getCellSet(PivotModelImpl.java:596)
at org.pivot4j.ui.table.TableRenderer.render(TableRenderer.java:425)
at olap.process.RunOlap.doRunMdx(RunOlap.scala:91)
at olap.process.RunOlap$$anonfun$runMdx$1.apply(RunOlap.scala:53)
at olap.process.RunOlap$$anonfun$runMdx$1.apply(RunOlap.scala:51)
at login.Authentication$LoggedAction$$anonfun$invokeBlock$1.apply(LoggedAction.scala:47)
Caused by: mondrian.olap.MondrianException: Mondrian Error: MDX object '[Measures].[Unit Cost]' not found in cube 'Sales'
Mondrian is the one that is originating the error, and I need to get the message that is throwing:
MDX object '[Measures].[Unit Cost]' not found in cube 'Sales'
I tried:
try {
renderer.render(model, new HtmlRenderCallback(sw))
}
catch {
case ex: MondrianException => println(ex.getMessage)
}
But is not catching the error.
Use Apache Commons ExceptionUtils to get the root exception.

Why android 5.0 occur error java.lang.RuntimeException: start smooth zoom failed?

This is my code set zoom of camera:
// 10 Set zoom value to camera
if (p.isZoomSupported() && p.isSmoothZoomSupported()) {
// most phones
mCamera.startSmoothZoom(zoomvalue);
} else if (p.isZoomSupported() && !p.isSmoothZoomSupported()) {
p.setZoom(zoomvalue);
mCamera.setParameters(p);
mCamera.setParameters(p);
mCamera.startPreview();
}
But it occur exception on Canvas Spark (Q380) android 5.0:
java.lang.RuntimeException: start smooth zoom failed
at android.hardware.Camera.startSmoothZoom(Native Method)
jat android.app.Activity.dispatchTouchEvent(Activity.java:2775)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2326)
at android.view.View.dispatchPointerEvent(View.java:8687)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4485)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4343)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3884)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3937)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3903)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4013)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3911)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4070)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3884)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3937)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3903)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3911)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3884)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:6300)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:6256)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6209)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6462)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method)
at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:176)
at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:6421)
at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:6493)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:795)
at android.view.Choreographer.doCallbacks(Choreographer.java:598)
at android.view.Choreographer.doFrame(Choreographer.java:565)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:781)
at android.os.Handler.handleCallback(Handler.java:810)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:189)
at android.app.ActivityThread.main(ActivityThread.java:5529)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:950)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:745)
Why android 5.0 occur error java.lang.RuntimeException: start smooth zoom failed?

smack api giving error to login gtalk

I used all the api's related to smack so that i could login and use the gtalk in my and app. All the api's (smack 3.22, asmack, qsmack) give me same error. Error is coppied from logcat and pasted below. Please help me i am almost frustated now :(
XMPPConnection xmppConnection;
String host = "talk.google.com";
int port = 6222;
String service = "gmail.com";
String username = "test1";
String password = "password";
try {
xmppConnection = new XMPPConnection(new ConnectionConfiguration(host,
port, service));
xmppConnection.connect();
xmppConnection.login(username, password);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
No response from the server.:
at org.jivesoftware.smack.NonSASLAuthentication.authenticate(NonSASLAuthentication.java:74)
at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:404)
at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:349)
at com.android.xmppproject.XmppManager.performLogin(XmppManager.java:56)
at com.android.xmppproject.XMPPProjectActivity.onCreate(XMPPProjectActivity.java:29)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
at android.app.ActivityThread.access$2300(ActivityThread.java:125)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
I think you have provided incorrect GTalk port.
Please try port = 5222