Ionic Framework start error on Android - android

I have a project with Ionic working fine in iOS (emulator and device), web and with a problem in Android.
I have used to create the project:
ionic platform add android
I open the project with Eclipse, everything is Ok, no errors, and CordovaLib is loading fine.
When I try to deploy in my device, I have this error:
11-20 15:22:56.350: E/AndroidRuntime(10312): FATAL EXCEPTION: main
11-20 15:22:56.350: E/AndroidRuntime(10312): Process: com.ionicframework.congressapp251163, PID: 10312
11-20 15:22:56.350: E/AndroidRuntime(10312): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ionicframework.congressapp251163/com.ionicframework.congressapp251163.CordovaApp}: java.lang.NullPointerException
11-20 15:22:56.350: E/AndroidRuntime(10312): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2447)
11-20 15:22:56.350: E/AndroidRuntime(10312): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2507)
11-20 15:22:56.350: E/AndroidRuntime(10312): at android.app.ActivityThread.access$900(ActivityThread.java:172)
11-20 15:22:56.350: E/AndroidRuntime(10312): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1308)
11-20 15:22:56.350: E/AndroidRuntime(10312): at android.os.Handler.dispatchMessage(Handler.java:102)
11-20 15:22:56.350: E/AndroidRuntime(10312): at android.os.Looper.loop(Looper.java:146)
11-20 15:22:56.350: E/AndroidRuntime(10312): at android.app.ActivityThread.main(ActivityThread.java:5692)
11-20 15:22:56.350: E/AndroidRuntime(10312): at java.lang.reflect.Method.invokeNative(Native Method)
11-20 15:22:56.350: E/AndroidRuntime(10312): at java.lang.reflect.Method.invoke(Method.java:515)
11-20 15:22:56.350: E/AndroidRuntime(10312): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291)
11-20 15:22:56.350: E/AndroidRuntime(10312): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
11-20 15:22:56.350: E/AndroidRuntime(10312): at dalvik.system.NativeStart.main(Native Method)
11-20 15:22:56.350: E/AndroidRuntime(10312): Caused by: java.lang.NullPointerException
11-20 15:22:56.350: E/AndroidRuntime(10312): at org.apache.cordova.PluginManager.getPlugin(PluginManager.java:191)
11-20 15:22:56.350: E/AndroidRuntime(10312): at org.apache.cordova.PluginManager.startupPlugins(PluginManager.java:114)
11-20 15:22:56.350: E/AndroidRuntime(10312): at org.apache.cordova.PluginManager.init(PluginManager.java:92)
11-20 15:22:56.350: E/AndroidRuntime(10312): at org.apache.cordova.CordovaWebView.loadUrlIntoView(CordovaWebView.java:383)
11-20 15:22:56.350: E/AndroidRuntime(10312): at org.apache.cordova.CordovaWebView.loadUrlIntoView(CordovaWebView.java:368)
11-20 15:22:56.350: E/AndroidRuntime(10312): at org.apache.cordova.CordovaWebView.loadUrl(CordovaWebView.java:344)
11-20 15:22:56.350: E/AndroidRuntime(10312): at org.apache.cordova.CordovaActivity.loadUrl(CordovaActivity.java:389)
11-20 15:22:56.350: E/AndroidRuntime(10312): at com.ionicframework.congressapp251163.CordovaApp.onCreate(CordovaApp.java:33)
11-20 15:22:56.350: E/AndroidRuntime(10312): at android.app.Activity.performCreate(Activity.java:5541)
11-20 15:22:56.350: E/AndroidRuntime(10312): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
11-20 15:22:56.350: E/AndroidRuntime(10312): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2411)
11-20 15:22:56.350: E/AndroidRuntime(10312): ... 11 more
EDIT:
The plugins have not been copying to the Android Project :(
Help please ;) Thanks!!

I had the same problem,but solved using this way.After creating the project first I build the project using the command ionic build android, then import it.if its not working try this
1.Remove the platform using ionic platform remove android
2.Add the platform again,and run.

Related

Android App has been working for weeks and now it fails every time to Launch

I have been working on my Android application for weeks now and suddenly it just will not launch. I get the same errors on my mobile device as well as on the Emulator. I have made backups of older versions off my application as I go along, and despite reloading these into eclipse I am still getting the same errors. I really do not understand and panicking. Please can someone advise?
My stacktrace:
11-20 11:46:29.821: E/AndroidRuntime(6573): FATAL EXCEPTION: main
11-20 11:46:29.821: E/AndroidRuntime(6573): Process: com.example.lifesci_pubmed, PID: 6573
11-20 11:46:29.821: E/AndroidRuntime(6573): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.lifesci_pubmed/com.android.lifesci_pubmed.ArticleListFragment_developActivity}: java.lang.NullPointerException
11-20 11:46:29.821: E/AndroidRuntime(6573): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2198)
11-20 11:46:29.821: E/AndroidRuntime(6573): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2257)
11-20 11:46:29.821: E/AndroidRuntime(6573): at android.app.ActivityThread.access$800(ActivityThread.java:139)
11-20 11:46:29.821: E/AndroidRuntime(6573): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210)
11-20 11:46:29.821: E/AndroidRuntime(6573): at android.os.Handler.dispatchMessage(Handler.java:102)
11-20 11:46:29.821: E/AndroidRuntime(6573): at android.os.Looper.loop(Looper.java:136)
11-20 11:46:29.821: E/AndroidRuntime(6573): at android.app.ActivityThread.main(ActivityThread.java:5086)
11-20 11:46:29.821: E/AndroidRuntime(6573): at java.lang.reflect.Method.invokeNative(Native Method)
11-20 11:46:29.821: E/AndroidRuntime(6573): at java.lang.reflect.Method.invoke(Method.java:515)
11-20 11:46:29.821: E/AndroidRuntime(6573): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
11-20 11:46:29.821: E/AndroidRuntime(6573): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
11-20 11:46:29.821: E/AndroidRuntime(6573): at dalvik.system.NativeStart.main(Native Method)
11-20 11:46:29.821: E/AndroidRuntime(6573): Caused by: java.lang.NullPointerException
11-20 11:46:29.821: E/AndroidRuntime(6573): at com.android.lifesci_pubmed.ArticleListFragment_develop.recallToReadList(ArticleListFragment_develop.java:685)
11-20 11:46:29.821: E/AndroidRuntime(6573): at com.android.lifesci_pubmed.ArticleListFragment_develop.onCreate(ArticleListFragment_develop.java:91)
11-20 11:46:29.821: E/AndroidRuntime(6573): at android.support.v4.app.Fragment.performCreate(Fragment.java:1481)
11-20 11:46:29.821: E/AndroidRuntime(6573): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:908)
11-20 11:46:29.821: E/AndroidRuntime(6573): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1121)
11-20 11:46:29.821: E/AndroidRuntime(6573): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
11-20 11:46:29.821: E/AndroidRuntime(6573): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1484)
11-20 11:46:29.821: E/AndroidRuntime(6573): at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:571)
11-20 11:46:29.821: E/AndroidRuntime(6573): at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1194)
11-20 11:46:29.821: E/AndroidRuntime(6573): at android.app.Activity.performStart(Activity.java:5258)
11-20 11:46:29.821: E/AndroidRuntime(6573): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2171)
11-20 11:46:29.821: E/AndroidRuntime(6573): ... 11 more
11-20 11:51:29.848: I/Process(6573): Sending signal. PID: 6573 SIG: 9
Do you have declared the activitys in the manifest?

I am unable to start activity ComponentInfo [duplicate]

This question already has answers here:
After Google Play Service update to version 13 I got an error
(8 answers)
Closed 9 years ago.
my app crashes on line
setContentView(R.layout.activity_map);
I'm using google maps api v2, i used to run this app on former eclipse and android sdk and it worked, after reinstallation of android sdk, got this exception
11-20 16:26:28.494: E/AndroidRuntime(19705): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.poputkaonline/com.example.poputkaonline.MapActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
11-20 16:26:28.494: E/AndroidRuntime(19705): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2355)
11-20 16:26:28.494: E/AndroidRuntime(19705): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2391)
11-20 16:26:28.494: E/AndroidRuntime(19705): at android.app.ActivityThread.access$600(ActivityThread.java:151)
11-20 16:26:28.494: E/AndroidRuntime(19705): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1335)
11-20 16:26:28.494: E/AndroidRuntime(19705): at android.os.Handler.dispatchMessage(Handler.java:99)
11-20 16:26:28.494: E/AndroidRuntime(19705): at android.os.Looper.loop(Looper.java:155)
11-20 16:26:28.494: E/AndroidRuntime(19705): at android.app.ActivityThread.main(ActivityThread.java:5520)
11-20 16:26:28.494: E/AndroidRuntime(19705): at java.lang.reflect.Method.invokeNative(Native Method)
11-20 16:26:28.494: E/AndroidRuntime(19705): at java.lang.reflect.Method.invoke(Method.java:511)
11-20 16:26:28.494: E/AndroidRuntime(19705): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1029)
11-20 16:26:28.494: E/AndroidRuntime(19705): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:796)
11-20 16:26:28.494: E/AndroidRuntime(19705): at dalvik.system.NativeStart.main(Native Method)
11-20 16:26:28.494: E/AndroidRuntime(19705): Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
11-20 16:26:28.494: E/AndroidRuntime(19705): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
11-20 16:26:28.494: E/AndroidRuntime(19705): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
11-20 16:26:28.494: E/AndroidRuntime(19705): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
11-20 16:26:28.494: E/AndroidRuntime(19705): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
11-20 16:26:28.494: E/AndroidRuntime(19705): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
11-20 16:26:28.494: E/AndroidRuntime(19705): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:324)
11-20 16:26:28.494: E/AndroidRuntime(19705): at android.app.Activity.setContentView(Activity.java:1912)
11-20 16:26:28.494: E/AndroidRuntime(19705): at com.example.poputkaonline.MapActivity.onCreate(MapActivity.java:263)
11-20 16:26:28.494: E/AndroidRuntime(19705): at android.app.Activity.performCreate(Activity.java:5066)
11-20 16:26:28.494: E/AndroidRuntime(19705): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1101)
11-20 16:26:28.494: E/AndroidRuntime(19705): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2311)
11-20 16:26:28.494: E/AndroidRuntime(19705): ... 11 more
11-20 16:26:28.494: E/AndroidRuntime(19705): Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 4030500 but found 0. You must have the following declaration within the <application> element: <meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
11-20 16:26:28.494: E/AndroidRuntime(19705): at com.google.android.gms.common.GooglePlayServicesUtil.n(Unknown Source)
11-20 16:26:28.494: E/AndroidRuntime(19705): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
11-20 16:26:28.494: E/AndroidRuntime(19705): at com.google.android.gms.maps.internal.q.v(Unknown Source)
11-20 16:26:28.494: E/AndroidRuntime(19705): at com.google.android.gms.maps.internal.q.u(Unknown Source)
11-20 16:26:28.494: E/AndroidRuntime(19705): at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
11-20 16:26:28.494: E/AndroidRuntime(19705): at com.google.android.gms.maps.SupportMapFragment$b.cE(Unknown Source)
11-20 16:26:28.494: E/AndroidRuntime(19705): at com.google.android.gms.maps.SupportMapFragment$b.a(Unknown Source)
11-20 16:26:28.494: E/AndroidRuntime(19705): at com.google.android.gms.dynamic.a.a(Unknown Source)
11-20 16:26:28.494: E/AndroidRuntime(19705): at com.google.android.gms.dynamic.a.onInflate(Unknown Source)
11-20 16:26:28.494: E/AndroidRuntime(19705): at com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown Source)
11-20 16:26:28.494: E/AndroidRuntime(19705): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:269)
11-20 16:26:28.494: E/AndroidRuntime(19705): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:676)
try to add Google play service as reference to your project...
and even add in androidmanifest.xml
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
The explanation lies within your stacktrace:
Caused by: java.lang.IllegalStateException: The meta-data tag in your
app's AndroidManifest.xml does not have the right value. Expected
4030500 but found 0. You must have the following declaration within
the <application> element: <meta-data android:name="com.google.android.gms.version"android:value="#integer/google_play_services_version" />

Conflict dropbox sync api with another native library in Android

My app use tess-two (https://github.com/rmtheis/tess-two) library which uses native api. When I use separate tess-two or dropbox sync api, there is nothing happen. But my app need to use both libraries, and when I add two libraries at the same time, I got the exception with dropbox sync api like this:
11-20 16:18:30.440: E/AndroidRuntime(7672): FATAL EXCEPTION: main
11-20 16:18:30.440: E/AndroidRuntime(7672): java.lang.ExceptionInInitializerError
11-20 16:18:30.440: E/AndroidRuntime(7672): at com.dropbox.sync.android.CoreAccountManager.initNativeLib(CoreAccountManager.java:155)
11-20 16:18:30.440: E/AndroidRuntime(7672): at com.dropbox.sync.android.CoreAccountManager.<init>(CoreAccountManager.java:126)
11-20 16:18:30.440: E/AndroidRuntime(7672): at com.dropbox.sync.android.DbxAccountManager.getInstance(DbxAccountManager.java:149)
11-20 16:18:30.440: E/AndroidRuntime(7672): at com.dropbox.sync.android.DbxAccountManager.getInstance(DbxAccountManager.java:115)
11-20 16:18:30.440: E/AndroidRuntime(7672): at com.appiphany.roboscanner.utils.Config.getDropboxAccountManager(Config.java:19)
11-20 16:18:30.440: E/AndroidRuntime(7672): at com.appiphany.roboscanner.DocumentListFragment.onAttach(DocumentListFragment.java:110)
11-20 16:18:30.440: E/AndroidRuntime(7672): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:883)
11-20 16:18:30.440: E/AndroidRuntime(7672): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
11-20 16:18:30.440: E/AndroidRuntime(7672): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
11-20 16:18:30.440: E/AndroidRuntime(7672): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1467)
11-20 16:18:30.440: E/AndroidRuntime(7672): at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:570)
11-20 16:18:30.440: E/AndroidRuntime(7672): at com.appiphany.roboscanner.BaseActivity.onStart(BaseActivity.java:28)
11-20 16:18:30.440: E/AndroidRuntime(7672): at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1167)
11-20 16:18:30.440: E/AndroidRuntime(7672): at android.app.Activity.performStart(Activity.java:5216)
11-20 16:18:30.440: E/AndroidRuntime(7672): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2073)
11-20 16:18:30.440: E/AndroidRuntime(7672): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
11-20 16:18:30.440: E/AndroidRuntime(7672): at android.app.ActivityThread.access$600(ActivityThread.java:140)
11-20 16:18:30.440: E/AndroidRuntime(7672): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
11-20 16:18:30.440: E/AndroidRuntime(7672): at android.os.Handler.dispatchMessage(Handler.java:99)
11-20 16:18:30.440: E/AndroidRuntime(7672): at android.os.Looper.loop(Looper.java:137)
11-20 16:18:30.440: E/AndroidRuntime(7672): at android.app.ActivityThread.main(ActivityThread.java:4898)
11-20 16:18:30.440: E/AndroidRuntime(7672): at java.lang.reflect.Method.invokeNative(Native Method)
11-20 16:18:30.440: E/AndroidRuntime(7672): at java.lang.reflect.Method.invoke(Method.java:511)
11-20 16:18:30.440: E/AndroidRuntime(7672): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
11-20 16:18:30.440: E/AndroidRuntime(7672): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
11-20 16:18:30.440: E/AndroidRuntime(7672): at dalvik.system.NativeStart.main(Native Method)
11-20 16:18:30.440: E/AndroidRuntime(7672): Caused by: java.lang.ExceptionInInitializerError
11-20 16:18:30.440: E/AndroidRuntime(7672): at com.dropbox.sync.android.NativeLib.<init>(NativeLib.java:33)
11-20 16:18:30.440: E/AndroidRuntime(7672): at com.dropbox.sync.android.NativeLib.<clinit>(NativeLib.java:11)
11-20 16:18:30.440: E/AndroidRuntime(7672): ... 26 more
11-20 16:18:30.440: E/AndroidRuntime(7672): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load DropboxSync: findLibrary returned null
11-20 16:18:30.440: E/AndroidRuntime(7672): at java.lang.Runtime.loadLibrary(Runtime.java:365)
11-20 16:18:30.440: E/AndroidRuntime(7672): at java.lang.System.loadLibrary(System.java:535)
11-20 16:18:30.440: E/AndroidRuntime(7672): at com.dropbox.sync.android.NativeHttp.<clinit>(NativeHttp.java:446)
I'm sure that I have copied all .so and jar library files of dropbox sync api into my libs folder. And I also refer this link Error in dropboxSync: findlibrary returned null, but it doesn't work. Is there any idea?
Update: my Android.mk of tess-two look like this ( I don't change anything from github source because I think two libraries don't reference each other):
LOCAL_PATH := $(call my-dir)
TESSERACT_PATH := $(LOCAL_PATH)/com_googlecode_tesseract_android/src
LEPTONICA_PATH := $(LOCAL_PATH)/com_googlecode_leptonica_android/src
# Just build the Android.mk files in the subdirs
include $(call all-subdir-makefiles)
Problem is solved by copying libDropboxSync.so from armeabi to armeabi-v7a folder but I don't know how it can work. More detail in my own question from dropbox 4rum

Update old android project

I am following this tutorial and I can make it work just fine, but when I try to update the UI to fit the new Holo.Light in android 4.2 the app crashes at launch, and I don't know why.
I have been searching for a way to update the UI but I could not get it to work.
I wonder if anybody could help me? tell me how? Give me a link that you know would work?
or even do it yourself?
i get this error log:
11-20 09:50:39.523: I/dalvikvm(1460): threadid=3: reacting to signal 3
11-20 09:50:39.682: I/dalvikvm(1460): Wrote stack traces to '/data/anr/traces.txt'
11-20 09:50:39.892: I/dalvikvm(1460): threadid=3: reacting to signal 3
11-20 09:50:40.003: I/dalvikvm(1460): Wrote stack traces to '/data/anr/traces.txt'
11-20 09:50:40.102: D/AndroidRuntime(1460): Shutting down VM
11-20 09:50:40.102: W/dalvikvm(1460): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
11-20 09:50:40.132: E/AndroidRuntime(1460): FATAL EXCEPTION: main
11-20 09:50:40.132: E/AndroidRuntime(1460): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.androidhive.jsonparsing/com.androidhive.jsonparsing.AndroidJSONParsingActivity}: android.os.NetworkOnMainThreadException
11-20 09:50:40.132: E/AndroidRuntime(1460): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
11-20 09:50:40.132: E/AndroidRuntime(1460): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
11-20 09:50:40.132: E/AndroidRuntime(1460): at android.app.ActivityThread.access$600(ActivityThread.java:123)
11-20 09:50:40.132: E/AndroidRuntime(1460): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
11-20 09:50:40.132: E/AndroidRuntime(1460): at android.os.Handler.dispatchMessage(Handler.java:99)
11-20 09:50:40.132: E/AndroidRuntime(1460): at android.os.Looper.loop(Looper.java:137)
11-20 09:50:40.132: E/AndroidRuntime(1460): at android.app.ActivityThread.main(ActivityThread.java:4424)
11-20 09:50:40.132: E/AndroidRuntime(1460): at java.lang.reflect.Method.invokeNative(Native Method)
11-20 09:50:40.132: E/AndroidRuntime(1460): at java.lang.reflect.Method.invoke(Method.java:511)
11-20 09:50:40.132: E/AndroidRuntime(1460): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
11-20 09:50:40.132: E/AndroidRuntime(1460): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
11-20 09:50:40.132: E/AndroidRuntime(1460): at dalvik.system.NativeStart.main(Native Method)
11-20 09:50:40.132: E/AndroidRuntime(1460): Caused by: android.os.NetworkOnMainThreadException
11-20 09:50:40.132: E/AndroidRuntime(1460): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1099)
11-20 09:50:40.132: E/AndroidRuntime(1460): at java.net.InetAddress.lookupHostByName(InetAddress.java:391)
11-20 09:50:40.132: E/AndroidRuntime(1460): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:242)
11-20 09:50:40.132: E/AndroidRuntime(1460): at java.net.InetAddress.getAllByName(InetAddress.java:220)
11-20 09:50:40.132: E/AndroidRuntime(1460): at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:137)
11-20 09:50:40.132: E/AndroidRuntime(1460): at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
11-20 09:50:40.132: E/AndroidRuntime(1460): at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
11-20 09:50:40.132: E/AndroidRuntime(1460): at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360)
11-20 09:50:40.132: E/AndroidRuntime(1460): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
11-20 09:50:40.132: E/AndroidRuntime(1460): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
11-20 09:50:40.132: E/AndroidRuntime(1460): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
11-20 09:50:40.132: E/AndroidRuntime(1460): at com.androidhive.jsonparsing.JSONParser.getJSONFromUrl(JSONParser.java:38)
11-20 09:50:40.132: E/AndroidRuntime(1460): at com.androidhive.jsonparsing.AndroidJSONParsingActivity.onCreate(AndroidJSONParsingActivity.java:53)
11-20 09:50:40.132: E/AndroidRuntime(1460): at android.app.Activity.performCreate(Activity.java:4465)
11-20 09:50:40.132: E/AndroidRuntime(1460): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
11-20 09:50:40.132: E/AndroidRuntime(1460): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
11-20 09:50:40.132: E/AndroidRuntime(1460): ... 11 more
11-20 09:50:40.392: I/dalvikvm(1460): threadid=3: reacting to signal 3
11-20 09:50:40.412: I/dalvikvm(1460): Wrote stack traces to '/data/anr/traces.txt'
11-20 09:50:40.791: I/dalvikvm(1460): threadid=3: reacting to signal 3
11-20 09:50:40.962: I/dalvikvm(1460): Wrote stack traces to '/data/anr/traces.txt'
You are making a network call on the main thread. This is not allowed on Android 4.2, and is a really bad idea on earlier versions which do permit this. I have blogged about various mechanisms for moving network and other heavy calls off the main thread at http://blog.stylingandroid.com/archives/833.
Without seeing your code, I cannot begin to suggest which approach is the right one for you to use, but hopefully the information in my articles will help you in deciding upon the correct approach.
There are two Solution of this Problem.
1) Don't write network call in Main UIThread, Use Async Task for that.
2) Write below code into your MainActivity file after setContentView(R.layout.activity_main);
if (android.os.Build.VERSION.SDK_INT > 9) {
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
}
And below import statement into your java file.
import android.os.StrictMode;
and see below link for more information.
Twitter connect error

How can my Android app open a port for listening?

I want my Android app to behave as a client and listen on a particular port. None of the code I've tried works. I tried this tutorial to create a small chat app. The server side works fine, but the app crashes on my device. I have both my phone and server comp on VPN.
logcat text returned:
11-20 12:39:12.789: W/dalvikvm(12045): threadid=1: thread exiting with uncaught exception (group=0x4017c560)
11-20 12:39:12.799: E/AndroidRuntime(12045): FATAL EXCEPTION: main
11-20 12:39:12.799: E/AndroidRuntime(12045): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.android_port/com.example.android_port.MainActivity}: java.lang.ClassNotFoundException: com.example.android_port.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.android_port-1.apk]
11-20 12:39:12.799: E/AndroidRuntime(12045): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1573)
11-20 12:39:12.799: E/AndroidRuntime(12045): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
11-20 12:39:12.799: E/AndroidRuntime(12045): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
11-20 12:39:12.799: E/AndroidRuntime(12045): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
11-20 12:39:12.799: E/AndroidRuntime(12045): at android.os.Handler.dispatchMessage(Handler.java:99)
11-20 12:39:12.799: E/AndroidRuntime(12045): at android.os.Looper.loop(Looper.java:130)
11-20 12:39:12.799: E/AndroidRuntime(12045): at android.app.ActivityThread.main(ActivityThread.java:3687)
11-20 12:39:12.799: E/AndroidRuntime(12045): at java.lang.reflect.Method.invokeNative(Native Method)
11-20 12:39:12.799: E/AndroidRuntime(12045): at java.lang.reflect.Method.invoke(Method.java:507)
11-20 12:39:12.799: E/AndroidRuntime(12045): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:878)
11-20 12:39:12.799: E/AndroidRuntime(12045): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:636)
11-20 12:39:12.799: E/AndroidRuntime(12045): at dalvik.system.NativeStart.main(Native Method)
11-20 12:39:12.799: E/AndroidRuntime(12045): Caused by: java.lang.ClassNotFoundException: com.example.android_port.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.android_port-1.apk]
11-20 12:39:12.799: E/AndroidRuntime(12045): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
11-20 12:39:12.799: E/AndroidRuntime(12045): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
11-20 12:39:12.799: E/AndroidRuntime(12045): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
11-20 12:39:12.799: E/AndroidRuntime(12045): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
11-20 12:39:12.799: E/AndroidRuntime(12045): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1565)
11-20 12:39:12.799: E/AndroidRuntime(12045): ... 11 more

Categories

Resources