Gridview with imageview and textview - android

I found this example http://www.firstdroid.com/2011/02/06/android-tutorial-gridview-with-icon-and-text/ but I get Force Close and I don't understand why...
In LogCat I get :
07-22 09:40:00.767: ERROR/AndroidRuntime(320): Caused by: java.lang.ClassNotFoundException: android.view.Linearlayout in loader dalvik.system.PathClassLoader#44dac780
07-22 09:40:00.767: ERROR/AndroidRuntime(320): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
07-22 09:40:00.767: ERROR/AndroidRuntime(320): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
07-22 09:40:00.767: ERROR/AndroidRuntime(320): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
07-22 09:40:00.767: ERROR/AndroidRuntime(320): at android.view.LayoutInflater.createView(LayoutInflater.java:466)
07-22 09:40:00.767: ERROR/AndroidRuntime(320): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:544)
07-22 09:40:00.767: ERROR/AndroidRuntime(320): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
07-22 09:40:00.767: ERROR/AndroidRuntime(320): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
Have anyone any idea?

In the example i think all the xml tags like LinearLayout, ImageView etc are lower case. That is causing the problm

Related

Google play services lib NoClassDefFoundError

I've tried to use Location API from google-play-services-lib.
I've set up project according to the developer page
http://developer.android.com/google/play-services/setup.html
After running application it crashes with error. Logcat:
Failed resolving interface 1013
'Lcom/google/android/gms/location/LocationListener;
java.lang.NoClassDefFoundError: com.example.fragments.MyFragment
MyFragment implements LocationListener and GooglePlayServices interfaces.
I have spent lot of time by googling but no solution found. Can someone help? Thank you.
LOGCAT:
07-22 14:08:15.329: E/AndroidRuntime(13259): FATAL EXCEPTION: main
07-22 14:08:15.329: E/AndroidRuntime(13259): java.lang.NoClassDefFoundError:
com.example.fragments.MyFragment
07-22 14:08:15.329: E/AndroidRuntime(13259): at
com.example.fragments.BaseFragment.getPages(BaseFragment.java:80)
07-22 14:08:15.329: E/AndroidRuntime(13259): at
com.example.fragments.BaseFragment.onCreate(BaseFragment.java:48)
07-22 14:08:15.329: E/AndroidRuntime(13259): at
android.support.v4.app.Fragment.performCreate(Fragment.java:1477)
07-22 14:08:15.329: E/AndroidRuntime(13259): at
android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:893)
07-22 14:08:15.329: E/AndroidRuntime(13259): at
android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
07-22 14:08:15.329: E/AndroidRuntime(13259): at
android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
07-22 14:08:15.329: E/AndroidRuntime(13259): at
android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1467)
07-22 14:08:15.329: E/AndroidRuntime(13259): at
android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:570)
07-22 14:08:15.329: E/AndroidRuntime(13259): at
android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1164)
07-22 14:08:15.329: E/AndroidRuntime(13259): at
android.app.Activity.performStart(Activity.java:5114)
07-22 14:08:15.329: E/AndroidRuntime(13259): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2153)
07-22 14:08:15.329: E/AndroidRuntime(13259): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
07-22 14:08:15.329: E/AndroidRuntime(13259): at
android.app.ActivityThread.access$600(ActivityThread.java:141)
07-22 14:08:15.329: E/AndroidRuntime(13259): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
07-22 14:08:15.329: E/AndroidRuntime(13259): at
android.os.Handler.dispatchMessage(Handler.java:99)
07-22 14:08:15.329: E/AndroidRuntime(13259): at
android.os.Looper.loop(Looper.java:137)
07-22 14:08:15.329: E/AndroidRuntime(13259): at
android.app.ActivityThread.main(ActivityThread.java:5039)
07-22 14:08:15.329: E/AndroidRuntime(13259): at
java.lang.reflect.Method.invokeNative(Native Method)
07-22 14:08:15.329: E/AndroidRuntime(13259): at
java.lang.reflect.Method.invoke(Method.java:511)
07-22 14:08:15.329: E/AndroidRuntime(13259): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
07-22 14:08:15.329: E/AndroidRuntime(13259): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
07-22 14:08:15.329: E/AndroidRuntime(13259): at dalvik.system.NativeStart.main(Native
Method)
#marlin
1) Go to project properties at java build path and check everything from order and export.
2) http://android-er.blogspot.in/2012/12/add-reference-library-google-play.html
Let me know if you are still struck with any issue
Thanks
I had the same situation, and in my case the problem was that I recently updated to a new android bundle (manually, by downloading the new bundle), but for some reason, I kept the old one on my PC, too. So, I had two different directories "adt-bundle-windows-x86-________" on my PC. Normally, this didn't pose any problems, but apparently, the Google Utils were updated into the older directory, while I was developing my app in the newer directory. This messed up the whole thing.
My solution was to move the older directory "adt-bundle-windows-x86-________" away so that there was only exactly 1 directory "adt-bundle-windows-x86-________" present on the PC. Then I updated everything to a clean state with the SDK Manager. From then on, things worked smoothly.
What I have done was to update everything to latest versions and switch to latest Android SDK in the project settings. My starting point was https://github.com/playgameservices/play-games-plugin-for-unity/issues/193

Signed Exported Android App failing with apache.commons.logging class cannot be converted to 'a.a.a.a.c'

My app runs perfectly when I "Run as Android Application" from Eclipse. In the past I've also successfully exported a signed version of the app.
Now, suddenly the exported version of the app crashes immediately. The key message seems to be
Caused by: a.a.a.a.b: The chosen LogFactory implementation does not extend LogFactory. Please check your configuration. (Caused by java.lang.ClassCastException: The application has specified that a custom LogFactory implementation should be used but Class 'org.apache.commons.logging.impl.LogFactoryImpl' cannot be converted to 'a.a.a.a.c'. Please check the custom implementation. Help can be found # http://commons.apache.org/logging/troubleshooting.html.).
Here are the Proguard settings. Am I missing something?
-dontwarn org.apache.**
-dontwarn org.apache.commons.logging.**
-ignorewarnings
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers
The apache.org doc says:
A custom LogFactory implementation can only be used if the implementation class loaded dynamically at runtime can be cast to the LogFactory class that loaded it. There are several ways in which this cast can fail. The most obvious is that the source code may not actually extend LogFactory. The source may be compatible but if the LogFactory class against which the source is compiled is not binary compatible then the cast will also fail.
There is also another more unusual way in which this cast can fail: even when the binary is compatible, the implementation class loaded at runtime may be linked to a different instance of the LogFactory class. For more information, see the tech guide.
This situation may be encountered in containers which use a custom LogFactory implementation. The implementation will typically be provided in a shared, high level classloader together with JCL. When an application classloader contains LogFactory, the implementation will be loaded from that higher level classloader. The implementation class will be linked to the LogFactory class loaded by the higher level classloader. Even if the LogFactory implementations are binary compatible, since they are loaded by different classloaders the two LogFactory Class instances are not equal and so the cast must fail.
They go on to say potential Fixes include:
There are various ways to fix this problem. Which fix is right depends on the circumstances.
If you are happy using another classloading policy for the application, select a classloading policy which ensures that LogFactory will be loaded from the shared classloader containing the custom implementation.
If you want to bypass the container adaption mechanism then set the appropriate system property to the default value when the container is started:
-Dorg.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.LogFactoryImpl
If you want to continue to use the default container mechanism then:
• Find and replace the commons-logging implementation used by the container with the most modern release
• Replace the commons-logging jar in the application with the commons-logging-adapters jar. This will ensure that application classloader will delegate to it's parent when loading LogFactory.
I thought that the "-Dorg.apache.commons......" command would go into the proguard-project.txt file but that caused the app to fail to even be built. So bottom line, I don't understand what apache is trying to say and am hoping some of you experienced folks could provide some clarity/guidance.
Here's the stack trace:
07-22 02:49:32.109: E/AndroidRuntime(13589): FATAL EXCEPTION: AsyncTask #1
07-22 02:49:32.109: E/AndroidRuntime(13589): java.lang.RuntimeException: An error occured while executing doInBackground()
07-22 02:49:32.109: E/AndroidRuntime(13589): at android.os.AsyncTask$3.done(AsyncTask.java:299)
07-22 02:49:32.109: E/AndroidRuntime(13589): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
07-22 02:49:32.109: E/AndroidRuntime(13589): at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
07-22 02:49:32.109: E/AndroidRuntime(13589): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
07-22 02:49:32.109: E/AndroidRuntime(13589): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
07-22 02:49:32.109: E/AndroidRuntime(13589): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
07-22 02:49:32.109: E/AndroidRuntime(13589): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
07-22 02:49:32.109: E/AndroidRuntime(13589): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
07-22 02:49:32.109: E/AndroidRuntime(13589): at java.lang.Thread.run(Thread.java:856)
07-22 02:49:32.109: E/AndroidRuntime(13589): Caused by: a.a.a.a.b: The chosen LogFactory implementation does not extend LogFactory. Please check your configuration. (Caused by java.lang.ClassCastException: The application has specified that a custom LogFactory implementation should be used but Class 'org.apache.commons.logging.impl.LogFactoryImpl' cannot be converted to 'a.a.a.a.c'. Please check the custom implementation. Help can be found #http://commons.apache.org/logging/troubleshooting.html.)
07-22 02:49:32.109: E/AndroidRuntime(13589): at a.a.a.a.c.a(Unknown Source)
07-22 02:49:32.109: E/AndroidRuntime(13589): at a.a.a.a.e.run(Unknown Source)
07-22 02:49:32.109: E/AndroidRuntime(13589): at java.security.AccessController.doPrivileged(AccessController.java:45)
07-22 02:49:32.109: E/AndroidRuntime(13589): at a.a.a.a.c.a(Unknown Source)
07-22 02:49:32.109: E/AndroidRuntime(13589): at a.a.a.a.c.h(Unknown Source)
07-22 02:49:32.109: E/AndroidRuntime(13589): at a.a.a.a.c.c(Unknown Source)
07-22 02:49:32.109: E/AndroidRuntime(13589): at a.a.b.f.b.b.<init>(Unknown Source)
07-22 02:49:32.109: E/AndroidRuntime(13589): at a.a.b.f.b.g.<init>(Unknown Source)
07-22 02:49:32.109: E/AndroidRuntime(13589): at toolbox.e.a(Unknown Source)
07-22 02:49:32.109: E/AndroidRuntime(13589): at toolbox.e.doInBackground(Unknown Source)
07-22 02:49:32.109: E/AndroidRuntime(13589): at android.os.AsyncTask$2.call(AsyncTask.java:287)
07-22 02:49:32.109: E/AndroidRuntime(13589): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
07-22 02:49:32.109: E/AndroidRuntime(13589): ... 5 more
07-22 02:49:32.109: E/AndroidRuntime(13589): Caused by: java.lang.ClassCastException: The application has specified that a custom LogFactory implementation should be used but Class 'org.apache.commons.logging.impl.LogFactoryImpl' cannot be converted to 'a.a.a.a.c'. Please check the custom implementation. Help can be found #http://commons.apache.org/logging/troubleshooting.html.
07-22 02:49:32.109: E/AndroidRuntime(13589): ... 17 more
07-22 02:49:32.169: E/(13589): <s3dReadConfigFile:75>: Can't open file for reading
07-22 02:49:32.169: E/(13589): <s3dReadConfigFile:75>: Can't open file for reading
07-22 02:49:32.359: E/SMD(176): DCD ON
07-22 02:49:33.090: E/MP-Decision(1545): DOWN Ld:36 Ns:1.100000 Ts:190 rq:0.400000 seq:196.000000
07-22 02:49:34.191: E/MP-Decision(1545): UP Ld:79 Nw:1.990000 Tw:140 rq:1.700000 seq:147.000000
07-22 02:49:35.353: E/SMD(176): DCD ON
07-22 02:49:36.734: E/Sensors(713): accelHandler -0.001198 -0.114961 10.077044
07-22 02:49:36.944: E/MP-Decision(1545): DOWN Ld:27 Ns:1.100000 Ts:190 rq:0.300000 seq:196.000000
07-22 02:49:38.356: E/SMD(176): DCD ON
07-22 02:49:38.977: E/MP-Decision(1545): UP Ld:36 Nw:1.990000 Tw:140 rq:2.800000 seq:147.000000
07-22 02:49:39.317: E/WifiP2pStateTracker(713): getNetworkInfo : NetworkInfo: type: WIFI_P2P[], state: DISCONNECTED/DISCONNECTED, reason: (unspecified), extra: (none), roaming: false, failover: false, isAvailable: true
07-22 02:49:39.447: E/ActivityThread(11387): Service com.facebook.katana.platform.PlatformService has leaked ServiceConnection com.facebook.fbservice.ops.DefaultBlueServiceOperationFactory$DefaultOperation$BlueServiceConnection#4235a770 that was originally bound here
07-22 02:49:39.447: E/ActivityThread(11387): android.app.ServiceConnectionLeaked: Service com.facebook.katana.platform.PlatformService has leaked ServiceConnection com.facebook.fbservice.ops.DefaultBlueServiceOperationFactory$DefaultOperation$BlueServiceConnection#4235a770 that was originally bound here
07-22 02:49:39.447: E/ActivityThread(11387): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:965)
07-22 02:49:39.447: E/ActivityThread(11387): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:859)
07-22 02:49:39.447: E/ActivityThread(11387): at android.app.ContextImpl.bindService(ContextImpl.java:1308)
07-22 02:49:39.447: E/ActivityThread(11387): at android.app.ContextImpl.bindService(ContextImpl.java:1300)
07-22 02:49:39.447: E/ActivityThread(11387): at android.content.ContextWrapper.bindService(ContextWrapper.java:401)
07-22 02:49:39.447: E/ActivityThread(11387): at com.facebook.fbservice.ops.DefaultBlueServiceOperationFactory$DefaultOperation.f(DefaultBlueServiceOperationFactory.java:426)
07-22 02:49:39.447: E/ActivityThread(11387): at com.facebook.fbservice.ops.DefaultBlueServiceOperationFactory$DefaultOperation.a(DefaultBlueServiceOperationFactory.java:384)
07-22 02:49:39.447: E/ActivityThread(11387): at com.facebook.katana.platform.PlatformService.b(PlatformService.java:184)
07-22 02:49:39.447: E/ActivityThread(11387): at com.facebook.katana.platform.PlatformService.a(PlatformService.java:36)
07-22 02:49:39.447: E/ActivityThread(11387): at com.facebook.katana.platform.PlatformService$MessageHandler.handleMessage(PlatformService.java:71)
07-22 02:49:39.447: E/ActivityThread(11387): at android.os.Handler.dispatchMessage(Handler.java:99)
07-22 02:49:39.447: E/ActivityThread(11387): at android.os.Looper.loop(Looper.java:137)
07-22 02:49:39.447: E/ActivityThread(11387): at android.app.ActivityThread.main(ActivityThread.java:4918)
07-22 02:49:39.447: E/ActivityThread(11387): at java.lang.reflect.Method.invokeNative(Native Method)
07-22 02:49:39.447: E/ActivityThread(11387): at java.lang.reflect.Method.invoke(Method.java:511)
07-22 02:49:39.447: E/ActivityThread(11387): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1004)
07-22 02:49:39.447: E/ActivityThread(11387): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:771)
07-22 02:49:39.447: E/ActivityThread(11387): at dalvik.system.NativeStart.main(Native Method)
07-22 02:49:39.517: E/Launcher(24512): Error finding setting, default accessibility to not found: accessibility_enabled
07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): com.facebook.debug.log.TerribleFailure: Exception unbinding: OperationType{Operation Name=platform_authorize_app, forRemote=false}
07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at com.facebook.debug.log.FbLogImpl.f(FbLogImpl.java:147)
07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at com.facebook.debug.log.FbLogImpl.a(FbLogImpl.java:118)
07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at com.facebook.debug.log.BLog.a(BLog.java:790)
07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at com.facebook.fbservice.ops.DefaultBlueServiceOperationFactory$DefaultOperation.e(DefaultBlueServiceOperationFactory.java:362)
07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at com.facebook.fbservice.ops.DefaultBlueServiceOperationFactory$DefaultOperation.d(DefaultBlueServiceOperationFactory.java:103)
07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at com.facebook.fbservice.ops.DefaultBlueServiceOperationFactory$DefaultOperation$1.b(DefaultBlueServiceOperationFactory.java:261)
07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at com.facebook.common.dispose.AbstractListenableDisposable.a(AbstractListenableDisposable.java:34)
07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at com.facebook.fbservice.ops.DefaultBlueServiceOperationFactory$DefaultOperation.c(DefaultBlueServiceOperationFactory.java:288)
07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at com.facebook.fbservice.ops.DefaultBlueServiceOperationFactory$DefaultOperation.a(DefaultBlueServiceOperationFactory.java:603)
07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at com.facebook.fbservice.ops.DefaultBlueServiceOperationFactory$DefaultOperation.b(DefaultBlueServiceOperationFactory.java:561)
07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at com.facebook.fbservice.ops.DefaultBlueServiceOperationFactory$DefaultOperation.c(DefaultBlueServiceOperationFactory.java:103)
07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at com.facebook.fbservice.ops.DefaultBlueServiceOperationFactory$DefaultOperation$4.run(DefaultBlueServiceOperationFactory.java:537)
07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at android.os.Handler.handleCallback(Handler.java:615)
07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at android.os.Handler.dispatchMessage(Handler.java:92)
07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at android.os.Looper.loop(Looper.java:137)
07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at android.app.ActivityThread.main(ActivityThread.java:4918)
07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at java.lang.reflect.Method.invokeNative(Native Method)
07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at java.lang.reflect.Method.invoke(Method.java:511)
07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1004)
07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:771)
07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at dalvik.system.NativeStart.main(Native Method)
07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): Caused by: java.lang.IllegalArgumentException: Service not registered: com.facebook.fbservice.ops.DefaultBlueServiceOperationFactory$DefaultOperation$BlueServiceConnection#4235a770
07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:917)
07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at android.app.ContextImpl.unbindService(ContextImpl.java:1338)
07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at android.content.ContextWrapper.unbindService(ContextWrapper.java:412)
07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at com.facebook.fbservice.ops.DefaultBlueServiceOperationFactory$DefaultOperation.e(DefaultBlueServiceOperationFactory.java:357)
07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): ... 17 more
I encountered the same problem when an external JAR in my project was using org.apache.commons.logging.impl.LogFactoryImpl.
It is worth noting that the JAR itself might have compiled classes from different packages, All residing within the JAR file. Just open the JAR and take a look.
In the proguard settings file you should declare all of the prefixes in the jar, e.g:
-keep org.apache.** { *; }
-keep com.somejar.** { *; }
Another option would be to tell proguard to ignore the entire JAR altogether.
also check: How can I exclude external .jar from obfuscation by Proguard (Android project)?

Application has stopped unexpectedly. please try again force close

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.

Is there a way to see a complete stack trace from android?

When I get an uncaught exception in my app and the trace prints to the logcat, is there anyway to make the entire trace print out? At the end of the trace it always has something like "...10 more".
Example:
03-11 16:25:53.572: ERROR/AndroidRuntime(3297): Caused by: java.lang.ClassNotFoundException: net.notify.notifymdm.listeners.PackageInstallerReceiver in loader dalvik.system.PathClassLoader[/data/app/net.notify.notifymdm-2.apk]
03-11 16:25:53.572: ERROR/AndroidRuntime(3297): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
03-11 16:25:53.572: ERROR/AndroidRuntime(3297): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
03-11 16:25:53.572: ERROR/AndroidRuntime(3297): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
03-11 16:25:53.572: ERROR/AndroidRuntime(3297): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2780)
03-11 16:25:53.572: ERROR/AndroidRuntime(3297): ... 10 more
Usually the "...N more" represents n more lines of the same error, anyway.
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Throwable.html#printStackTrace%28%29

Search suggestions fail in 2.2

My application uses in-app search, dynamically builds search suggestions on each request, puts them in a MatrixCursor and returns the suggestions to be displayed. Info on search suggestions here:
http://developer.android.com/guide/topics/search/adding-custom-suggestions.html
This works perfectly fine in 2.1-update1, but when I loaded it on a 2.2 phone, I get a fatal error when I try to search. Here is the relevant logs:
07-22 12:13:05.935: ERROR/SuggestionsAdapter(1028): error changing cursor and caching columns
07-22 12:13:05.935: ERROR/SuggestionsAdapter(1028): java.lang.NumberFormatException: My String Message
07-22 12:13:05.935: ERROR/SuggestionsAdapter(1028): at java.lang.Long.parse(Long.java:364)
07-22 12:13:05.935: ERROR/SuggestionsAdapter(1028): at java.lang.Long.parseLong(Long.java:354)
07-22 12:13:05.935: ERROR/SuggestionsAdapter(1028): at java.lang.Long.parseLong(Long.java:320)
07-22 12:13:05.935: ERROR/SuggestionsAdapter(1028): at android.database.MatrixCursor.getLong(MatrixCursor.java:255)
07-22 12:13:05.935: ERROR/SuggestionsAdapter(1028): at android.database.CursorWrapper.getLong(CursorWrapper.java:127)
07-22 12:13:05.935: ERROR/SuggestionsAdapter(1028): at android.widget.CursorAdapter.getItemId(CursorAdapter.java:156)
07-22 12:13:05.935: ERROR/SuggestionsAdapter(1028): at android.widget.AutoCompleteTextView.buildDropDown(AutoCompleteTextView.java:1248)
07-22 12:13:05.935: ERROR/SuggestionsAdapter(1028): at android.widget.AutoCompleteTextView.showDropDown(AutoCompleteTextView.java:1137)
07-22 12:13:05.935: ERROR/SuggestionsAdapter(1028): at android.widget.AutoCompleteTextView.updateDropDownForFilter(AutoCompleteTextView.java:1019)
07-22 12:13:05.935: ERROR/SuggestionsAdapter(1028): at android.widget.AutoCompleteTextView.onFilterComplete(AutoCompleteTextView.java:1002)
07-22 12:13:05.935: ERROR/SuggestionsAdapter(1028): at android.app.SearchDialog.onDataSetChanged(SearchDialog.java:612)
07-22 12:13:05.935: ERROR/SuggestionsAdapter(1028): at android.app.SuggestionsAdapter.notifyDataSetChanged(SuggestionsAdapter.java:193)
07-22 12:13:05.935: ERROR/SuggestionsAdapter(1028): at android.widget.CursorAdapter.changeCursor(CursorAdapter.java:260)
07-22 12:13:05.935: ERROR/SuggestionsAdapter(1028): at android.app.SuggestionsAdapter.changeCursor(SuggestionsAdapter.java:238)
07-22 12:13:05.935: ERROR/SuggestionsAdapter(1028): at android.widget.CursorFilter.publishResults(CursorFilter.java:67)
07-22 12:13:05.935: ERROR/SuggestionsAdapter(1028): at android.widget.Filter$ResultsHandler.handleMessage(Filter.java:282)
07-22 12:13:05.935: ERROR/SuggestionsAdapter(1028): at android.os.Handler.dispatchMessage(Handler.java:99)
07-22 12:13:05.935: ERROR/SuggestionsAdapter(1028): at android.os.Looper.loop(Looper.java:123)
07-22 12:13:05.935: ERROR/SuggestionsAdapter(1028): at android.app.ActivityThread.main(ActivityThread.java:4627)
07-22 12:13:05.935: ERROR/SuggestionsAdapter(1028): at java.lang.reflect.Method.invokeNative(Native Method)
07-22 12:13:05.935: ERROR/SuggestionsAdapter(1028): at java.lang.reflect.Method.invoke(Method.java:521)
07-22 12:13:05.935: ERROR/SuggestionsAdapter(1028): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-22 12:13:05.935: ERROR/SuggestionsAdapter(1028): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-22 12:13:05.935: ERROR/SuggestionsAdapter(1028): at dalvik.system.NativeStart.main(Native Method)
07-22 12:13:05.935: DEBUG/AndroidRuntime(1028): Shutting down VM
07-22 12:13:05.935: WARN/dalvikvm(1028): threadid=1: thread exiting with uncaught exception (group=0x4001d7f0)
07-22 12:13:05.945: ERROR/AndroidRuntime(1028): FATAL EXCEPTION: main
07-22 12:13:05.945: ERROR/AndroidRuntime(1028): java.lang.NumberFormatException: My String Message
07-22 12:13:05.945: ERROR/AndroidRuntime(1028): at java.lang.Long.parse(Long.java:364)
07-22 12:13:05.945: ERROR/AndroidRuntime(1028): at java.lang.Long.parseLong(Long.java:354)
07-22 12:13:05.945: ERROR/AndroidRuntime(1028): at java.lang.Long.parseLong(Long.java:320)
07-22 12:13:05.945: ERROR/AndroidRuntime(1028): at android.database.MatrixCursor.getLong(MatrixCursor.java:255)
07-22 12:13:05.945: ERROR/AndroidRuntime(1028): at android.database.CursorWrapper.getLong(CursorWrapper.java:127)
07-22 12:13:05.945: ERROR/AndroidRuntime(1028): at android.widget.CursorAdapter.getItemId(CursorAdapter.java:156)
07-22 12:13:05.945: ERROR/AndroidRuntime(1028): at android.widget.AutoCompleteTextView.buildDropDown(AutoCompleteTextView.java:1248)
07-22 12:13:05.945: ERROR/AndroidRuntime(1028): at android.widget.AutoCompleteTextView.showDropDown(AutoCompleteTextView.java:1137)
07-22 12:13:05.945: ERROR/AndroidRuntime(1028): at android.widget.AutoCompleteTextView.updateDropDownForFilter(AutoCompleteTextView.java:1019)
07-22 12:13:05.945: ERROR/AndroidRuntime(1028): at android.widget.AutoCompleteTextView.onFilterComplete(AutoCompleteTextView.java:1002)
07-22 12:13:05.945: ERROR/AndroidRuntime(1028): at android.widget.Filter$ResultsHandler.handleMessage(Filter.java:285)
07-22 12:13:05.945: ERROR/AndroidRuntime(1028): at android.os.Handler.dispatchMessage(Handler.java:99)
07-22 12:13:05.945: ERROR/AndroidRuntime(1028): at android.os.Looper.loop(Looper.java:123)
07-22 12:13:05.945: ERROR/AndroidRuntime(1028): at android.app.ActivityThread.main(ActivityThread.java:4627)
07-22 12:13:05.945: ERROR/AndroidRuntime(1028): at java.lang.reflect.Method.invokeNative(Native Method)
07-22 12:13:05.945: ERROR/AndroidRuntime(1028): at java.lang.reflect.Method.invoke(Method.java:521)
07-22 12:13:05.945: ERROR/AndroidRuntime(1028): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-22 12:13:05.945: ERROR/AndroidRuntime(1028): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-22 12:13:05.945: ERROR/AndroidRuntime(1028): at dalvik.system.NativeStart.main(Native Method)
where "My String Message" is the value of the SUGGEST_COLUMN_TEXT_1 field of the first (in this case only) row to be returned as a suggestion in the cursor. The stack trace does not touch my code at all, and following it in a debugger shows the error occurs some time after I return the suggestions cursor in my search suggestion content provider.
Why is their adapter suddenly trying to interpret a String as a Long? Has anyone else encountered this?
Thanks!
The code is failing when it's trying to access the ID column ("_id") which is required in any search suggestions cursor, and must be a Long.
Is it possible that you're not including that column, or, you're creating that column but writing your strings into it inadvertently?
See http://developer.android.com/guide/topics/search/adding-custom-suggestions.html#SuggestionTable
Just a reference for others who stuck, the column _id is case sensitive. Defining the column as "_ID" will FAIL and hit exception.

Categories

Resources