ResourceNotFoundException when running on phone but not on tablet - android

When I try to run my app on my Samsung Note II, I get a ResourceNotFoundException for this line
setContentView(R.layout.activity_main);
However, I don't get this exception when I run it on the emulator or my Samsung Note 10.1.
Both are running Jellybean and my xml files are in folder called layout-land, and the XML file is in there. I tried cleaning my project and re-building, but it still doesn't work.
Does anyone have an idea what's wrong?
Let me know if I can provide any more information. Thanks!
01-27 22:11:32.975: E/AndroidRuntime(28330): FATAL EXCEPTION: main
01-27 22:11:32.975: E/AndroidRuntime(28330): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ventusthecorgi.hungrycorgi/com.mypackage.app.MainActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x7f030003
01-27 22:11:32.975: E/AndroidRuntime(28330): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2100)
01-27 22:11:32.975: E/AndroidRuntime(28330): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
01-27 22:11:32.975: E/AndroidRuntime(28330): at android.app.ActivityThread.access$600(ActivityThread.java:140)
01-27 22:11:32.975: E/AndroidRuntime(28330): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
01-27 22:11:32.975: E/AndroidRuntime(28330): at android.os.Handler.dispatchMessage(Handler.java:99)
01-27 22:11:32.975: E/AndroidRuntime(28330): at android.os.Looper.loop(Looper.java:137)
01-27 22:11:32.975: E/AndroidRuntime(28330): at android.app.ActivityThread.main(ActivityThread.java:4898)
01-27 22:11:32.975: E/AndroidRuntime(28330): at java.lang.reflect.Method.invokeNative(Native Method)
01-27 22:11:32.975: E/AndroidRuntime(28330): at java.lang.reflect.Method.invoke(Method.java:511)
01-27 22:11:32.975: E/AndroidRuntime(28330): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1008)
01-27 22:11:32.975: E/AndroidRuntime(28330): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:775)
01-27 22:11:32.975: E/AndroidRuntime(28330): at dalvik.system.NativeStart.main(Native Method)
01-27 22:11:32.975: E/AndroidRuntime(28330): Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f030003
01-27 22:11:32.975: E/AndroidRuntime(28330): at android.content.res.Resources.getValue(Resources.java:1026)
01-27 22:11:32.975: E/AndroidRuntime(28330): at android.content.res.Resources.loadXmlResourceParser(Resources.java:2131)
01-27 22:11:32.975: E/AndroidRuntime(28330): at android.content.res.Resources.getLayout(Resources.java:865)
01-27 22:11:32.975: E/AndroidRuntime(28330): at android.view.LayoutInflater.inflate(LayoutInflater.java:394)
01-27 22:11:32.975: E/AndroidRuntime(28330): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
01-27 22:11:32.975: E/AndroidRuntime(28330): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:307)
01-27 22:11:32.975: E/AndroidRuntime(28330): at android.app.Activity.setContentView(Activity.java:1916)
01-27 22:11:32.975: E/AndroidRuntime(28330): at com.ventusthecorgi.hungrycorgi.MainActivity.onCreate(MainActivity.java:22)
01-27 22:11:32.975: E/AndroidRuntime(28330): at android.app.Activity.performCreate(Activity.java:5191)
01-27 22:11:32.975: E/AndroidRuntime(28330): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
01-27 22:11:32.975: E/AndroidRuntime(28330): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2064)

I suspect that you have your problematic layout files only in the layout-land directory (based on what you wrote in the question). This means that if the device is launched in portrait mode, Android will search for your layout in layout-port directory, then layout, but not layout-land. I might be wrong but my hunch is that your Samsung Note II starts in portrait mode and thus doesn't see the layout file.
You have to provide a fallback layout resource. Either copy the layout from layout-land to layout-port and modify it accordingly for portrait mode or just copy it to layout directory as a fallback layout.

AFAIK, Samsung Galaxy Note II 's default orientation is not in landscape
try putting a set of resource files in /res/layout for those devices which are not fit the specific layout characteristics

The xml files are in layout-land so they are only valid when the app/device is in landscape mode. Try moving/copying them to just layout and you should be fine. You may want to put a generic layout in the layout directory and a landscape optimized layout in layout-land (or look at other resource selection criteria).

Related

Crash on setContentView

My application normally working fine without any crashes. In some case(Don't know the scenario) my application crash. The logcat shows the error Resources$NotFoundException . This resource is the:
setContentView(R.layout.practise_menu);
Have any idea about this scenario? When it is possible to crash like this?
My Logcat error is
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.x.y/com.x.y}: android.content.res.Resources$NotFoundException: Resource ID #0x7f030032
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2122)
at android.app.ActivityThread.access$600(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1228)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4895)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:994)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761)
at dalvik.system.NativeStart.main(NativeStart.java)
Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f030032
at android.content.res.Resources.getValue(Resources.java:1026)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2131)
at android.content.res.Resources.getLayout(Resources.java:865)
at android.view.LayoutInflater.inflate(LayoutInflater.java:394)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:306)
at android.app.Activity.setContentView(Activity.java:1912)
at com.x.y.onCreate(Practitioner_menu.java:749)
at android.app.Activity.performCreate(Activity.java:5163)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2061)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2122)
at android.app.ActivityThread.access$600(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1228)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4895)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:994)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761)
at dalvik.system.NativeStart.main(NativeStart.java)
I got this error report from crashlytics. Please help me to find out.
there is issue of the layout resolution,i have faced these kind of issue many times, better create folder structure as given bellow
layout-large
layout-small
layout-medium
I found the issue:
I just created different folders for landscape and portrait
e.g ->
layout-land
layout-port
But in Androidmanifest file i set the orientation as landscape.
Once i call intent for this activity and press power button and rotate the screen app crash and got this exception.
I don't know what is happening but i guess when the screen rotating it searches the xml file in layout-land and layout-port.

Error inflating class android.support.v7.internal.widget.ActionBarView

My application was working but when I came to start working on it this morning everything is not working. I am getting an error inflating class error which seems to be from an xml file where I get the "Binary XML file line #25" line. As I said this was working fine and now all of a sudden it does not. Below is the exception trace:
01-27 11:20:53.624: E/AndroidRuntime(7831): FATAL EXCEPTION: main
01-27 11:20:53.624: E/AndroidRuntime(7831): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ypmmllc.dailychecklist/com.ypmmllc.dailychecklist.TabbedActivity}: android.view.InflateException: Binary XML file line #25: Error inflating class android.support.v7.internal.widget.ActionBarView
01-27 11:20:53.624: E/AndroidRuntime(7831): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2737)
01-27 11:20:53.624: E/AndroidRuntime(7831): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2753)
01-27 11:20:53.624: E/AndroidRuntime(7831): at android.app.ActivityThread.access$2500(ActivityThread.java:129)
01-27 11:20:53.624: E/AndroidRuntime(7831): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2107)
01-27 11:20:53.624: E/AndroidRuntime(7831): at android.os.Handler.dispatchMessage(Handler.java:99)
01-27 11:20:53.624: E/AndroidRuntime(7831): at android.os.Looper.loop(Looper.java:143)
01-27 11:20:53.624: E/AndroidRuntime(7831): at android.app.ActivityThread.main(ActivityThread.java:4701)
01-27 11:20:53.624: E/AndroidRuntime(7831): at java.lang.reflect.Method.invokeNative(Native Method)
01-27 11:20:53.624: E/AndroidRuntime(7831): at java.lang.reflect.Method.invoke(Method.java:521)
01-27 11:20:53.624: E/AndroidRuntime(7831): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
01-27 11:20:53.624: E/AndroidRuntime(7831): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
01-27 11:20:53.624: E/AndroidRuntime(7831): at dalvik.system.NativeStart.main(Native Method)
01-27 11:20:53.624: E/AndroidRuntime(7831): Caused by: android.view.InflateException: Binary XML file line #25: Error inflating class android.support.v7.internal.widget.ActionBarView
01-27 11:20:53.624: E/AndroidRuntime(7831): at android.view.LayoutInflater.createView(LayoutInflater.java:513)
01-27 11:20:53.624: E/AndroidRuntime(7831): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
01-27 11:20:53.624: E/AndroidRuntime(7831): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
01-27 11:20:53.624: E/AndroidRuntime(7831): at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
01-27 11:20:53.624: E/AndroidRuntime(7831): at android.view.LayoutInflater.parseInclude(LayoutInflater.java:677)
01-27 11:20:53.624: E/AndroidRuntime(7831): at android.view.LayoutInflater.rInflate(LayoutInflater.java:614)
01-27 11:20:53.624: E/AndroidRuntime(7831): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
01-27 11:20:53.624: E/AndroidRuntime(7831): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
01-27 11:20:53.624: E/AndroidRuntime(7831): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
01-27 11:20:53.624: E/AndroidRuntime(7831): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:203)
01-27 11:20:53.624: E/AndroidRuntime(7831): at android.app.Activity.setContentView(Activity.java:1647)
01-27 11:20:53.624: E/AndroidRuntime(7831): at android.support.v7.app.ActionBarActivity.superSetContentView(ActionBarActivity.java:216)
01-27 11:20:53.624: E/AndroidRuntime(7831): at android.support.v7.app.ActionBarActivityDelegateBase.ensureSubDecor(ActionBarActivityDelegateBase.java:180)
01-27 11:20:53.624: E/AndroidRuntime(7831): at android.support.v7.app.ActionBarActivityDelegateBase.setContentView(ActionBarActivityDelegateBase.java:134)
01-27 11:20:53.624: E/AndroidRuntime(7831): at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:76)
01-27 11:20:53.624: E/AndroidRuntime(7831): at com.ypmmllc.dailychecklist.TabbedActivity.onCreate(TabbedActivity.java:30)
01-27 11:20:53.624: E/AndroidRuntime(7831): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
01-27 11:20:53.624: E/AndroidRuntime(7831): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2701)
01-27 11:20:53.624: E/AndroidRuntime(7831): ... 11 more
01-27 11:20:53.624: E/AndroidRuntime(7831): Caused by: java.lang.reflect.InvocationTargetException
01-27 11:20:53.624: E/AndroidRuntime(7831): at android.support.v7.internal.widget.ActionBarView.<init>(ActionBarView.java:218)
01-27 11:20:53.624: E/AndroidRuntime(7831): at java.lang.reflect.Constructor.constructNative(Native Method)
01-27 11:20:53.624: E/AndroidRuntime(7831): at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
Here is the XML file it bombs on in my class at setContentView(R.layout.activity_tabbed), as this is the line where everything bombs out.
activity_tabbed.xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".TabbedActivity" >
<view class="com.ypmmllc.dailychecklist.CustomViewPager"
android:id="#+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent">
</view>
</RelativeLayout>
And now the CustomViewPager class that I am referencing within the XML file:
package com.ypmmllc.dailychecklist;
import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;
public class CustomViewPager extends ViewPager {
private boolean enabled;
public CustomViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
this.enabled = false;
}
public CustomViewPager(Context context)
{
super(context);
this.enabled = false;
}
#Override
public boolean onTouchEvent(MotionEvent event) {
if (this.enabled) {
return super.onTouchEvent(event);
}
return false;
}
#Override
public boolean onInterceptTouchEvent(MotionEvent event) {
if (this.enabled) {
return super.onInterceptTouchEvent(event);
}
return false;
}
public void setPagingEnabled(boolean enabled) {
this.enabled = enabled;
}
}
Try to clean up the project and rebuild it:
IntelliJ IDEA: Build -> Rebuild project;
Eclipse: Project -> Clean
Try this:
<com.ypmmllc.dailychecklist.CustomViewPager
android:id="#+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
On behalf of OP
It was a settings.xml file I created while trying to create a SettingsActivity for the project. No errors were showing for the file at all and it was named in all lower case. I just completely deleted the file and everything built correctly. I noticed my LogCat was going crazy as well during this time. It just kept scrolling with new information. The whole thing is bizarre because, well, as I stated there were no errors showing within the file and everything was labeled correctly. Also, this was also after doing a clean build of the entire project which no longer produced the error I initially spoke of but than no longer created my R.java file.

Android Application gets a ClassNotFoundException

I've been having an issue with starting my application recently. It was working fine a few weeks back but during that time I made a few changes including importing refractoring it(I added a bunch of packages but then reverted those changes), updating from the ADT from the android site (which still runs on Eclipse Juno) to eclipse Kepler (and I downloaded the ADT plugin) and I also imported it to my new laptop (also using Kepler). Now when I import the application using Import -> Existing Android Code Into Workspace I get an error message saying that "Could not set the project desciption from "(myappname)" because the project description file (.project) is out of sync with the file system.". If I ignore this message and continue, and run the application on my phone LogCat gives me an error message ClassNotFoundException on my main launcher activity.
I've looked around and tried to solve this problem by rebuilding the path (with android private libraries checked). That's the only relevant fix I've found but it doesn't work.
I should point out a few things that might or might not help:
-I tried to run an older version of the application and that works (after import and on Kepler even though it was written on the Juno Eclipse).
-My application imports the support package v7-compat (which worked before all the changes)
I've been stuck on this problem for a few days now and with no luck. Any and all help would be appreciated. Oh and if anyone needs more information to help me solve this just ask.
Edit:
Here is the error log:
01-27 19:22:59.603: E/AndroidRuntime(16471): FATAL EXCEPTION: main
01-27 19:22:59.603: E/AndroidRuntime(16471): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.Spit.pocketbook/com.Spit.pocketbook.SwipeActivity}: java.lang.ClassNotFoundException: com.Spit.pocketbook.SwipeActivity
01-27 19:22:59.603: E/AndroidRuntime(16471): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2034)
01-27 19:22:59.603: E/AndroidRuntime(16471): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)
01-27 19:22:59.603: E/AndroidRuntime(16471): at android.app.ActivityThread.access$700(ActivityThread.java:143)
01-27 19:22:59.603: E/AndroidRuntime(16471): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1241)
01-27 19:22:59.603: E/AndroidRuntime(16471): at android.os.Handler.dispatchMessage(Handler.java:99)
01-27 19:22:59.603: E/AndroidRuntime(16471): at android.os.Looper.loop(Looper.java:137)
01-27 19:22:59.603: E/AndroidRuntime(16471): at android.app.ActivityThread.main(ActivityThread.java:4950)
01-27 19:22:59.603: E/AndroidRuntime(16471): at java.lang.reflect.Method.invokeNative(Native Method)
01-27 19:22:59.603: E/AndroidRuntime(16471): at java.lang.reflect.Method.invoke(Method.java:511)
01-27 19:22:59.603: E/AndroidRuntime(16471): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1004)
01-27 19:22:59.603: E/AndroidRuntime(16471): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:771)
01-27 19:22:59.603: E/AndroidRuntime(16471): at dalvik.system.NativeStart.main(Native Method)
01-27 19:22:59.603: E/AndroidRuntime(16471): Caused by: java.lang.ClassNotFoundException: com.Spit.pocketbook.SwipeActivity
01-27 19:22:59.603: E/AndroidRuntime(16471): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
01-27 19:22:59.603: E/AndroidRuntime(16471): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
01-27 19:22:59.603: E/AndroidRuntime(16471): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
01-27 19:22:59.603: E/AndroidRuntime(16471): at android.app.Instrumentation.newActivity(Instrumentation.java:1068)
01-27 19:22:59.603: E/AndroidRuntime(16471): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2025)
01-27 19:22:59.603: E/AndroidRuntime(16471): ... 11 more
Thanks ahead of time,
Spit
A class that was declared in manifest was not found in code.
Check that package and class names are the same in your manifest and code. Based on the stacktrace generated by data in your manifest, your code should have class SwipeActivity in package com.Spit.pocketbook. Note that class and package names are case sensitive. By convention, package names are all lowercase so the capital S in the package name looks suspicious.

NPE for button in Custom ListView

I have a custom listview, each cell has 5 textviews and 2 button. Somehow when i scroll i get NPE for the button in the getView method. Pasting the log
01-27 08:15:40.654: D/AndroidRuntime(15471): Shutting down VM
01-27 08:15:40.654: W/dalvikvm(15471): threadid=1: thread exiting with uncaught exception (group=0x40c181f8)
01-27 08:15:40.662: E/AndroidRuntime(15471): FATAL EXCEPTION: main
01-27 08:15:40.662: E/AndroidRuntime(15471): java.lang.NullPointerException
01-27 08:15:40.662: E/AndroidRuntime(15471): at com.example.collegesoft.ViewAttendance$MyAdapter.getView(ViewAttendance.java:158)
01-27 08:15:40.662: E/AndroidRuntime(15471): at android.widget.AbsListView.obtainView(AbsListView.java:2189)
01-27 08:15:40.662: E/AndroidRuntime(15471): at android.widget.ListView.makeAndAddView(ListView.java:1772)
01-27 08:15:40.662: E/AndroidRuntime(15471): at android.widget.ListView.fillDown(ListView.java:672)
01-27 08:15:40.662: E/AndroidRuntime(15471): at android.widget.ListView.fillGap(ListView.java:636)
01-27 08:15:40.662: E/AndroidRuntime(15471): at android.widget.AbsListView.trackMotionScroll(AbsListView.java:5312)
01-27 08:15:40.662: E/AndroidRuntime(15471): at android.widget.AbsListView.scrollIfNeeded(AbsListView.java:3050)
01-27 08:15:40.662: E/AndroidRuntime(15471): at android.widget.AbsListView.onTouchEvent(AbsListView.java:3391)
01-27 08:15:40.662: E/AndroidRuntime(15471): at android.view.View.dispatchTouchEvent(View.java:5588)
01-27 08:15:40.662: E/AndroidRuntime(15471): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1962)
01-27 08:15:40.662: E/AndroidRuntime(15471): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1723)
01-27 08:15:40.662: E/AndroidRuntime(15471): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1968)
01-27 08:15:40.662: E/AndroidRuntime(15471): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1737)
01-27 08:15:40.662: E/AndroidRuntime(15471): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1968)
01-27 08:15:40.662: E/AndroidRuntime(15471): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1737)
01-27 08:15:40.662: E/AndroidRuntime(15471): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1968)
01-27 08:15:40.662: E/AndroidRuntime(15471): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1737)
01-27 08:15:40.662: E/AndroidRuntime(15471): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1968)
01-27 08:15:40.662: E/AndroidRuntime(15471): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1737)
01-27 08:15:40.662: E/AndroidRuntime(15471): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2060)
01-27 08:15:40.662: E/AndroidRuntime(15471): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1398)
01-27 08:15:40.662: E/AndroidRuntime(15471): at android.app.Activity.dispatchTouchEvent(Activity.java:2364)
01-27 08:15:40.662: E/AndroidRuntime(15471): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2008)
01-27 08:15:40.662: E/AndroidRuntime(15471): at android.view.View.dispatchPointerEvent(View.java:5768)
01-27 08:15:40.662: E/AndroidRuntime(15471): at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:2957)
01-27 08:15:40.662: E/AndroidRuntime(15471): at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2531)
01-27 08:15:40.662: E/AndroidRuntime(15471): at android.view.ViewRootImpl.processInputEvents(ViewRootImpl.java:898)
01-27 08:15:40.662: E/AndroidRuntime(15471): at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2540)
01-27 08:15:40.662: E/AndroidRuntime(15471): at android.os.Handler.dispatchMessage(Handler.java:99)
01-27 08:15:40.662: E/AndroidRuntime(15471): at android.os.Looper.loop(Looper.java:137)
01-27 08:15:40.662: E/AndroidRuntime(15471): at android.app.ActivityThread.main(ActivityThread.java:4514)
01-27 08:15:40.662: E/AndroidRuntime(15471): at java.lang.reflect.Method.invokeNative(Native Method)
01-27 08:15:40.662: E/AndroidRuntime(15471): at java.lang.reflect.Method.invoke(Method.java:511)
01-27 08:15:40.662: E/AndroidRuntime(15471): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
01-27 08:15:40.662: E/AndroidRuntime(15471): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
01-27 08:15:40.662: E/AndroidRuntime(15471): at dalvik.system.NativeStart.main(Native Method)
Any Help would be appreciated. Lemme know if u want to c the code.
Thanx
I found the answer. It was silly mistake. For the buttons i used to use setId() method. Then i changed it to setTag() and everything worked like charm.
Thanx anyways

Crash in AndEngine

I'm using the book Learning Android Game Programming to learn andengine but I can't seem to get to square one.
I'm using eclipse, I've installed the sdk and platforms 4 8 10 and 15.
I've downloaded chapter 2 from this books' website.
When I run it, it crashes and I get the logcat below.
Please help, I've been stuck on this for over a week.
01-27 15:14:31.519: I/System.out(17507): Sending WAIT chunk
01-27 15:14:31.519: W/ActivityThread(17507): Application com.pearson.lagp.v3 is waiting for the debugger on port 8100...
01-27 15:14:32.149: I/dalvikvm(17507): Debugger is active
01-27 15:14:32.319: I/System.out(17507): Debugger has connected
01-27 15:14:32.319: I/System.out(17507): waiting for debugger to settle...
01-27 15:14:32.520: I/System.out(17507): waiting for debugger to settle...
01-27 15:14:32.720: I/System.out(17507): waiting for debugger to settle...
01-27 15:14:32.920: I/System.out(17507): waiting for debugger to settle...
01-27 15:14:33.130: I/System.out(17507): waiting for debugger to settle...
01-27 15:14:33.330: I/System.out(17507): waiting for debugger to settle...
01-27 15:14:33.531: I/System.out(17507): waiting for debugger to settle...
01-27 15:14:33.731: I/System.out(17507): waiting for debugger to settle...
01-27 15:14:33.931: I/System.out(17507): waiting for debugger to settle...
01-27 15:14:34.131: I/System.out(17507): debugger has settled (1324)
01-27 15:14:34.482: D/dalvikvm(17507): threadid=1: still suspended after undo (sc=1 dc=1)
01-27 15:15:12.048: D/AndroidRuntime(17507): Shutting down VM
01-27 15:15:12.048: W/dalvikvm(17507): threadid=1: thread exiting with uncaught exception (group=0x4001e578)
01-27 15:15:12.108: E/AndroidRuntime(17507): FATAL EXCEPTION: main
01-27 15:15:12.108: E/AndroidRuntime(17507): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.pearson.lagp.v3/com.pearson.lagp.v3.StartActivity}: java.lang.ClassNotFoundException: com.pearson.lagp.v3.StartActivity in loader dalvik.system.PathClassLoader[/data/app/com.pearson.lagp.v3-1.apk]
01-27 15:15:12.108: E/AndroidRuntime(17507): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1573)
01-27 15:15:12.108: E/AndroidRuntime(17507): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
01-27 15:15:12.108: E/AndroidRuntime(17507): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
01-27 15:15:12.108: E/AndroidRuntime(17507): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
01-27 15:15:12.108: E/AndroidRuntime(17507): at android.os.Handler.dispatchMessage(Handler.java:99)
01-27 15:15:12.108: E/AndroidRuntime(17507): at android.os.Looper.loop(Looper.java:130)
01-27 15:15:12.108: E/AndroidRuntime(17507): at android.app.ActivityThread.main(ActivityThread.java:3691)
01-27 15:15:12.108: E/AndroidRuntime(17507): at java.lang.reflect.Method.invokeNative(Native Method)
01-27 15:15:12.108: E/AndroidRuntime(17507): at java.lang.reflect.Method.invoke(Method.java:507)
01-27 15:15:12.108: E/AndroidRuntime(17507): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:907)
01-27 15:15:12.108: E/AndroidRuntime(17507): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:665)
01-27 15:15:12.108: E/AndroidRuntime(17507): at dalvik.system.NativeStart.main(Native Method)
01-27 15:15:12.108: E/AndroidRuntime(17507): Caused by: java.lang.ClassNotFoundException: com.pearson.lagp.v3.StartActivity in loader dalvik.system.PathClassLoader[/data/app/com.pearson.lagp.v3-1.apk]
01-27 15:15:12.108: E/AndroidRuntime(17507): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
01-27 15:15:12.108: E/AndroidRuntime(17507): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
01-27 15:15:12.108: E/AndroidRuntime(17507): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
01-27 15:15:12.108: E/AndroidRuntime(17507): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
01-27 15:15:12.108: E/AndroidRuntime(17507): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1565)
01-27 15:15:12.108: E/AndroidRuntime(17507): ... 11 more
It is classnotfoundexception, I suspect the package name you have in manifest.xml is different from the package you declared for activity.

Categories

Resources