I was trying to integrate Facebook in my android application but a problem haunted me for three days. In fact, it's still haunting but I kept it aside as it is happening only in few devices.
The issue comes when I try to authorize the application to facebook by calling facebook.authroize(); It is giving me the following exception:
Adding Looper.prepare() and the related code should not be required because it is already called in the main thread before onCreate() in my Activity class. The main thread is somehow not finding the looper when it is sending this task to the handler.
I have added that Looper related code anyway which only lead to other problems like application freeze and some error messages.
I was stuck on this for 3 days only to find it working on some other device. So, the lesson learnt is, an application working in one device need not be working in another device and vice-versa. So, test the application in multiple devices, as many as possible. Also, don't block yourself for too long if you're stuck at some issue and blocked for 3 DAYS. It may be working fine in another device. Proceed forward, finish the app and come back to that error later.
If anyone came across same/similar issue and have found a solution, please respond. It is deeply appreciated.
Please comment if you like the post or in case, you have any queries.
Help me learn, Help you learn!
KVK
The issue comes when I try to authorize the application to facebook by calling facebook.authroize(); It is giving me the following exception:
Caused by: java.lang.RuntimeException: Can't create handler inside thread
that has not called Looper.prepare()
02-15 22:52:43.483: ERROR/AndroidRuntime(5370):
at android.os.Handler.<init>(Handler.java:121)
...
...
...
Adding Looper.prepare() and the related code should not be required because it is already called in the main thread before onCreate() in my Activity class. The main thread is somehow not finding the looper when it is sending this task to the handler.
I have added that Looper related code anyway which only lead to other problems like application freeze and some error messages.
I was stuck on this for 3 days only to find it working on some other device. So, the lesson learnt is, an application working in one device need not be working in another device and vice-versa. So, test the application in multiple devices, as many as possible. Also, don't block yourself for too long if you're stuck at some issue and blocked for 3 DAYS. It may be working fine in another device. Proceed forward, finish the app and come back to that error later.
If anyone came across same/similar issue and have found a solution, please respond. It is deeply appreciated.
Please comment if you like the post or in case, you have any queries.
Help me learn, Help you learn!
KVK
No comments:
Post a Comment