Here's the error message I'm getting: E/AndroidRuntime(416): java.lang.RuntimeException: Unable to start activity ComponentInfo java.lang.IllegalArgumentException. I took out the app file name/package name, but everything else is there. The app is designed to target the Gingerbread, but has a minimum SDK level for the Froyo. I'm basically get an AVR message when I try and launch the app on the AVD. The source code is ~460 lines long, so I'm not sure where the error is (there are no syntax errors, so I'm not sure what I'm doing wrong). Here's the pastebin URL for the source code that I've put up: http://pastebin.com/EtUP2CAB. I've seen some stuff about DecimalFormatSymbols and the SensorSimulator, etc., but I'm still confused. Hence, I'd appreciate some help with locating the issue here causing this error.
EDIT: Here's the error log for the last run I did:
02-03 20:51:21.724: D/AndroidRuntime(468): Shutting down VM
02-03 20:51:21.724: W/dalvikvm(468): threadid=1: thread exiting with uncaught exception (group=0x40015560)
02-03 20:51:21.784: E/AndroidRuntime(468): FATAL EXCEPTION: main
02-03 20:51:21.784: E/AndroidRuntime(468): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.deitel.flagquizgame/com.deitel.flagquizgame.FlagQuizGame}: java.lang.IllegalArgumentException
02-03 20:51:21.784: E/AndroidRuntime(468): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
02-03 20:51:21.784: E/AndroidRuntime(468): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
02-03 20:51:21.784: E/AndroidRuntime(468): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
02-03 20:51:21.784: E/AndroidRuntime(468): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
02-03 20:51:21.784: E/AndroidRuntime(468): at android.os.Handler.dispatchMessage(Handler.java:99)
02-03 20:51:21.784: E/AndroidRuntime(468): at android.os.Looper.loop(Looper.java:123)
02-03 20:51:21.784: E/AndroidRuntime(468): at android.app.ActivityThread.main(ActivityThread.java:3683)
02-03 20:51:21.784: E/AndroidRuntime(468): at java.lang.reflect.Method.invokeNative(Native Method)
02-03 20:51:21.784: E/AndroidRuntime(468): at java.lang.reflect.Method.invoke(Method.java:507)
02-03 20:51:21.784: E/AndroidRuntime(468): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
02-03 20:51:21.784: E/AndroidRuntime(468): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
02-03 20:51:21.784: E/AndroidRuntime(468): at dalvik.system.NativeStart.main(Native Method)
02-03 20:51:21.784: E/AndroidRuntime(468): Caused by: java.lang.IllegalArgumentException
02-03 20:51:21.784: E/AndroidRuntime(468): at java.util.Random.nextInt(Random.java:186)
02-03 20:51:21.784: E/AndroidRuntime(468): at com.deitel.flagquizgame.FlagQuizGame.resetQuiz(FlagQuizGame.java:136)
02-03 20:51:21.784: E/AndroidRuntime(468): at com.deitel.flagquizgame.FlagQuizGame.onCreate(FlagQuizGame.java:92)
02-03 20:51:21.784: E/AndroidRuntime(468): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
02-03 20:51:21.784: E/AndroidRuntime(468): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
02-03 20:51:21.784: E/AndroidRuntime(468): ... 11 more
02-03 20:51:27.464: I/Process(468): Sending signal. PID: 468 SIG: 9
seems in line
int randomIndex = random.nextInt(numberOfFlags);
numberOfFlags are not positive number, its 0 or less than 0, check numberOfFlags value by debugging.
Related
I don't know why the app crashes whenever it's supposed to go to the next Activity. I made a practice app that works as it should when using the same format. I uploaded the files to gist.github.
The error is
1216-1216/com.example.chiozokamalu.newfreshstart E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.ArrayIndexOutOfBoundsException
at com.example.chiozokamalu.newfreshstart.MainActivity.onClick(MainActivity.java:164)
at android.view.View.performClick(View.java:2485)
at android.view.View$PerformClick.run(View.java:9080)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3683)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)
On line 164 of MainActivity.java:
questionView.setText(questions[questionIndex]); // set the text to the next question
EDIT: After Varun helped me, I get a new error which is
1307-1307/com.example.chiozokamalu.newfreshstart E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.chiozokamalu.newfreshstart/com.example.chiozokamalu.newfreshstart.Results1}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
at android.app.ActivityThread.access$1500(ActivityThread.java:117)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3683)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.example.chiozokamalu.newfreshstart.Results1.onCreate(Results1.java:58)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
at android.app.ActivityThread.access$1500(ActivityThread.java:117)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3683)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)
The questions array at line no. 164 is going out of bound that means questionIndex is greater than the total length of the questions array. So you should add a check on the length before extracting value from the array.
You have added the check but after that you incremented the value so either you modify the if condition to if (questionIndex < questions.length -1)
or modify the questionIndex variable before the if condition
You are getting problem because you haven't initiated resultView9 that is why it is null and giving nullpointer, just initiatlise it as you done with other and everything is fine. You have initialised the resultView8 twice just add resultview9 over there
I am using cordova 3.6 and android 4.4 and i used a simple example for opening a camera or choose picture from gallery but on every success callback for camera getting below error
02-03 16:39:04.279: E/AndroidRuntime(3403): FATAL EXCEPTION: main
02-03 16:39:04.279: E/AndroidRuntime(3403): java.lang.RuntimeException: Unable to resume activity {com.CameraOptionApp/com.CameraOptionApp.CameraOptionApp}: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=18, result=-1, data=Intent { dat=content://media/external/images/media/5027 }} to activity {com.CameraOptionApp/com.CameraOptionApp.CameraOptionApp}: java.lang.NullPointerException
02-03 16:39:04.279: E/AndroidRuntime(3403): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2732)
02-03 16:39:04.279: E/AndroidRuntime(3403): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2760)
02-03 16:39:04.279: E/AndroidRuntime(3403): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2216)
02-03 16:39:04.279: E/AndroidRuntime(3403): at android.app.ActivityThread.access$600(ActivityThread.java:149)
02-03 16:39:04.279: E/AndroidRuntime(3403): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1300)
02-03 16:39:04.279: E/AndroidRuntime(3403): at android.os.Handler.dispatchMessage(Handler.java:99)
02-03 16:39:04.279: E/AndroidRuntime(3403): at android.os.Looper.loop(Looper.java:153)
02-03 16:39:04.279: E/AndroidRuntime(3403): at android.app.ActivityThread.main(ActivityThread.java:5086)
02-03 16:39:04.279: E/AndroidRuntime(3403): at java.lang.reflect.Method.invokeNative(Native Method)
02-03 16:39:04.279: E/AndroidRuntime(3403): at java.lang.reflect.Method.invoke(Method.java:511)
02-03 16:39:04.279: E/AndroidRuntime(3403): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:821)
02-03 16:39:04.279: E/AndroidRuntime(3403): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
02-03 16:39:04.279: E/AndroidRuntime(3403): at dalvik.system.NativeStart.main(Native Method)
02-03 16:39:04.279: E/AndroidRuntime(3403): Caused by: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=18, result=-1, data=Intent { dat=content://media/external/images/media/5027 }} to activity {com.CameraOptionApp/com.CameraOptionApp.CameraOptionApp}: java.lang.NullPointerException
02-03 16:39:04.279: E/AndroidRuntime(3403): at android.app.ActivityThread.deliverResults(ActivityThread.java:3302)
02-03 16:39:04.279: E/AndroidRuntime(3403): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2715)
02-03 16:39:04.279: E/AndroidRuntime(3403): ... 12 more
02-03 16:39:04.279: E/AndroidRuntime(3403): Caused by: java.lang.NullPointerException
02-03 16:39:04.279: E/AndroidRuntime(3403): at org.apache.cordova.CordovaActivity.onActivityResult(CordovaActivity.java:779)
02-03 16:39:04.279: E/AndroidRuntime(3403): at android.app.Activity.dispatchActivityResult(Activity.java:5204)
02-03 16:39:04.279: E/AndroidRuntime(3403): at android.app.ActivityThread.deliverResults(ActivityThread.java:3298)
02-03 16:39:04.279: E/AndroidRuntime(3403): ... 13 more
02-03 16:39:04.287: E/com.worklight.common.Logger$UncaughtExceptionHandler(3403): Logger$UncaughtExceptionHandler.uncaughtException in Logger.java:438 :: Uncaught Exception
02-03 16:39:04.287: E/com.worklight.common.Logger$UncaughtExceptionHandler(3403): java.lang.RuntimeException: Unable to resume activity {com.CameraOptionApp/com.CameraOptionApp.CameraOptionApp}: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=18, result=-1, data=Intent { dat=content://media/external/images/media/5027 }} to activity {com.CameraOptionApp/com.CameraOptionApp.CameraOptionApp}: java.lang.NullPointerException
02-03 16:39:04.287: E/com.worklight.common.Logger$UncaughtExceptionHandler(3403): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2732)
02-03 16:39:04.287: E/com.worklight.common.Logger$UncaughtExceptionHandler(3403): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2760)
02-03 16:39:04.287: E/com.worklight.common.Logger$UncaughtExceptionHandler(3403): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2216)
02-03 16:39:04.287: E/com.worklight.common.Logger$UncaughtExceptionHandler(3403): at android.app.ActivityThread.access$600(ActivityThread.java:149)
02-03 16:39:04.287: E/com.worklight.common.Logger$UncaughtExceptionHandler(3403): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1300)
02-03 16:39:04.287: E/com.worklight.common.Logger$UncaughtExceptionHandler(3403): at android.os.Handler.dispatchMessage(Handler.java:99)
02-03 16:39:04.287: E/com.worklight.common.Logger$UncaughtExceptionHandler(3403): at android.os.Looper.loop(Looper.java:153)
02-03 16:39:04.287: E/com.worklight.common.Logger$UncaughtExceptionHandler(3403): at android.app.ActivityThread.main(ActivityThread.java:5086)
02-03 16:39:04.287: E/com.worklight.common.Logger$UncaughtExceptionHandler(3403): at java.lang.reflect.Method.invokeNative(Native Method)
02-03 16:39:04.287: E/com.worklight.common.Logger$UncaughtExceptionHandler(3403): at java.lang.reflect.Method.invoke(Method.java:511)
02-03 16:39:04.287: E/com.worklight.common.Logger$UncaughtExceptionHandler(3403): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:821)
02-03 16:39:04.287: E/com.worklight.common.Logger$UncaughtExceptionHandler(3403): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
02-03 16:39:04.287: E/com.worklight.common.Logger$UncaughtExceptionHandler(3403): at dalvik.system.NativeStart.main(Native Method)
02-03 16:39:04.287: E/com.worklight.common.Logger$UncaughtExceptionHandler(3403): Caused by: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=18, result=-1, data=Intent { dat=content://media/external/images/media/5027 }} to activity {com.CameraOptionApp/com.CameraOptionApp.CameraOptionApp}: java.lang.NullPointerException
02-03 16:39:04.287: E/com.worklight.common.Logger$UncaughtExceptionHandler(3403): at android.app.ActivityThread.deliverResults(ActivityThread.java:3302)
02-03 16:39:04.287: E/com.worklight.common.Logger$UncaughtExceptionHandler(3403): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2715)
02-03 16:39:04.287: E/com.worklight.common.Logger$UncaughtExceptionHandler(3403): ... 12 more
02-03 16:39:04.287: E/com.worklight.common.Logger$UncaughtExceptionHandler(3403): Caused by: java.lang.NullPointerException
02-03 16:39:04.287: E/com.worklight.common.Logger$UncaughtExceptionHandler(3403): at org.apache.cordova.CordovaActivity.onActivityResult(CordovaActivity.java:779)
02-03 16:39:04.287: E/com.worklight.common.Logger$UncaughtExceptionHandler(3403): at android.app.Activity.dispatchActivityResult(Activity.java:5204)
02-03 16:39:04.287: E/com.worklight.common.Logger$UncaughtExceptionHandler(3403): at android.app.ActivityThread.deliverResults(ActivityThread.java:3298)
02-03 16:39:04.287: E/com.worklight.common.Logger$UncaughtExceptionHandler(3403): ... 13 more
02-03 16:39:04.291: D/wl(3403): WL.doPrepareAssetsWork in WL.java:287 :: no need to check web resource integrity
I tried on different machine also but having same issue.
I don't know how to figure out where an uncaught exception is coming from. I have looked through the stackoverflow posts and tried looking for several of the solutions. As far as I can tell, I have my activity, "Monitor", listed in my manifest and it is part of the package. But I get a null pointer exception when I start the "Monitor" activity. What should I be looking for to find this exception?
02-03 21:44:14.192: E/Trace(19701): error opening trace file: No such file or directory (2)
02-03 21:44:14.262: I/BugSenseHandler(19701): Registering default exceptions handler
02-03 21:44:14.633: I/Setup(19701): Setup activity created
02-03 21:44:14.813: I/BugSenseHandler(19701): Flushing...
02-03 21:44:14.823: I/BugSenseHandler(19701): Registering default exceptions handler
02-03 21:44:15.023: W/BugSenseHandler(19701): Transmitting ping Exception No peer certificate
02-03 21:44:15.403: I/Adreno200-EGLSUB(19701): <ConfigWindowMatch:2087>: Format RGBA_8888.
02-03 21:44:15.594: E/(19701): <s3dReadConfigFile:75>: Can't open file for reading
02-03 21:44:15.594: E/(19701): <s3dReadConfigFile:75>: Can't open file for reading
02-03 21:44:19.318: W/dalvikvm(19701): threadid=1: thread exiting with uncaught exception (group=0x41bfb438)
02-03 21:44:22.401: E/AndroidRuntime(19701): FATAL EXCEPTION: main
02-03 21:44:22.401: E/AndroidRuntime(19701): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.mpeterson.sousvide/com.mpeterson.sousvide.Monitor}: java.lang.NullPointerException
02-03 21:44:22.401: E/AndroidRuntime(19701): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2024)
02-03 21:44:22.401: E/AndroidRuntime(19701): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2132)
02-03 21:44:22.401: E/AndroidRuntime(19701): at android.app.ActivityThread.access$600(ActivityThread.java:139)
02-03 21:44:22.401: E/AndroidRuntime(19701): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1231)
02-03 21:44:22.401: E/AndroidRuntime(19701): at android.os.Handler.dispatchMessage(Handler.java:99)
02-03 21:44:22.401: E/AndroidRuntime(19701): at android.os.Looper.loop(Looper.java:137)
02-03 21:44:22.401: E/AndroidRuntime(19701): at android.app.ActivityThread.main(ActivityThread.java:5021)
02-03 21:44:22.401: E/AndroidRuntime(19701): at java.lang.reflect.Method.invokeNative(Native Method)
02-03 21:44:22.401: E/AndroidRuntime(19701): at java.lang.reflect.Method.invoke(Method.java:511)
02-03 21:44:22.401: E/AndroidRuntime(19701): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
02-03 21:44:22.401: E/AndroidRuntime(19701): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
02-03 21:44:22.401: E/AndroidRuntime(19701): at dalvik.system.NativeStart.main(Native Method)
02-03 21:44:22.401: E/AndroidRuntime(19701): Caused by: java.lang.NullPointerException
02-03 21:44:22.401: E/AndroidRuntime(19701): at android.app.Activity.findViewById(Activity.java:1851)
02-03 21:44:22.401: E/AndroidRuntime(19701): at com.mpeterson.sousvide.Monitor.<init>(Monitor.java:51)
02-03 21:44:22.401: E/AndroidRuntime(19701): at java.lang.Class.newInstanceImpl(Native Method)
02-03 21:44:22.401: E/AndroidRuntime(19701): at java.lang.Class.newInstance(Class.java:1319)
02-03 21:44:22.401: E/AndroidRuntime(19701): at android.app.Instrumentation.newActivity(Instrumentation.java:1053)
02-03 21:44:22.401: E/AndroidRuntime(19701): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2015)
02-03 21:44:22.401: E/AndroidRuntime(19701): ... 11 more
Provided that you have editTextCurTemp defined as TextView in your_layout_file.xml, you must call
setContentView(R.layout.your_layout_file)
BEFORE you do any findViewById(), otherwise you will get NPE.
I have searched the internet for days and have found dozens of solutions none of which work. So I thought I'd post my situation:
I have installed eclipse and the 2.3.3 android SDK onto my laptop, put the code in for hello world (or hello android) and clicked run. The emulator starts but when the activity is run I get the message "SORRY! the application Hello Android (process com.example helloandroid) has stopped unexpectedly. Please try again"
package com.example.helloandroid;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class HelloAndroid extends Activity {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView tv = new TextView(this);
tv.setText("Hello, Android");
setContentView(tv);
}
}
and this is log cat
02-03 12:54:59.470: D/AndroidRuntime(356): Shutting down VM
02-03 12:54:59.470: W/dalvikvm(356): threadid=1: thread exiting with uncaught exception (group=0x40015560)
02-03 12:54:59.521: E/AndroidRuntime(356): FATAL EXCEPTION: main
02-03 12:54:59.521: E/AndroidRuntime(356): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.helloandroid/com.example.helloandroid.HelloAndroidActivity}: java.lang.ClassNotFoundException: com.example.helloandroid.HelloAndroidActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.helloandroid-1.apk]
02-03 12:54:59.521: E/AndroidRuntime(356): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1569)
02-03 12:54:59.521: E/AndroidRuntime(356): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
02-03 12:54:59.521: E/AndroidRuntime(356): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
02-03 12:54:59.521: E/AndroidRuntime(356): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
02-03 12:54:59.521: E/AndroidRuntime(356): at android.os.Handler.dispatchMessage(Handler.java:99)
02-03 12:54:59.521: E/AndroidRuntime(356): at android.os.Looper.loop(Looper.java:123)
02-03 12:54:59.521: E/AndroidRuntime(356): at android.app.ActivityThread.main(ActivityThread.java:3683)
02-03 12:54:59.521: E/AndroidRuntime(356): at java.lang.reflect.Method.invokeNative(Native Method)
02-03 12:54:59.521: E/AndroidRuntime(356): at java.lang.reflect.Method.invoke(Method.java:507)
02-03 12:54:59.521: E/AndroidRuntime(356): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
02-03 12:54:59.521: E/AndroidRuntime(356): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
02-03 12:54:59.521: E/AndroidRuntime(356): at dalvik.system.NativeStart.main(Native Method)
02-03 12:54:59.521: E/AndroidRuntime(356): Caused by: java.lang.ClassNotFoundException: com.example.helloandroid.HelloAndroidActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.helloandroid-1.apk]
02-03 12:54:59.521: E/AndroidRuntime(356): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
02-03 12:54:59.521: E/AndroidRuntime(356): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
02-03 12:54:59.521: E/AndroidRuntime(356): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
02-03 12:54:59.521: E/AndroidRuntime(356): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
02-03 12:54:59.521: E/AndroidRuntime(356): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)
02-03 12:54:59.521: E/AndroidRuntime(356): ... 11 more
02-03 12:59:59.691: I/Process(356): Sending signal. PID: 356 SIG: 9
02-03 13:00:33.371: D/AndroidRuntime(366): Shutting down VM
02-03 13:00:33.371: W/dalvikvm(366): threadid=1: thread exiting with uncaught exception (group=0x40015560)
02-03 13:00:33.431: E/AndroidRuntime(366): FATAL EXCEPTION: main
02-03 13:00:33.431: E/AndroidRuntime(366): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.helloandroid/com.example.helloandroid.HelloAndroidActivity}: java.lang.ClassNotFoundException: com.example.helloandroid.HelloAndroidActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.helloandroid-1.apk]
02-03 13:00:33.431: E/AndroidRuntime(366): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1569)
02-03 13:00:33.431: E/AndroidRuntime(366): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
02-03 13:00:33.431: E/AndroidRuntime(366): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
02-03 13:00:33.431: E/AndroidRuntime(366): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
02-03 13:00:33.431: E/AndroidRuntime(366): at android.os.Handler.dispatchMessage(Handler.java:99)
02-03 13:00:33.431: E/AndroidRuntime(366): at android.os.Looper.loop(Looper.java:123)
02-03 13:00:33.431: E/AndroidRuntime(366): at android.app.ActivityThread.main(ActivityThread.java:3683)
02-03 13:00:33.431: E/AndroidRuntime(366): at java.lang.reflect.Method.invokeNative(Native Method)
02-03 13:00:33.431: E/AndroidRuntime(366): at java.lang.reflect.Method.invoke(Method.java:507)
02-03 13:00:33.431: E/AndroidRuntime(366): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
02-03 13:00:33.431: E/AndroidRuntime(366): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
02-03 13:00:33.431: E/AndroidRuntime(366): at dalvik.system.NativeStart.main(Native Method)
02-03 13:00:33.431: E/AndroidRuntime(366): Caused by: java.lang.ClassNotFoundException: com.example.helloandroid.HelloAndroidActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.helloandroid-1.apk]
02-03 13:00:33.431: E/AndroidRuntime(366): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
02-03 13:00:33.431: E/AndroidRuntime(366): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
02-03 13:00:33.431: E/AndroidRuntime(366): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
02-03 13:00:33.431: E/AndroidRuntime(366): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
02-03 13:00:33.431: E/AndroidRuntime(366): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)
02-03 13:00:33.431: E/AndroidRuntime(366): ... 11 more
02-03 13:05:33.600: I/Process(366): Sending signal. PID: 366 SIG: 9
It seems to be something wrong with the way your emulator is set up. Did you follow this tutorial especially the "Setting up the AVD" part?
I would start the install of the emulator all over again. Also you could send him a copy of your program and if he can successfully run your project in the emulator then you know you just need to get your emulator set up correctly.
try moving your setContentView() method above your textview initialization
I have developed project in android3.1 and i am trying to run in android2.1 emulator . I have added android-support-v4.jar and specified
in manifest file .can anybody tell what is problem how to solve?
02-03 15:06:08.623: E/AndroidRuntime(223): Uncaught handler: thread main exiting due to uncaught exception
02-03 15:06:08.641: E/AndroidRuntime(223): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.test.fragment/com.test.fragment.FragmentTestWebActivity}: android.view.InflateException: Binary XML file line #13: Error inflating class fragment
02-03 15:06:08.641: E/AndroidRuntime(223): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
02-03 15:06:08.641: E/AndroidRuntime(223): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
02-03 15:06:08.641: E/AndroidRuntime(223): at android.app.ActivityThread.access$2200(ActivityThread.java:119)
02-03 15:06:08.641: E/AndroidRuntime(223): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
02-03 15:06:08.641: E/AndroidRuntime(223): at android.os.Handler.dispatchMessage(Handler.java:99)
02-03 15:06:08.641: E/AndroidRuntime(223): at android.os.Looper.loop(Looper.java:123)
02-03 15:06:08.641: E/AndroidRuntime(223): at android.app.ActivityThread.main(ActivityThread.java:4363)
02-03 15:06:08.641: E/AndroidRuntime(223): at java.lang.reflect.Method.invokeNative(Native Method)
02-03 15:06:08.641: E/AndroidRuntime(223): at java.lang.reflect.Method.invoke(Method.java:521)
02-03 15:06:08.641: E/AndroidRuntime(223): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
02-03 15:06:08.641: E/AndroidRuntime(223): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
02-03 15:06:08.641: E/AndroidRuntime(223): at dalvik.system.NativeStart.main(Native Method)
02-03 15:06:08.641: E/AndroidRuntime(223): Caused by: android.view.InflateException: Binary XML file line #13: Error inflating class fragment
02-03 15:06:08.641: E/AndroidRuntime(223): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:576)
02-03 15:06:08.641: E/AndroidRuntime(223): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
02-03 15:06:08.641: E/AndroidRuntime(223): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
02-03 15:06:08.641: E/AndroidRuntime(223): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
02-03 15:06:08.641: E/AndroidRuntime(223): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
02-03 15:06:08.641: E/AndroidRuntime(223): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
02-03 15:06:08.641: E/AndroidRuntime(223): at android.app.Activity.setContentView(Activity.java:1622)
02-03 15:06:08.641: E/AndroidRuntime(223): at com.test.fragment.FragmentTestWebActivity.onCreate(FragmentTestWebActivity.java:13)
02-03 15:06:08.641: E/AndroidRuntime(223): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
02-03 15:06:08.641: E/AndroidRuntime(223): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
02-03 15:06:08.641: E/AndroidRuntime(223): ... 11 more
02-03 15:06:08.641: E/AndroidRuntime(223): Caused by: java.lang.ClassNotFoundException: android.view.fragment in loader dalvik.system.PathClassLoader#48079860
02-03 15:06:08.641: E/AndroidRuntime(223): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
02-03 15:06:08.641: E/AndroidRuntime(223): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
02-03 15:06:08.641: E/AndroidRuntime(223): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
02-03 15:06:08.641: E/AndroidRuntime(223): at android.view.LayoutInflater.createView(LayoutInflater.java:466)
02-03 15:06:08.641: E/AndroidRuntime(223): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:544)
02-03 15:06:08.641: E/AndroidRuntime(223): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
02-03 15:06:08.641: E/AndroidRuntime(223): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
02-03 15:06:08.641: E/AndroidRuntime(223): ... 20 more
thanks
Make sure to import the Fragment from the library. Fragment in later Android versions and Fragment in the compatibility library have different packages!