When i'm trying to run my application i receive the error as The application Sample 2 (com.example.sample2) has stopped unexpectedly. Please try again Force close error. Logcat error is given below
02-07 03:46:52.292: I/Process(275): Sending signal. PID: 275 SIG: 9
02-07 03:47:01.045: D/AndroidRuntime(335): Shutting down VM
02-07 03:47:01.045: W/dalvikvm(335): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
02-07 03:47:01.106: E/AndroidRuntime(335): FATAL EXCEPTION: main
02-07 03:47:01.106: E/AndroidRuntime(335): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.projectsample1/com.example.projectsample1.MainActivity}: java.lang.ClassNotFoundException: com.example.projectsample1.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.projectsample1-1.apk]
02-07 03:47:01.106: E/AndroidRuntime(335): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
02-07 03:47:01.106: E/AndroidRuntime(335): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
02-07 03:47:01.106: E/AndroidRuntime(335): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
02-07 03:47:01.106: E/AndroidRuntime(335): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
02-07 03:47:01.106: E/AndroidRuntime(335): at android.os.Handler.dispatchMessage(Handler.java:99)
02-07 03:47:01.106: E/AndroidRuntime(335): at android.os.Looper.loop(Looper.java:123)
02-07 03:47:01.106: E/AndroidRuntime(335): at android.app.ActivityThread.main(ActivityThread.java:4627)
02-07 03:47:01.106: E/AndroidRuntime(335): at java.lang.reflect.Method.invokeNative(Native Method)
02-07 03:47:01.106: E/AndroidRuntime(335): at java.lang.reflect.Method.invoke(Method.java:521)
02-07 03:47:01.106: E/AndroidRuntime(335): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
02-07 03:47:01.106: E/AndroidRuntime(335): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
02-07 03:47:01.106: E/AndroidRuntime(335): at dalvik.system.NativeStart.main(Native Method)
02-07 03:47:01.106: E/AndroidRuntime(335): Caused by: java.lang.ClassNotFoundException: com.example.projectsample1.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.projectsample1-1.apk]
02-07 03:47:01.106: E/AndroidRuntime(335): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
02-07 03:47:01.106: E/AndroidRuntime(335): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
02-07 03:47:01.106: E/AndroidRuntime(335): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
02-07 03:47:01.106: E/AndroidRuntime(335): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
02-07 03:47:01.106: E/AndroidRuntime(335): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
02-07 03:47:01.106: E/AndroidRuntime(335): ... 11 more
02-07 03:52:01.252: I/Process(335): Sending signal. PID: 335 SIG: 9
Initially, this application was working well. But after a few days, it stopped working giving the above error. I don't seem to understand what is wrong. Please help me.
You have done one of two things:
Renamed your activity package or class name and not updated it in the manifest
or
Changed your manifest to reflect an activity that doesn't exist
Check your manifest against the fully qualified class name for that Activity. Make sure they match. Then go to Project -> Clean and clean your project.
I think, you declared Activity in AndroidManifes.xml, and register it as default to launch in your application. But, you have no Activity with this name as you declared in manifest. Just correct activity name in AndroidManifest.xml
Here is the error:
java.lang.ClassNotFoundException: com.example.projectsample1.MainActivity
The MainActivity class of the projectsample1 Application was not found.
Try to clear the dalvik-cache if you know how to do it.
Otherwise, re-install the application.
Or if you are the developer of the application, make sure to change the name of the class in the Manifest.xml file if you changed the name of the MainActivity class.
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'm getting this message when i run my application i don't know why i'm getting it could any one help me. here is the logcat.
java.lang.VerifyError: com.kosh.me.Smaller
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1429)
at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
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:876)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:634)
at dalvik.system.NativeStart.main(Native Method)
This happens when the build library classes conflict with those at run-time. Try performing a Clean of your project followed by a build.
I have no Idea why I get this error :/
Exception class java.lang.NullPointerException
Source method Jax$7.onClick()
java.lang.NullPointerException
at com.reg.lolsoundboard.Jax$7.onClick(Jax.java:83)
at android.view.View.performClick(View.java:2485)
at android.view.View$PerformClick.run(View.java:9089)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3806)
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)
Obviously you are dereferencing a variable in line 83 of the file Jax.java where the variable is null.
java.lang.NullPointerException
at com.reg.lolsoundboard.Jax$7.onClick(Jax.java:83)
If show the relevant code, people may be able to help you.
Hey, There's a lot of posts on here about read barcodes but I want to generate barcodes from a string of numbers and display the generated barcode to the user in my application.
I've had a look at a few libraries iTextPdf and Barbecue, in particular I've been trying to work with iTextPdf
I wondered if anyone knows of or could provide a simple implementation or suggest something better....
I want to draw the barcode directly to a custom view for display in a linear layout with other controls.
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Barcode128 code128 = new Barcode128();
code128.setCodeType(Barcode128.CODE128);
code128.setCode("123456789");
Image image128 = code128.createTemplateWithBarcode(barcodeview, null, null);
}
For starters this errors and the app wont actually run, but I don't know how to draw this on to the layout.
This gives the following error
02-07 23:55:31.868: ERROR/AndroidRuntime(212): Uncaught handler: thread main exiting due to uncaught exception
02-07 23:55:31.878: ERROR/AndroidRuntime(212): java.lang.VerifyError: com.itextpdf.text.pdf.Barcode128
02-07 23:55:31.878: ERROR/AndroidRuntime(212): at com.example.barcodetest.Main.onCreate(Main.java:17)
02-07 23:55:31.878: ERROR/AndroidRuntime(212): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
02-07 23:55:31.878: ERROR/AndroidRuntime(212): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2364)
02-07 23:55:31.878: ERROR/AndroidRuntime(212): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417)
02-07 23:55:31.878: ERROR/AndroidRuntime(212): at android.app.ActivityThread.access$2100(ActivityThread.java:116)
02-07 23:55:31.878: ERROR/AndroidRuntime(212): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
02-07 23:55:31.878: ERROR/AndroidRuntime(212): at android.os.Handler.dispatchMessage(Handler.java:99)
02-07 23:55:31.878: ERROR/AndroidRuntime(212): at android.os.Looper.loop(Looper.java:123)
02-07 23:55:31.878: ERROR/AndroidRuntime(212): at android.app.ActivityThread.main(ActivityThread.java:4203)
02-07 23:55:31.878: ERROR/AndroidRuntime(212): at java.lang.reflect.Method.invokeNative(Native Method)
02-07 23:55:31.878: ERROR/AndroidRuntime(212): at java.lang.reflect.Method.invoke(Method.java:521)
02-07 23:55:31.878: ERROR/AndroidRuntime(212): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
02-07 23:55:31.878: ERROR/AndroidRuntime(212): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
02-07 23:55:31.878: ERROR/AndroidRuntime(212): at dalvik.system.NativeStart.main(Native Method)
Thanks for your help.
Based on your stack trace, iTextPDF is not compatible with Android without at least a recompile, and probably more substantial changes than that. Bear in mind that there is a separate project for iTextPDF for Android -- I do not know if that is what you were using.
A search on a major search engine turns up this product.
I am getting this error in my application, and this happens only on UPC300-2.2 Viewsonic G-Tablet. All answers I've found so far (including this one) adviced on putting
<uses-permission android:name="android.permission.INTERNET"/>
to the manifest file, but it doesn't help.
Here is the complete stacktrace:
java.lang.NoClassDefFoundError: android.net.NetworkConnectivityListener
at
com.google.android.maps.MapActivity.onCreate(MapActivity.java:199)
at
myapp.Activity.ActivityMapSearch.onCreate(ActivityMapSearch.java:99)
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)
If that is TRUE, you can grab the source code of the class from the Android Source and add it yourself