My Android code using Google Map API v2 is not working on genymotion. I have developed this code and run on my PC and it works fine, but the same code I am trying in my laptop then it gives me error "app has unfortunately stopped". I checked my code 100 times and it's perfect, everything is perfect in configuration at Google API console.
I have installed Google Play service in genymotion using following links:
http://filetrip.net/dl?4SUOrdcMRv
http://wiki.cyanogenmod.org/w/Google_Apps#gappsCM11
Logcat output:
09-04 20:07:15.691: E/AndroidRuntime(2728): FATAL EXCEPTION: main
09-04 20:07:15.691: E/AndroidRuntime(2728): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.geolocation/com.example.geolocation.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.example.geolocation.MainActivity" on path: /data/app/com.example.geolocation-2.apk
09-04 20:07:15.691: E/AndroidRuntime(2728): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
09-04 20:07:15.691: E/AndroidRuntime(2728): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
09-04 20:07:15.691: E/AndroidRuntime(2728): at android.app.ActivityThread.access$600(ActivityThread.java:141)
09-04 20:07:15.691: E/AndroidRuntime(2728): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
09-04 20:07:15.691: E/AndroidRuntime(2728): at android.os.Handler.dispatchMessage(Handler.java:99)
09-04 20:07:15.691: E/AndroidRuntime(2728): at android.os.Looper.loop(Looper.java:137)
09-04 20:07:15.691: E/AndroidRuntime(2728): at android.app.ActivityThread.main(ActivityThread.java:5041)
09-04 20:07:15.691: E/AndroidRuntime(2728): at java.lang.reflect.Method.invokeNative(Native Method)
09-04 20:07:15.691: E/AndroidRuntime(2728): at java.lang.reflect.Method.invoke(Method.java:511)
09-04 20:07:15.691: E/AndroidRuntime(2728): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
09-04 20:07:15.691: E/AndroidRuntime(2728): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
09-04 20:07:15.691: E/AndroidRuntime(2728): at dalvik.system.NativeStart.main(Native Method)
09-04 20:07:15.691: E/AndroidRuntime(2728): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.geolocation.MainActivity" on path: /data/app/com.example.geolocation-2.apk
09-04 20:07:15.691: E/AndroidRuntime(2728): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
09-04 20:07:15.691: E/AndroidRuntime(2728): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
09-04 20:07:15.691: E/AndroidRuntime(2728): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
09-04 20:07:15.691: E/AndroidRuntime(2728): at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
09-04 20:07:15.691: E/AndroidRuntime(2728): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
09-04 20:07:15.691: E/AndroidRuntime(2728): ... 11 more
Related
I recently moved to MoPub and it all appears to be working well except for I have started getting this exception saying that com.millennialmedia.android.VideoPlayer can not be found. I looked and it isn't on the Millennial jar (I just got the latest from their site). Also my AndroidManifest mentions that class and Android Studio also says it can't be found.
This is what I have there:
<activity android:name="com.millennialmedia.android.MMActivity" android:theme="#android:style/Theme.Translucent.NoTitleBar" android:configChanges="keyboardHidden|orientation|keyboard" />
<activity android:name="com.millennialmedia.android.VideoPlayer" android:configChanges="keyboardHidden|orientation|keyboard" />
On Android Studio the VideoPlayer part is red.
This is the exception I got:
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{mypackage/com.millennialmedia.android.VideoPlayer}: java.lang.ClassNotFoundException: Didn't find class "com.millennialmedia.android.VideoPlayer" on path: /data/app/mypackage-1.apk
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(NativeStart.java)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.millennialmedia.android.VideoPlayer" on path: /data/app/mypackage-1.apk
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(NativeStart.java)
Looking at the latest Millennial Media documentation, it looks like
com.millennialmedia.android.VideoPlayer
isn't included. This may be an update that needs to be made.
Alice
I am new in Android Development. I am working on cordova platform
I have created a sample hello world app and getting this error when i am trying to open it in genymotion. ALthough the app compile succesfully but when i run it in genymotion it just shows the prompt with text "Unfortunately "APP" has stopped."
The Error log shows.
01-12 08:16:04.867 2073-2073/com.technoserves.crudnew D/dalvikvm﹕ Late-enabling CheckJNI
01-12 08:16:06.107 2073-2073/com.technoserves.crudnew W/dalvikvm﹕ Unable to resolve superclass of Lcom/technoserves/crudnew/CordovaApp; (14)
01-12 08:16:06.119 2073-2073/com.technoserves.crudnew W/dalvikvm﹕ Link of class 'Lcom/technoserves/crudnew/CordovaApp;' failed
01-12 08:16:06.135 2073-2073/com.technoserves.crudnew D/AndroidRuntime﹕ Shutting down VM
01-12 08:16:06.135 2073-2073/com.technoserves.crudnew W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0xa6142908)
01-12 08:16:06.155 2073-2073/com.technoserves.crudnew E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.technoserves.crudnew/com.technoserves.crudnew.CordovaApp}: java.lang.ClassNotFoundException: Didn't find class "com.technoserves.crudnew.CordovaApp" on path: /data/app/com.technoserves.crudnew-1.apk
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.technoserves.crudnew.CordovaApp" on path: /data/app/com.technoserves.crudnew-1.apk
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
01-12 08:16:22.399 2073-2073/com.technoserves.crudnew I/Process﹕ Sending signal. PID: 2073 SIG: 9
I have updated my cordova to resolve but still same error however a few days ago it was working fine and i have build some apps.
First download Cordova jar file from following link:
http://www.java2s.com/Code/JarDownload/cordova/cordova-1.8.1.jar.zip
after that extract the folder and put cordova-1.8.1 inside your libs folder of project in eclipse
And right click on your project--> properties and Select Android from left pane and scroll to bottom remove the cordova library if added.
then clean and build your project.
Ok, so I've got my Android application and it wont boot with a "unable to instantiate activity ComponentInfo{}" error, basically theres something wrong in my manifest file that won't let the application launch the first activity. I made a new but essentially duplicated project (manually copying across the Java+XML code for Main, second + third 'tester' activities, and of course Strings). I left the manifest of the new project as it is but added the activity lines for the tester. I wanted everything as stock basically so nothing could go wrong, and nothing did, the application loaded on emulator and my phone alright.
So I copy the new manifest to my old project in an effort to 'default' it, and I copy and pasted the tester activity code that was already there and worked, for the other 3 activity's. Suddenly it doesn't want to work. Everything is there, but what's the problem? (note the icon drawable is changed but that's nothing to do with it). All the activity names match up to package names and whatnot. Could this be a bug? I honestly cannot find anything wrong.
Duplicate (+ working) code
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/logo3"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.ollygrov.bakerspride.Main"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.ollygrov.bakerspride.Cal"
android:label="#string/title_activity_cal" >
</activity>
<activity
android:name="com.ollygrov.bakerspride.Breads"
android:label="#string/title_activity_breads" >
</activity>
</application>
Old (+ not working) code
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.ollygrov.bakerspride.Main"
android:label="#string/app_title" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.ollygrov.bakerspride.Cal"
android:label="#string/title_activity_cal" >
</activity>
<activity
android:name="com.ollygrov.bakerspride.Breads"
android:label="#string/title_activity_breads" >
</activity>
<activity
android:name="com.ollygrov.bakerspride.Gal"
android:label="#string/title_activity_gal" >
</activity>
<activity
android:name="com.ollygrov.bakerspride.Tut"
android:label="#string/title_activity_tut" >
</activity>
<activity
android:name="com.ollygrov.bakerspride.Rec"
android:label="#string/title_activity_rec" >
</activity>
</application>
EDIT: I just copied and pasted the codes into the search bar on Chrome (changing the droid:icon and droid:label to fit) and they are exactly the same!! What?! Am I not allowed to have 6 activities or something?
Errors:
09-04 11:33:04.895: E/AndroidRuntime(717): FATAL EXCEPTION: main
09-04 11:33:04.895: E/AndroidRuntime(717): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.ollygrov.bakerspride/com.ollygrov.bakerspride.Main}: java.lang.NullPointerException
09-04 11:33:04.895: E/AndroidRuntime(717): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1983)
09-04 11:33:04.895: E/AndroidRuntime(717): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
09-04 11:33:04.895: E/AndroidRuntime(717): at android.app.ActivityThread.access$600(ActivityThread.java:130)
09-04 11:33:04.895: E/AndroidRuntime(717): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
09-04 11:33:04.895: E/AndroidRuntime(717): at android.os.Handler.dispatchMessage(Handler.java:99)
09-04 11:33:04.895: E/AndroidRuntime(717): at android.os.Looper.loop(Looper.java:137)
09-04 11:33:04.895: E/AndroidRuntime(717): at android.app.ActivityThread.main(ActivityThread.java:4745)
09-04 11:33:04.895: E/AndroidRuntime(717): at java.lang.reflect.Method.invokeNative(Native Method)
09-04 11:33:04.895: E/AndroidRuntime(717): at java.lang.reflect.Method.invoke(Method.java:511)
09-04 11:33:04.895: E/AndroidRuntime(717): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
09-04 11:33:04.895: E/AndroidRuntime(717): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-04 11:33:04.895: E/AndroidRuntime(717): at dalvik.system.NativeStart.main(Native Method)
09-04 11:33:04.895: E/AndroidRuntime(717): Caused by: java.lang.NullPointerException
09-04 11:33:04.895: E/AndroidRuntime(717): at android.app.Activity.findViewById(Activity.java:1825)
09-04 11:33:04.895: E/AndroidRuntime(717): at com.ollygrov.bakerspride.Main.<init>(Main.java:19)
09-04 11:33:04.895: E/AndroidRuntime(717): at java.lang.Class.newInstanceImpl(Native Method)
09-04 11:33:04.895: E/AndroidRuntime(717): at java.lang.Class.newInstance(Class.java:1319)
09-04 11:33:04.895: E/AndroidRuntime(717): at android.app.Instrumentation.newActivity(Instrumentation.java:1053)
09-04 11:33:04.895: E/AndroidRuntime(717): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1974)
09-04 11:33:04.895: E/AndroidRuntime(717): ... 11 more
09-04 11:34:58.665: E/Trace(765): error opening trace file: No such file or directory (2)
09-04 11:34:59.095: D/AndroidRuntime(765): Shutting down VM
09-04 11:34:59.095: W/dalvikvm(765): threadid=1: thread exiting with uncaught exception (group=0x40a13300)
09-04 11:34:59.114: E/AndroidRuntime(765): FATAL EXCEPTION: main
09-04 11:34:59.114: E/AndroidRuntime(765): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.ollygrov.bakerspride/com.ollygrov.bakerspride.Main}: java.lang.NullPointerException
09-04 11:34:59.114: E/AndroidRuntime(765): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1983)
09-04 11:34:59.114: E/AndroidRuntime(765): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
09-04 11:34:59.114: E/AndroidRuntime(765): at android.app.ActivityThread.access$600(ActivityThread.java:130)
09-04 11:34:59.114: E/AndroidRuntime(765): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
09-04 11:34:59.114: E/AndroidRuntime(765): at android.os.Handler.dispatchMessage(Handler.java:99)
09-04 11:34:59.114: E/AndroidRuntime(765): at android.os.Looper.loop(Looper.java:137)
09-04 11:34:59.114: E/AndroidRuntime(765): at android.app.ActivityThread.main(ActivityThread.java:4745)
09-04 11:34:59.114: E/AndroidRuntime(765): at java.lang.reflect.Method.invokeNative(Native Method)
09-04 11:34:59.114: E/AndroidRuntime(765): at java.lang.reflect.Method.invoke(Method.java:511)
09-04 11:34:59.114: E/AndroidRuntime(765): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
09-04 11:34:59.114: E/AndroidRuntime(765): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-04 11:34:59.114: E/AndroidRuntime(765): at dalvik.system.NativeStart.main(Native Method)
09-04 11:34:59.114: E/AndroidRuntime(765): Caused by: java.lang.NullPointerException
09-04 11:34:59.114: E/AndroidRuntime(765): at android.app.Activity.findViewById(Activity.java:1825)
09-04 11:34:59.114: E/AndroidRuntime(765): at com.ollygrov.bakerspride.Main.<init>(Main.java:19)
09-04 11:34:59.114: E/AndroidRuntime(765): at java.lang.Class.newInstanceImpl(Native Method)
09-04 11:34:59.114: E/AndroidRuntime(765): at java.lang.Class.newInstance(Class.java:1319)
09-04 11:34:59.114: E/AndroidRuntime(765): at android.app.Instrumentation.newActivity(Instrumentation.java:1053)
09-04 11:34:59.114: E/AndroidRuntime(765): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1974)
The problem is your Main Constructor:
09-04 11:33:04.895: E/AndroidRuntime(717): Caused by: java.lang.NullPointerException
09-04 11:33:04.895: E/AndroidRuntime(717): at android.app.Activity.findViewById(Activity.java:1825)
09-04 11:33:04.895: E/AndroidRuntime(717): at com.ollygrov.bakerspride.Main.<init>(Main.java:19)
In line 19 of Main.java you are trying to call findViewById() which will obviously not work. It is way to early to call such code in the constructor.
My best guess is, that you need to move EVERYTHING from the cronstructor to onCreate() of the Activity.
Normally you don't need a custom constructor in Activities or Fragments.
What does this error mean? I'm having this error at runtime. The app crashes when I try to launch. I am new at Android programming.
I have tried to look through the code and I couldn't find it. I would appreciate your help.
02-07 14:32:57.967: E/Trace(943): error opening trace file: No such file or directory (2)
02-07 14:32:58.386: E/AndroidRuntime(943): FATAL EXCEPTION: main
02-07 14:32:58.386: E/AndroidRuntime(943): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.quiz/com.example.quiz.Splash}: java.lang.ClassNotFoundException: Didn't find class "com.example.quiz.Splash" on path: /data/app/com.example.quiz-2.apk
02-07 14:32:58.386: E/AndroidRuntime(943): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
02-07 14:32:58.386: E/AndroidRuntime(943): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
02-07 14:32:58.386: E/AndroidRuntime(943): at android.app.ActivityThread.access$600(ActivityThread.java:141)
02-07 14:32:58.386: E/AndroidRuntime(943): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
02-07 14:32:58.386: E/AndroidRuntime(943): at android.os.Handler.dispatchMessage(Handler.java:99)
02-07 14:32:58.386: E/AndroidRuntime(943): at android.os.Looper.loop(Looper.java:137)
02-07 14:32:58.386: E/AndroidRuntime(943): at android.app.ActivityThread.main(ActivityThread.java:5039)
02-07 14:32:58.386: E/AndroidRuntime(943): at java.lang.reflect.Method.invokeNative(Native Method)
02-07 14:32:58.386: E/AndroidRuntime(943): at java.lang.reflect.Method.invoke(Method.java:511)
02-07 14:32:58.386: E/AndroidRuntime(943): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
02-07 14:32:58.386: E/AndroidRuntime(943): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
02-07 14:32:58.386: E/AndroidRuntime(943): at dalvik.system.NativeStart.main(Native Method)
02-07 14:32:58.386: E/AndroidRuntime(943): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.quiz.Splash" on path: /data/app/com.example.quiz-2.apk
02-07 14:32:58.386: E/AndroidRuntime(943): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
02-07 14:32:58.386: E/AndroidRuntime(943): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
02-07 14:32:58.386: E/AndroidRuntime(943): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
02-07 14:32:58.386: E/AndroidRuntime(943): at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
02-07 14:32:58.386: E/AndroidRuntime(943): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
02-07 14:32:58.386: E/AndroidRuntime(943): ... 11 more
First of all, check if your source is where it is mentioned in the error log.
If it is, check if you've made any typing mistakes
If it still isn't working, it would be easier (In my opinion) to create a new project and rename what is missing (I've done this several times already and it has always worked) Of course, make sure you copy all of your code
It looks like you've missed out your Splash activity in your manifest.
<activity android:name=".Splash"/>
See if that line appears in your manifest, if not you should add it.
I have set up a socket connection between two droids, and I can send data back and forth with no problem. However, in the server side I have set up a ContentObserver to be notified when there is a change to the contacts.
I get the notification, but when I try to send a message to the client that the contacts have changed, I get a fatal exception. The content observer code is
public class ContactWatcher extends ContentObserver {
public ContactWatcher( Handler h )
{
super( h );
}
public void onChange(boolean selfChange)
{
if(!ConnectionManager.devices[0].matches("Null"))
{
ConnectionManager.sendMessage(MessageNames.CONTACT_UPDATE, 0);
}
}
I get to the sendMessage code, but when it tries to write to the socket the program crashes with the LogCat output
09-04 16:00:50.880: ERROR/AndroidRuntime(958): FATAL EXCEPTION: main
09-04 16:00:50.880: ERROR/AndroidRuntime(958): android.os.NetworkOnMainThreadException
09-04 16:00:50.880: ERROR/AndroidRuntime(958): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1077)
09-04 16:00:50.880: ERROR/AndroidRuntime(958): at dalvik.system.BlockGuard$WrappedNetworkSystem.write(BlockGuard.java:290)
09-04 16:00:50.880: ERROR/AndroidRuntime(958): at org.apache.harmony.luni.net.PlainSocketImpl.write(PlainSocketImpl.java:462)
09-04 16:00:50.880: ERROR/AndroidRuntime(958): at org.apache.harmony.luni.net.SocketOutputStream.write(SocketOutputStream.java:55)
09-04 16:00:50.880: ERROR/AndroidRuntime(958): at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:165)
09-04 16:00:50.880: ERROR/AndroidRuntime(958): at java.io.BufferedWriter.flush(BufferedWriter.java:129)
09-04 16:00:50.880: ERROR/AndroidRuntime(958): at java.io.PrintWriter.flush(PrintWriter.java:270)
09-04 16:00:50.880: ERROR/AndroidRuntime(958): at java.io.PrintWriter.println(PrintWriter.java:491)
09-04 16:00:50.880: ERROR/AndroidRuntime(958): at java.io.PrintWriter.println(PrintWriter.java:603)
09-04 16:00:50.880: ERROR/AndroidRuntime(958): at com.gigaset.homepanel.ConnectionManager.sendMessage(ConnectionManager.java:151)
09-04 16:00:50.880: ERROR/AndroidRuntime(958): at com.gigaset.homepanel.ContactWatcher.onChange(ContactWatcher.java:19)
09-04 16:00:50.880: ERROR/AndroidRuntime(958): at android.database.ContentObserver$NotificationRunnable.run(ContentObserver.java:43)
09-04 16:00:50.880: ERROR/AndroidRuntime(958): at android.os.Handler.handleCallback(Handler.java:587)
09-04 16:00:50.880: ERROR/AndroidRuntime(958): at android.os.Handler.dispatchMessage(Handler.java:92)
09-04 16:00:50.880: ERROR/AndroidRuntime(958): at android.os.Looper.loop(Looper.java:132)
09-04 16:00:50.880: ERROR/AndroidRuntime(958): at android.app.ActivityThread.main(ActivityThread.java:4025)
09-04 16:00:50.880: ERROR/AndroidRuntime(958): at java.lang.reflect.Method.invokeNative(Native Method)
09-04 16:00:50.880: ERROR/AndroidRuntime(958): at java.lang.reflect.Method.invoke(Method.java:491)
09-04 16:00:50.880: ERROR/AndroidRuntime(958): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
09-04 16:00:50.880: ERROR/AndroidRuntime(958): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
09-04 16:00:50.880: ERROR/AndroidRuntime(958): at dalvik.system.NativeStart.main(Native Method)
The Android SDK documentation for the NetworkOnMainThreadException class is pretty clear and easy to understand. It states that it is thrown on Honeycomb when you try to perform a network operation on the main UI thread.
The fix is of course to run the network operation in a background thread. You can associate the ContentObserver with a different thread by passing a handler for that thread when you construct the ContentObserver.
Alternately, you could directly spawn a new thread, or post a runnable to a handler on a different thread.
If you really want to run the network operation on the main thread, you should be able to disable that exception via the StrictMode apis (not recommended)