Error when debugging in Eclipse - android

I have a working project in Eclipse. Very often when I try Eclipse' Run command, I see some errors in logcat. Apparently the APK does not get installed or something. Eclipse/ADB tries again and second time around it always works as expected. This error does not seem to have any operational impact, but still I'm curious as to why it's happening.
Eclipse: Version: 3.7.2, Build id: M20120208-0800
Android SDK: 4.0
Target: Samsung Tab, Samsung S2, Emulator
Here is the logcat.
11-28 17:08:59.097: E/AndroidRuntime(14086): FATAL EXCEPTION: main
11-28 17:08:59.097: E/AndroidRuntime(14086): java.lang.RuntimeException: Unable to instantiate application android.app.Application: java.lang.NullPointerException
11-28 17:08:59.097: E/AndroidRuntime(14086): at android.app.LoadedApk.makeApplication(LoadedApk.java:501)
11-28 17:08:59.097: E/AndroidRuntime(14086): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4198)
11-28 17:08:59.097: E/AndroidRuntime(14086): at android.app.ActivityThread.access$1300(ActivityThread.java:140)
11-28 17:08:59.097: E/AndroidRuntime(14086): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1288)
11-28 17:08:59.097: E/AndroidRuntime(14086): at android.os.Handler.dispatchMessage(Handler.java:99)
11-28 17:08:59.097: E/AndroidRuntime(14086): at android.os.Looper.loop(Looper.java:137)
11-28 17:08:59.097: E/AndroidRuntime(14086): at android.app.ActivityThread.main(ActivityThread.java:4895)
11-28 17:08:59.097: E/AndroidRuntime(14086): at java.lang.reflect.Method.invokeNative(Native Method)
11-28 17:08:59.097: E/AndroidRuntime(14086): at java.lang.reflect.Method.invoke(Method.java:511)
11-28 17:08:59.097: E/AndroidRuntime(14086): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:994)
11-28 17:08:59.097: E/AndroidRuntime(14086): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761)
11-28 17:08:59.097: E/AndroidRuntime(14086): at dalvik.system.NativeStart.main(Native Method)
11-28 17:08:59.097: E/AndroidRuntime(14086): Caused by: java.lang.NullPointerException
11-28 17:08:59.097: E/AndroidRuntime(14086): at android.app.LoadedApk.initializeJavaContextClassLoader(LoadedApk.java:377)
11-28 17:08:59.097: E/AndroidRuntime(14086): at android.app.LoadedApk.getClassLoader(LoadedApk.java:320)
11-28 17:08:59.097: E/AndroidRuntime(14086): at android.app.LoadedApk.makeApplication(LoadedApk.java:493)
11-28 17:08:59.097: E/AndroidRuntime(14086): ... 11 more
11-28 17:09:07.815: D/dalvikvm(14166): GC_FOR_ALLOC freed 54K, 9% free 7431K/8131K, paused 30ms, total 30ms
11-28 17:09:07.815: I/dalvikvm-heap(14166): Grow heap (frag case) to 9.173MB for 1463056-byte allocation
11-28 17:09:07.839: D/dalvikvm(14166): GC_CONCURRENT freed <1K, 8% free 8859K/9607K, paused 2ms+2ms, total 20ms
11-28 17:09:07.995: D/MainActivity(14166): onCreate()

Related

FATAL EXCEPTION : main - My app doesn't work on android devices anymore, but works on desktop

This is the first time I have this problem and I absolutely don't know what to do.
I used to test my app on both virtual devices and on my phone and tablet. I tested it very often, like every 1-2h.
And at one point, it just stopped working on every android devices, but it still works on desktop.
On the android devices, it crashes as soon as I start the app, and I obtain this message :
"Unfortunately, MyApp has stopped."
And in the logcat, the stack trace shows a "FATAL EXCEPTION: main", I really need help to understand what is happening, and how to deal with this situation.
Thank you very much.
11-28 21:10:37.517: D/dalvikvm(613): Trying to load lib /data/data/com.premier.jeu.android/lib/libgdx.so 0x411998b0
11-28 21:10:37.527: D/dalvikvm(613): Added shared lib /data/data/com.premier.jeu.android/lib/libgdx.so 0x411998b0
11-28 21:10:37.527: D/dalvikvm(613): No JNI_OnLoad found in /data/data/com.premier.jeu.android/lib/libgdx.so 0x411998b0, skipping init
11-28 21:10:37.617: D/libEGL(613): Emulator without GPU support detected. Fallback to software renderer.
11-28 21:10:37.627: D/libEGL(613): loaded /system/lib/egl/libGLES_android.so
11-28 21:10:37.646: D/AndroidRuntime(613): Shutting down VM
11-28 21:10:37.646: W/dalvikvm(613): threadid=1: thread exiting with uncaught exception (group=0x40a13300)
11-28 21:10:37.656: E/AndroidRuntime(613): FATAL EXCEPTION: main
11-28 21:10:37.656: E/AndroidRuntime(613): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.premier.jeu.android/com.premier.jeu.android.AndroidLauncher}: com.badlogic.gdx.utils.GdxRuntimeException: Libgdx requires OpenGL ES 2.0
11-28 21:10:37.656: E/AndroidRuntime(613): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
11-28 21:10:37.656: E/AndroidRuntime(613): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
11-28 21:10:37.656: E/AndroidRuntime(613): at android.app.ActivityThread.access$600(ActivityThread.java:130)
11-28 21:10:37.656: E/AndroidRuntime(613): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
11-28 21:10:37.656: E/AndroidRuntime(613): at android.os.Handler.dispatchMessage(Handler.java:99)
11-28 21:10:37.656: E/AndroidRuntime(613): at android.os.Looper.loop(Looper.java:137)
11-28 21:10:37.656: E/AndroidRuntime(613): at android.app.ActivityThread.main(ActivityThread.java:4745)
11-28 21:10:37.656: E/AndroidRuntime(613): at java.lang.reflect.Method.invokeNative(Native Method)
11-28 21:10:37.656: E/AndroidRuntime(613): at java.lang.reflect.Method.invoke(Method.java:511)
11-28 21:10:37.656: E/AndroidRuntime(613): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
11-28 21:10:37.656: E/AndroidRuntime(613): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
11-28 21:10:37.656: E/AndroidRuntime(613): at dalvik.system.NativeStart.main(Native Method)
11-28 21:10:37.656: E/AndroidRuntime(613): Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Libgdx requires OpenGL ES 2.0
11-28 21:10:37.656: E/AndroidRuntime(613): at com.badlogic.gdx.backends.android.AndroidGraphics.createGLSurfaceView(AndroidGraphics.java:122)
11-28 21:10:37.656: E/AndroidRuntime(613): at com.badlogic.gdx.backends.android.AndroidGraphics.<init>(AndroidGraphics.java:102)
11-28 21:10:37.656: E/AndroidRuntime(613): at com.badlogic.gdx.backends.android.AndroidGraphics.<init>(AndroidGraphics.java:95)
11-28 21:10:37.656: E/AndroidRuntime(613): at com.badlogic.gdx.backends.android.AndroidApplication.init(AndroidApplication.java:133)
11-28 21:10:37.656: E/AndroidRuntime(613): at com.badlogic.gdx.backends.android.AndroidApplication.initialize(AndroidApplication.java:99)
11-28 21:10:37.656: E/AndroidRuntime(613): at com.premier.jeu.android.AndroidLauncher.onCreate(AndroidLauncher.java:16)
11-28 21:10:37.656: E/AndroidRuntime(613): at android.app.Activity.performCreate(Activity.java:5008)
11-28 21:10:37.656: E/AndroidRuntime(613): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
11-28 21:10:37.656: E/AndroidRuntime(613): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
11-28 21:10:37.656: E/AndroidRuntime(613): ... 11 more
11-28 21:10:39.476: I/Process(613): Sending signal. PID: 613 SIG: 9

Error java.lang.UnsatisfiedLinkError: dlopen failed when running application on Android 4.4

Hello I found this exception when I run my application on Android kitkat 4.4
11-28 08:50:00.752: E/dalvikvm(10056): dlopen("/data/app-lib/com.vis.kotob-2/libdatabase_sqlcipher.so")
failed: dlopen failed: cannot locate symbol "_ZN7android10MemoryBaseC1ERKNS_2spINS_11IMemoryHeapEEElj"
referenced by "libdatabase_sqlcipher.so"...
11-28 08:50:00.762: E/AndroidRuntime(10056): FATAL EXCEPTION: main
11-28 08:50:00.762: E/AndroidRuntime(10056): Process: com.his.mojak, PID: 10056
11-28 08:50:00.762: E/AndroidRuntime(10056): java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "_ZN7android10MemoryBaseC1ERKNS_2spINS_11IMemoryHeapEEElj" referenced by "libdatabase_sqlcipher.so"...
11-28 08:50:00.762: E/AndroidRuntime(10056): at java.lang.Runtime.loadLibrary(Runtime.java:364)
11-28 08:50:00.762: E/AndroidRuntime(10056): at java.lang.System.loadLibrary(System.java:526)
11-28 08:50:00.762: E/AndroidRuntime(10056): at net.sqlcipher.database.SQLiteDatabase.loadLibs(SQLiteDatabase.java:143)
11-28 08:50:00.762: E/AndroidRuntime(10056): at net.sqlcipher.database.SQLiteDatabase.loadLibs(SQLiteDatabase.java:136)
11-28 08:50:00.762: E/AndroidRuntime(10056): at com.his.mojak.model.db.DBManager.<init>(DBManager.java:24)
11-28 08:50:00.762: E/AndroidRuntime(10056): at com.his.mojak.model.db.DBManager.getInstance(DBManager.java:15)
11-28 08:50:00.762: E/AndroidRuntime(10056): at com.his.mojak.model.dao.db.DbAbstractDao.<init>(DbAbstractDao.java:13)
11-28 08:50:00.762: E/AndroidRuntime(10056): at com.his.mojak.model.dao.db.UserDataDao.<init>(UserDataDao.java:10)
11-28 08:50:00.762: E/AndroidRuntime(10056): at com.his.mojak.model.dao.db.UserDataDao.getInstance(UserDataDao.java:19)
11-28 08:50:00.762: E/AndroidRuntime(10056): at com.his.mojak.ui.activity.splash.SplashController.sessionExpired(SplashController.java:157)
11-28 08:50:00.762: E/AndroidRuntime(10056): at com.his.mojak.ui.activity.splash.SplashActivity.onSplashFinished(SplashActivity.java:55)
11-28 08:50:00.762: E/AndroidRuntime(10056): at com.his.mojak.ui.activity.splash.SplashController$1.handleMessage(SplashController.java:72)
11-28 08:50:00.762: E/AndroidRuntime(10056): at android.os.Handler.dispatchMessage(Handler.java:102)
11-28 08:50:00.762: E/AndroidRuntime(10056): at android.os.Looper.loop(Looper.java:137)
11-28 08:50:00.762: E/AndroidRuntime(10056): at android.app.ActivityThread.main(ActivityThread.java:4998)
11-28 08:50:00.762: E/AndroidRuntime(10056): at java.lang.reflect.Method.invokeNative(Native Method)
11-28 08:50:00.762: E/AndroidRuntime(10056): at java.lang.reflect.Method.invoke(Method.java:515)
11-28 08:50:00.762: E/AndroidRuntime(10056): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
11-28 08:50:00.762: E/AndroidRuntime(10056): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
11-28 08:50:00.762: E/AndroidRuntime(10056): at dalvik.system.NativeStart.main(Native Method)
What's your sqlcipher version?
There is an issue with older(v2.2.0) versions for KitKat: https://github.com/sqlcipher/android-database-sqlcipher/issues/107
Get the latest release of the binaries (e.g. http://sqlcipher.net/downloads or directly here) or compile the latest source, and you should be fine!

pointing the error message in the following log snippet

Ok below here is what my log generates when I try to run my application . The application fails unexpectedly and does not even start
09-02 04:28:51.856: D/dalvikvm(781): GC_FOR_ALLOC freed 66K, 7% free 2542K/2728K, paused 51ms, total 66ms
09-02 04:28:51.866: I/dalvikvm-heap(781): Grow heap (frag case) to 3.181MB for 614500-byte allocation
09-02 04:28:51.936: D/dalvikvm(781): GC_FOR_ALLOC freed <1K, 6% free 3142K/3332K, paused 67ms, total 67ms
09-02 04:28:52.406: W/SoundPool(781): sample 1 not READY
09-02 04:28:53.116: D/gralloc_goldfish(781): Emulator without GPU emulation detected.
09-02 04:28:53.376: I/Choreographer(781): Skipped 33 frames! The application may be doing too much work on its main thread.
09-02 04:29:22.606: E/AudioTrack(781): Could not get audio output for stream type 3
09-02 04:29:22.606: E/SoundPool(781): Error creating AudioTrack
09-02 04:29:22.756: D/dalvikvm(781): GC_FOR_ALLOC freed 30K, 5% free 3523K/3672K, paused 19ms, total 21ms
09-02 04:29:22.756: I/dalvikvm-heap(781): Grow heap (frag case) to 4.159MB for 635812-byte allocation
09-02 04:29:22.856: D/dalvikvm(781): GC_FOR_ALLOC freed 1K, 4% free 4143K/4296K, paused 97ms, total 97ms
09-02 04:29:22.966: I/Choreographer(781): Skipped 91 frames! The application may be doing too much work on its main thread.
09-02 04:29:23.206: I/Choreographer(781): Skipped 55 frames! The application may be doing too much work on its main thread.
09-02 04:29:23.375: I/Choreographer(781): Skipped 35 frames! The application may be doing too much work on its main thread.
09-02 04:29:23.776: I/Choreographer(781): Skipped 79 frames! The application may be doing too much work on its main thread.
09-02 04:29:28.016: D/dalvikvm(781): GC_FOR_ALLOC freed 108K, 5% free 4436K/4664K, paused 111ms, total 133ms
09-02 04:29:28.045: I/dalvikvm-heap(781): Grow heap (frag case) to 5.030MB for 614500-byte allocation
09-02 04:29:28.096: D/dalvikvm(781): GC_FOR_ALLOC freed 1K, 5% free 5034K/5268K, paused 55ms, total 56ms
09-02 04:29:28.235: W/SoundPool(781): sample 1 not READY
09-02 04:29:28.785: I/Choreographer(781): Skipped 50 frames! The application may be doing too much work on its main thread.
09-02 04:29:31.626: E/AudioTrack(781): Could not get audio output for stream type 3
09-02 04:29:31.626: E/SoundPool(781): Error creating AudioTrack
09-02 04:29:31.746: E/SlaveBlueTooth(781): +++ ON CREATE +++
09-02 04:29:31.766: W/System.err(781): java.io.IOException: open failed: EROFS (Read-only file system)
09-02 04:29:31.776: W/System.err(781): at java.io.File.createNewFile(File.java:948)
09-02 04:29:31.785: W/System.err(781): at helog.diwesh.NugaBest.BTSmartSlavemodule.onCreate(BTSmartSlavemodule.java:118)
09-02 04:29:31.796: W/System.err(781): at android.app.Activity.performCreate(Activity.java:5133)
09-02 04:29:31.796: W/System.err(781): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
09-02 04:29:31.796: W/System.err(781): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
09-02 04:29:31.816: W/System.err(781): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
09-02 04:29:31.816: W/System.err(781): at android.app.ActivityThread.access$600(ActivityThread.java:141)
09-02 04:29:31.816: W/System.err(781): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
09-02 04:29:31.826: W/System.err(781): at android.os.Handler.dispatchMessage(Handler.java:99)
09-02 04:29:31.826: W/System.err(781): at android.os.Looper.loop(Looper.java:137)
09-02 04:29:31.826: W/System.err(781): at android.app.ActivityThread.main(ActivityThread.java:5103)
09-02 04:29:31.836: W/System.err(781): at java.lang.reflect.Method.invokeNative(Native Method)
09-02 04:29:31.836: W/System.err(781): at java.lang.reflect.Method.invoke(Method.java:525)
09-02 04:29:31.846: W/System.err(781): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
09-02 04:29:31.846: W/System.err(781): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-02 04:29:31.856: W/System.err(781): at dalvik.system.NativeStart.main(Native Method)
09-02 04:29:31.856: W/System.err(781): Caused by: libcore.io.ErrnoException: open failed: EROFS (Read-only file system)
09-02 04:29:31.876: W/System.err(781): at libcore.io.Posix.open(Native Method)
09-02 04:29:31.886: W/System.err(781): at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
09-02 04:29:31.886: W/System.err(781): at java.io.File.createNewFile(File.java:941)
09-02 04:29:31.896: W/System.err(781): ... 15 more
09-02 04:29:32.016: D/AndroidRuntime(781): Shutting down VM
09-02 04:29:32.016: W/dalvikvm(781): threadid=1: thread exiting with uncaught exception (group=0x41465700)
09-02 04:29:32.066: E/AndroidRuntime(781): FATAL EXCEPTION: main
09-02 04:29:32.066: E/AndroidRuntime(781): java.lang.RuntimeException: Unable to start activity ComponentInfo{hellog.diwesh.NugaBest/helog.diwesh.NugaBest.BTSmartSlavemodule}: android.util.AndroidRuntimeException: requestFeature() must be called before adding content
09-02 04:29:32.066: E/AndroidRuntime(781): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
09-02 04:29:32.066: E/AndroidRuntime(781): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
09-02 04:29:32.066: E/AndroidRuntime(781): at android.app.ActivityThread.access$600(ActivityThread.java:141)
09-02 04:29:32.066: E/AndroidRuntime(781): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
09-02 04:29:32.066: E/AndroidRuntime(781): at android.os.Handler.dispatchMessage(Handler.java:99)
09-02 04:29:32.066: E/AndroidRuntime(781): at android.os.Looper.loop(Looper.java:137)
09-02 04:29:32.066: E/AndroidRuntime(781): at android.app.ActivityThread.main(ActivityThread.java:5103)
09-02 04:29:32.066: E/AndroidRuntime(781): at java.lang.reflect.Method.invokeNative(Native Method)
09-02 04:29:32.066: E/AndroidRuntime(781): at java.lang.reflect.Method.invoke(Method.java:525)
09-02 04:29:32.066: E/AndroidRuntime(781): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
09-02 04:29:32.066: E/AndroidRuntime(781): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-02 04:29:32.066: E/AndroidRuntime(781): at dalvik.system.NativeStart.main(Native Method)
09-02 04:29:32.066: E/AndroidRuntime(781): Caused by: android.util.AndroidRuntimeException: requestFeature() must be called before adding content
09-02 04:29:32.066: E/AndroidRuntime(781): at com.android.internal.policy.impl.PhoneWindow.requestFeature(PhoneWindow.java:226)
09-02 04:29:32.066: E/AndroidRuntime(781): at android.app.Activity.requestWindowFeature(Activity.java:3264)
09-02 04:29:32.066: E/AndroidRuntime(781): at helog.diwesh.NugaBest.BTSmartSlavemodule.onCreate(BTSmartSlavemodule.java:141)
09-02 04:29:32.066: E/AndroidRuntime(781): at android.app.Activity.performCreate(Activity.java:5133)
09-02 04:29:32.066: E/AndroidRuntime(781): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
09-02 04:29:32.066: E/AndroidRuntime(781): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
09-02 04:29:32.066: E/AndroidRuntime(781): ... 11 more
This is the error from your LogCat :
FATAL EXCEPTION: main
09-02 04:29:32.066: E/AndroidRuntime(781): java.lang.RuntimeException: Unable to start activity ComponentInfo{hellog.diwesh.NugaBest/helog.diwesh.NugaBest.BTSmartSlavemodule}: android.util.AndroidRuntimeException: requestFeature() must be called before adding content
Multiple issues here:
09-02 04:29:31.766: W/System.err(781): java.io.IOException: open failed: EROFS (Read-only file system)
09-02 04:29:31.776: W/System.err(781): at java.io.File.createNewFile(File.java:948)
09-02 04:29:31.785: W/System.err(781): at helog.diwesh.NugaBest.BTSmartSlavemodule.onCreate(BTSmartSlavemodule.java:118)
In BTSmartSlavemodule.java line 118 you're trying to create a new file on a read-only file system.
09-02 04:29:32.066: E/AndroidRuntime(781): Caused by: android.util.AndroidRuntimeException: requestFeature() must be called before adding content
09-02 04:29:32.066: E/AndroidRuntime(781): at com.android.internal.policy.impl.PhoneWindow.requestFeature(PhoneWindow.java:226)
09-02 04:29:32.066: E/AndroidRuntime(781): at android.app.Activity.requestWindowFeature(Activity.java:3264)
09-02 04:29:32.066: E/AndroidRuntime(781): at helog.diwesh.NugaBest.BTSmartSlavemodule.onCreate(BTSmartSlavemodule.java:141)
On line 141 of the same file you're trying to call requestWindowFeature() after calling setContentView(). You need to set window features before setContentView().
You call requestFeature() not in right place... try to call this method before setContentView(R.layout.activity)
The cause of this error is :
09-02 04:29:32.066: E/AndroidRuntime(781): Caused by: android.util.AndroidRuntimeException: requestFeature() must be called before adding content
And this cause happened at :
09-02 04:29:31.785: W/System.err(781): at helog.diwesh.NugaBest.BTSmartSlavemodule.onCreate(BTSmartSlavemodule.java:118)
Where you put code .requestWindowFeature(). To avoid this cause you must put this code before setContentView(R.layout.your_layout);
I think you are trying to create file on sdcard but you don't have specified permission to write external storage in manifest file
Add this line to manifest.xml file
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

How do I get characters from EditText?

I want to get the String from an EditText and then read individual characters from it. I've tried the following code:
String PT = pt.getText().toString();
int len = PT.length();
char chars[] = PT.toCharArray();
for(int i=0;i<len;i++)
{ Toast.makeText(encrypt.this,chars[i], 0).show(); }
However I get a Force Close error on this. Where am I going wrong?
I'm quite new to all this!
Here's the LogCat:
11-28 12:41:01.228: E/AndroidRuntime(1632): at android.app.ActivityThread.main(ActivityThread.java:3683)
11-28 12:41:01.228: E/AndroidRuntime(1632): at java.lang.reflect.Method.invokeNative(Native Method)
11-28 12:41:01.228: E/AndroidRuntime(1632): at java.lang.reflect.Method.invoke(Method.java:507)
11-28 12:41:01.228: E/AndroidRuntime(1632): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
11-28 12:41:01.228: E/AndroidRuntime(1632): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
11-28 12:41:01.228: E/AndroidRuntime(1632): at dalvik.system.NativeStart.main(Native Method)
11-28 12:46:43.688: W/KeyCharacterMap(1674): No keyboard for id 0
11-28 12:46:43.688: W/KeyCharacterMap(1674): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
11-28 12:46:54.442: W/ResourceType(1674): No package identifier when getting value for resource number 0x00000061
11-28 12:46:54.448: D/AndroidRuntime(1674): Shutting down VM
11-28 12:46:54.448: W/dalvikvm(1674): threadid=1: thread exiting with uncaught exception (group=0x40015560)
11-28 12:46:54.459: E/AndroidRuntime(1674): FATAL EXCEPTION: main
11-28 12:46:54.459: E/AndroidRuntime(1674): android.content.res.Resources$NotFoundException: String resource ID #0x61
11-28 12:46:54.459: E/AndroidRuntime(1674): at android.content.res.Resources.getText(Resources.java:201)
11-28 12:46:54.459: E/AndroidRuntime(1674): at android.widget.Toast.makeText(Toast.java:258)
11-28 12:46:54.459: E/AndroidRuntime(1674): at com.project.DENCrypt.encrypt$1.onClick(encrypt.java:33)
11-28 12:46:54.459: E/AndroidRuntime(1674): at android.view.View.performClick(View.java:2485)
11-28 12:46:54.459: E/AndroidRuntime(1674): at android.view.View$PerformClick.run(View.java:9080)
11-28 12:46:54.459: E/AndroidRuntime(1674): at android.os.Handler.handleCallback(Handler.java:587)
11-28 12:46:54.459: E/AndroidRuntime(1674): at android.os.Handler.dispatchMessage(Handler.java:92)
11-28 12:46:54.459: E/AndroidRuntime(1674): at android.os.Looper.loop(Looper.java:123)
11-28 12:46:54.459: E/AndroidRuntime(1674): at android.app.ActivityThread.main(ActivityThread.java:3683)
11-28 12:46:54.459: E/AndroidRuntime(1674): at java.lang.reflect.Method.invokeNative(Native Method)
11-28 12:46:54.459: E/AndroidRuntime(1674): at java.lang.reflect.Method.invoke(Method.java:507)
11-28 12:46:54.459: E/AndroidRuntime(1674): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
11-28 12:46:54.459: E/AndroidRuntime(1674): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
11-28 12:46:54.459: E/AndroidRuntime(1674): at dalvik.system.NativeStart.main(Native Method)
Toast.makeText(encrypt.this,String.valueOf(chars[i]), 0).show();
instead of
Toast.makeText(encrypt.this,chars[i], 0).show();
try this:
Toast.makeText(encrypt.this,chars[i] + "", 0).show();
it has the same way with Ram's
Change your toast message to
Toast.makeText(encrypt.this,Character.toString(chars[i]), Toast.LENGTH_SHORT).show();
Here the problem is with Toast message. Toast can not Display charaters. so convert charater to string and display
the chars[i] is integer value. If you look closely in your error log you will see
android.content.res.Resources$NotFoundException: String resource ID #0x61
(if you pass integer parameter, android will lookup for a resource with this Id)
you can print the character from the string directly:
Toast.makeText(encrypt.this,PT[i], 0).show();
probably the edit text (layout resource)is not available when reading the data from it. Just check whether you are able to get no null value when you do
EditText edt1 = (EditText)findViewById(R.id.myEditView);
log edt1(either through log, system.out.println);

Ho to use XOM on android, parse problems

I use XOM to create XML on android, it's worked, but when I have tried to parse some xml with XOM's Builder I have an error:
11-28 22:00:11.290: I/dalvikvm(26548): Could not find method org.apache.xerces.impl.Version.getVersion, referenced from method nu.xom.Builder.<clinit>
11-28 22:00:11.290: W/dalvikvm(26548): VFY: unable to resolve static method 5819: Lorg/apache/xerces/impl/Version;.getVersion ()Ljava/lang/String;
11-28 22:00:11.290: D/dalvikvm(26548): VFY: replacing opcode 0x71 at 0x000f
11-28 22:00:11.295: W/dalvikvm(26548): Unable to resolve superclass of Lnu/xom/XML1_0Parser; (921)
11-28 22:00:11.295: W/dalvikvm(26548): Link of class 'Lnu/xom/XML1_0Parser;' failed
11-28 22:00:11.295: E/dalvikvm(26548): Could not find class 'nu.xom.XML1_0Parser', referenced from method nu.xom.Builder.findParser
11-28 22:00:11.295: W/dalvikvm(26548): VFY: unable to resolve new-instance 699 (Lnu/xom/XML1_0Parser;) in Lnu/xom/Builder;
11-28 22:00:11.295: D/dalvikvm(26548): VFY: replacing opcode 0x22 at 0x0000
11-28 22:00:11.300: W/dalvikvm(26548): Unable to resolve superclass of Lnu/xom/XML1_0Parser; (921)
11-28 22:00:11.300: W/dalvikvm(26548): Link of class 'Lnu/xom/XML1_0Parser;' failed
11-28 22:00:11.300: D/dalvikvm(26548): DexOpt: unable to opt direct call 0x1160 at 0x02 in Lnu/xom/Builder;.findParser
11-28 22:00:11.300: W/dalvikvm(26548): Unable to resolve superclass of Lnu/xom/JDK15XML1_0Parser; (461)
11-28 22:00:11.300: W/dalvikvm(26548): Link of class 'Lnu/xom/JDK15XML1_0Parser;' failed
11-28 22:00:11.325: D/dalvikvm(26548): GC_CONCURRENT freed 377K, 4% free 11719K/12167K, paused 2ms+4ms
11-28 22:00:11.325: W/System.err(26548): nu.xom.XMLException: Could not find a suitable SAX2 parser
11-28 22:00:11.325: W/System.err(26548): at nu.xom.Builder.findParser(Unknown Source)
11-28 22:00:11.325: W/System.err(26548): at nu.xom.Builder.<init>(Unknown Source)
11-28 22:00:11.325: W/System.err(26548): at nu.xom.Builder.<init>(Unknown Source)
11-28 22:00:11.325: W/System.err(26548): at com.rkovalev.first.app.MainActivity$UpdateTask.onProgressUpdate(MainActivity.java:294)
11-28 22:00:11.325: W/System.err(26548): at com.rkovalev.first.app.MainActivity$UpdateTask.onProgressUpdate(MainActivity.java:1)
11-28 22:00:11.325: W/System.err(26548): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:618)
11-28 22:00:11.325: W/System.err(26548): at android.os.Handler.dispatchMessage(Handler.java:99)
11-28 22:00:11.325: W/System.err(26548): at android.os.Looper.loop(Looper.java:137)
11-28 22:00:11.325: W/System.err(26548): at android.app.ActivityThread.main(ActivityThread.java:4511)
11-28 22:00:11.325: W/System.err(26548): at java.lang.reflect.Method.invokeNative(Native Method)
11-28 22:00:11.325: W/System.err(26548): at java.lang.reflect.Method.invoke(Method.java:511)
11-28 22:00:11.325: W/System.err(26548): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980)
11-28 22:00:11.325: W/System.err(26548): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747)
11-28 22:00:11.325: W/System.err(26548): at dalvik.system.NativeStart.main(Native Method)
11-28 22:00:11.325: W/System.err(26548): Caused by: org.xml.sax.SAXException: Can't create default XMLReader; is system property org.xml.sax.driver set?
11-28 22:00:11.325: W/System.err(26548): at org.xml.sax.helpers.XMLReaderFactory.createXMLReader(XMLReaderFactory.java:156)
11-28 22:00:11.325: W/System.err(26548): ... 14 more
Using code to experiment:
Builder parser = new Builder();
nu.xom.Document doc = parser.build("<greeting>Hello World!</greeting>", "http://www.example.org/");
So, I could not found a driver property in org.xml.sax namespace.
This line of error log is related
11-28 22:00:11.325: W/System.err(26548): Caused by: org.xml.sax.SAXException: Can't create default XMLReader; is system property org.xml.sax.driver set?
This answer to this is here
porting to Android: why am I getting "Can't create default XMLReader; is system property org.xml.sax.driver set?"?

Categories

Resources