Friday, 6 September 2013

Android App keep crashing at run time and import issue

Android App keep crashing at run time and import issue

My application keeps generating "unfortunately app has stopped working" on
my device. I've looked at my code and can't see any errors but I believe I
may have identified what my logcat files are complaining about.
Here is my logcat:
09-06 14:38:20.974: D/AndroidRuntime(28710): Shutting down VM
09-06 14:38:20.974: W/dalvikvm(28710): threadid=1: thread exiting with
uncaught exception (group=0x41573700)
09-06 14:38:20.974: E/AndroidRuntime(28710): FATAL EXCEPTION: main
09-06 14:38:20.974: E/AndroidRuntime(28710): java.lang.RuntimeException:
Unable to instantiate activity
ComponentInfo{com.example.bluetooth.le/com.example.bluetooth.le.DeviceScanActivity}:
java.lang.ClassNotFoundException: Didn't find class
"com.example.bluetooth.le.DeviceScanActivity" on path: DexPathList[[zip
file
"/data/app/com.example.bluetooth.le-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.bluetooth.le-1,
/vendor/lib, /system/lib]]
09-06 14:38:20.974: E/AndroidRuntime(28710): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2137)
09-06 14:38:20.974: E/AndroidRuntime(28710): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
09-06 14:38:20.974: E/AndroidRuntime(28710): at
android.app.ActivityThread.access$600(ActivityThread.java:141)
09-06 14:38:20.974: E/AndroidRuntime(28710): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
09-06 14:38:20.974: E/AndroidRuntime(28710): at
android.os.Handler.dispatchMessage(Handler.java:99)
09-06 14:38:20.974: E/AndroidRuntime(28710): at
android.os.Looper.loop(Looper.java:137)
09-06 14:38:20.974: E/AndroidRuntime(28710): at
android.app.ActivityThread.main(ActivityThread.java:5103)
09-06 14:38:20.974: E/AndroidRuntime(28710): at
java.lang.reflect.Method.invokeNative(Native Method)
09-06 14:38:20.974: E/AndroidRuntime(28710): at
java.lang.reflect.Method.invoke(Method.java:525)
09-06 14:38:20.974: E/AndroidRuntime(28710): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
09-06 14:38:20.974: E/AndroidRuntime(28710): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-06 14:38:20.974: E/AndroidRuntime(28710): at
dalvik.system.NativeStart.main(Native Method)
09-06 14:38:20.974: E/AndroidRuntime(28710): Caused by:
java.lang.ClassNotFoundException: Didn't find class
"com.example.bluetooth.le.DeviceScanActivity" on path: DexPathList[[zip
file
"/data/app/com.example.bluetooth.le-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.bluetooth.le-1,
/vendor/lib, /system/lib]]
09-06 14:38:20.974: E/AndroidRuntime(28710): at
dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)
09-06 14:38:20.974: E/AndroidRuntime(28710): at
java.lang.ClassLoader.loadClass(ClassLoader.java:501)
09-06 14:38:20.974: E/AndroidRuntime(28710): at
java.lang.ClassLoader.loadClass(ClassLoader.java:461)
09-06 14:38:20.974: E/AndroidRuntime(28710): at
android.app.Instrumentation.newActivity(Instrumentation.java:1061)
09-06 14:38:20.974: E/AndroidRuntime(28710): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2128)
09-06 14:38:20.974: E/AndroidRuntime(28710): ... 11 more
I have a strong feeling that it is going to complaining about this import:
import com.example.bluetooth.le.R;
I think for the import to stop generating that error my applications name
should be in place of the .le. So in my case it would read:
import com.example.bluetooth.samplebletest.R;
But I get an error telling me that the import cannot be resolved.
Is my crash related to this import? How can I fix it?

No comments:

Post a Comment