android 4.0.3 ScrollingTabContainerView NullPointerException - android

Our Android Application randomly crashes (very hard to repro the issue) with the following stack trace . This is seen when the orientation of the device is changed from portrait to landscape from the logcat logs. Also this issue has been seen on devices with Android 4.0.3 version. So wanted to check if it is a known issue with 4.0.3? Not sure from the code how to debug this issue as the stack trace is entirely of Android platform with no involvement of App code.
02-21 17:44:01.761 E/UncaughtException( 3344): java.lang.NullPointerException
02-21 17:44:01.761 E/UncaughtException( 3344): at com.android.internal.widget.ScrollingTabContainerView.onItemSelected(ScrollingTabContainerView.java:352)
02-21 17:44:01.761 E/UncaughtException( 3344): at android.widget.AdapterView.fireOnSelected(AdapterView.java:882)
02-21 17:44:01.761 E/UncaughtException( 3344): at android.widget.AdapterView.selectionChanged(AdapterView.java:865)
02-21 17:44:01.761 E/UncaughtException( 3344): at android.widget.AdapterView.checkSelectionChanged(AdapterView.java:1017)
02-21 17:44:01.761 E/UncaughtException( 3344): at android.widget.AdapterView.handleDataChanged(AdapterView.java:999)
02-21 17:44:01.761 E/UncaughtException( 3344): at android.widget.AbsSpinner.onMeasure(AbsSpinner.java:179)
02-21 17:44:01.761 E/UncaughtException( 3344): at android.widget.Spinner.onMeasure(Spinner.java:285)
02-21 17:44:01.761 E/UncaughtException( 3344): at android.view.View.measure(View.java:12723)
02-21 17:44:01.761 E/UncaughtException( 3344): at android.widget.HorizontalScrollView.measureChildWithMargins(HorizontalScrollView.java:1159)
02-21 17:44:01.761 E/UncaughtException( 3344): at android.widget.FrameLayout.onMeasure(FrameLayout.java:293)
02-21 17:44:01.761 E/UncaughtException( 3344): at android.widget.HorizontalScrollView.onMeasure(HorizontalScrollView.java:303)
02-21 17:44:01.761 E/UncaughtException( 3344): at com.android.internal.widget.ScrollingTabContainerView.onMeasure(ScrollingTabContainerView.java:117)
02-21 17:44:01.761 E/UncaughtException( 3344): at android.view.View.measure(View.java:12723)
02-21 17:44:01.761 E/UncaughtException( 3344): at com.android.internal.widget.ActionBarView.onMeasure(ActionBarView.java:878)
02-21 17:44:01.761 E/UncaughtException( 3344): at android.view.View.measure(View.java:12723)
02-21 17:44:01.761 E/UncaughtException( 3344): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4698)
02-21 17:44:01.761 E/UncaughtException( 3344): at android.widget.FrameLayout.onMeasure(FrameLayout.java:293)
02-21 17:44:01.761 E/UncaughtException( 3344): at com.android.internal.widget.ActionBarContainer.onMeasure(ActionBarContainer.java:173)
02-21 17:44:01.761 E/UncaughtException( 3344): at android.view.View.measure(View.java:12723)
02-21 17:44:01.761 E/UncaughtException( 3344): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4698)
02-21 17:44:01.761 E/UncaughtException( 3344): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1369)
02-21 17:44:01.761 E/UncaughtException( 3344): at android.widget.LinearLayout.measureVertical(LinearLayout.java:660)
02-21 17:44:01.761 E/UncaughtException( 3344): at android.widget.LinearLayout.onMeasure(LinearLayout.java:553)
02-21 17:44:01.761 E/UncaughtException( 3344): at android.view.View.measure(View.java:12723)
02-21 17:44:01.761 E/UncaughtException( 3344): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4698)
02-21 17:44:01.761 E/UncaughtException( 3344): at android.widget.FrameLayout.onMeasure(FrameLayout.java:293)
02-21 17:44:01.761 E/UncaughtException( 3344): at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2092)
02-21 17:44:01.761 E/UncaughtException( 3344): at android.view.View.measure(View.java:12723)
02-21 17:44:01.761 E/UncaughtException( 3344): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1064)
02-21 17:44:01.761 E/UncaughtException( 3344): at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2442)
02-21 17:44:01.761 E/UncaughtException( 3344): at android.os.Handler.dispatchMessage(Handler.java:99)
02-21 17:44:01.761 E/UncaughtException( 3344): at android.os.Looper.loop(Looper.java:137)
02-21 17:44:01.761 E/UncaughtException( 3344): at android.app.ActivityThread.main(ActivityThread.java:4424)
02-21 17:44:01.761 E/UncaughtException( 3344): at java.lang.reflect.Method.invokeNative(Native Method)
02-21 17:44:01.761 E/UncaughtException( 3344): at java.lang.reflect.Method.invoke(Method.java:511)
02-21 17:44:01.761 E/UncaughtException( 3344): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
02-21 17:44:01.761 E/UncaughtException( 3344): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
02-21 17:44:01.761 E/UncaughtException( 3344): at dalvik.system.NativeStart.main(Native Method)

I really have no clue where this error is coming from. I fixed it by changing
<item name="android:windowActionBarOverlay">false</item>
into
<item name="android:windowActionBarOverlay">true</item>
in my main style for Android v15. It makes my app a little less beautiful for this Android version, but that is alright. I hope it's only a 4.0.3 bug, I have 6 tablets with other Android versions that are doing fine.

Related

My Android application crashes when navigating back to my application from other applications

I am working on android application, My application is crashing saying this message
'Unfortunately process "iTextSharpGeneric.ITextSharp" has stopped' when i am navigating form other application to my application. iTextSharpGeneric is my projoect name.
i found this excpetion in Adnroid device logging window:-
"java.lang.RunttimeException: Unable to instantiate activity ComponentInfo{com.iTextSharpGenericTest/iTextSharpGenericTest..TestActivity2}.java.lang.ClassNotFoundException"
Here is the scenari i am doing. In my application
ITextSharpGeneric--> Opening a pdf(using adobe reader)-> After Editing pdf In Adobe reader-> Selecting Share option-> Showing list of application-> I am selecting "iTextSharpGeneric" n the list of applications(to save that edited pdf details)-> "Application Crashes here"
I tried using the save OnSaveInstanceState() and OnRestoreInstanceState() for retaining the acitivity state. But still getting the same issue.
Here is my intent filters tags in AndroidManifest.xml
activity android:name="com.iTextSharpGenericTest.Activity2" android:label="iTextSharp"
intent-filter
action android:name="android.intent.action.MAIN"
action android:name="android.intent.action.SEND"
action android:name="android.intent.action.VIEW"
category android:name="android.intent.category.DEFAULT"
category android:name="android.intent.category.BROWSABLE"
data android:mimeType="application/pdf"
intent-filter
activity
What's wrong i am doing? Let me know you valueble suggesstions.
Here is the detailed log of exception, I just selected filter option"Android Runtime" in Android Device Logging Window.
02-21 14:31:33.000 E/AndroidRuntime( 5614): FATAL EXCEPTION: main
02-21 14:31:33.000 E/AndroidRuntime( 5614): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.iTextSharpGenericTest/iTextSharpGenericTest.Activity2}: java.lang.ClassNotFoundException: iTextSharpGenericTest.Activity2
02-21 14:31:33.000 E/AndroidRuntime( 5614): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1884)
02-21 14:31:33.000 E/AndroidRuntime( 5614): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1985)
02-21 14:31:33.000 E/AndroidRuntime( 5614): at android.app.ActivityThread.access$600(ActivityThread.java:127)
02-21 14:31:33.000 E/AndroidRuntime( 5614): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1151)
02-21 14:31:33.000 E/AndroidRuntime( 5614): at android.os.Handler.dispatchMessage(Handler.java:99)
02-21 14:31:33.000 E/AndroidRuntime( 5614): at android.os.Looper.loop(Looper.java:137)
02-21 14:31:33.000 E/AndroidRuntime( 5614): at android.app.ActivityThread.main(ActivityThread.java:4447)
02-21 14:31:33.000 E/AndroidRuntime( 5614): at java.lang.reflect.Method.invokeNative(Native Method)
02-21 14:31:33.000 E/AndroidRuntime( 5614): at java.lang.reflect.Method.invoke(Method.java:511)
02-21 14:31:33.000 E/AndroidRuntime( 5614): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
02-21 14:31:33.000 E/AndroidRuntime( 5614): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
02-21 14:31:33.000 E/AndroidRuntime( 5614): at dalvik.system.NativeStart.main(Native Method)
02-21 14:31:33.000 E/AndroidRuntime( 5614): Caused by: java.lang.ClassNotFoundException: iTextSharpGenericTest.Activity2
02-21 14:31:33.000 E/AndroidRuntime( 5614): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
02-21 14:31:33.000 E/AndroidRuntime( 5614): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
02-21 14:31:33.000 E/AndroidRuntime( 5614): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
02-21 14:31:33.000 E/AndroidRuntime( 5614): at android.app.Instrumentation.newActivity(Instrumentation.java:1066)
02-21 14:31:33.000 E/AndroidRuntime( 5614): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1875)
02-21 14:31:33.000 E/AndroidRuntime( 5614): ... 11 more
02-21 14:31:33.010 W/ActivityManager( 169): Force finishing activity com.iTextSharpGenericTest/iTextSharpGenericTest.Activity2
02-21 14:31:33.520 W/ActivityManager( 169): Activity pause timeout for ActivityRecord{4163ed28 com.iTextSharpGenericTest/iTextSharpGenericTest.Activity2}
02-21 14:31:33.650 D/OpenGLRenderer( 5215): Flushing caches (mode 0)
02-21 14:31:43.820 W/ActivityManager( 169): Activity destroy timeout for ActivityRecord{4163ed28 com.iTextSharpGenericTest/iTextSharpGenericTest.Activity2}
02-21 14:31:46.360 I/Process ( 5614): Sending signal. PID: 5614 SIG: 9
02-21 14:31:46.380 W/InputDispatcher( 169): channel '414cb888 com.iTextSharpGenericTest/itextsharpgenerictest.Activity1 (server)' ~ Consumer closed input channel or an error occurred. events=0x8
02-21 14:31:46.380 E/InputDispatcher( 169): channel '414cb888 com.iTextSharpGenericTest/itextsharpgenerictest.Activity1 (server)' ~ Channel is unrecoverably broken and will be disposed!
02-21 14:31:46.380 W/InputDispatcher( 169): Attempted to unregister already unregistered input channel '414cb888 com.iTextSharpGenericTest/itextsharpgenerictest.Activity1 (server)'
02-21 14:31:46.380 I/ActivityManager( 169): Process com.iTextSharpGenericTest (pid 5614) has died.
02-21 14:31:46.380 V/TabletStatusBar( 250): setLightsOn(true)
02-21 14:31:46.380 I/WindowManager( 169): WIN DEATH: Window{414cb888 com.iTextSharpGenericTest/itextsharpgenerictest.Activity1 paused=false}
02-21 14:31:46.390 I/WindowManager( 169): WINDOW DIED Window{414cb888 com.iTextSharpGenericTest/itextsharpgenerictest.Activity1 paused=false}
02-21 14:31:46.630 D/AndroidRuntime( 5645):
02-21 14:31:46.630 D/AndroidRuntime( 5645): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
02-21 14:31:46.630 D/AndroidRuntime( 5645): CheckJNI is OFF
02-21 14:31:46.870 D/AndroidRuntime( 5645): Calling main entry com.android.commands.am.Am
02-21 14:31:46.880 D/AndroidRuntime( 5645): Shutting down VM
02-21 14:31:46.880 I/AndroidRuntime( 5645): NOTE: attach of thread 'Binder Thread #3' failed
02-21 14:31:46.880 I/ActivityManager( 169): Force stopping package com.iTextSharpGenericTest uid=10086
02-21 14:31:46.880 I/ActivityManager( 169): Force finishing activity ActivityRecord{41291510 com.iTextSharpGenericTest/itextsharpgenerictest.Activity1}
02-21 14:31:46.890 D/dalvikvm( 5645): GC_CONCURRENT freed 96K, 83% free 450K/2560K, paused 1ms+0ms
02-21 14:32:29.770 D/dalvikvm( 250): GC_CONCURRENT freed 422K, 73% free 8194K/30151K, paused 2ms
Thanks
Sreeni
"iTextSharpGenericTest..TestActivity2}"
As you can see, you are actually passing your Intentfilter for you class wrong. There are 2 dots between iTextSharpGenericTest and TestActivity2.
May be that's the case why it is not able to detect your TestActivity2 class and hence throwing that error java.lang.ClassNotFoundException.
Hope this helps.

Android Library Project casting error on extended Application class

I am whitelabeling my app. To do this, I've:
Converted my Android Application Project into an Android Library Project. We'll call it com.mylibraryproject.app.
Created a new project. We'll call it com.example.testproject.
Added my Android Library Project as a library of my new Android Application Project.
Copied the manifest from my Android Library Project into the manifest for my new Android Application Project and referenced the Activities appropriately.
Example:
<activity
android:name="com.mylibraryproject.app.activity.MyActivity"
android:screenOrientation="portrait" >
</activity>
However, I'm having a crash when my new Android Application Project runs.
The library project contains a class, we'll call it MyApp, that extends Application. All over this project, there are references to (MyApp)getApplicationContext().
When the above line is hit, the below exception is thrown. How do I avoid this?
Update:
Here is the full onResume() method and log cat:
#Override
protected void onResume() {
super.onResume();
MyApp app = (MyApp)getApplication();
if (app.getUserId() == -1 && !app.getUserConnected() && app.loadLastUser()) {
updateDisplay();
} else if (!mBack && app.getUserConnected()) {
updateDisplay();
}
}
Here is the exception
02-21 13:13:11.169: E/AndroidRuntime(469): FATAL EXCEPTION: main
02-21 13:13:11.169: E/AndroidRuntime(469): java.lang.RuntimeException: Unable to resume activity {com.example.testproject/com.mylibraryproject.app.activity.MyActivity}: java.lang.ClassCastException: android.app.Application
02-21 13:13:11.169: E/AndroidRuntime(469): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2120)
02-21 13:13:11.169: E/AndroidRuntime(469): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2135)
02-21 13:13:11.169: E/AndroidRuntime(469): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1668)
02-21 13:13:11.169: E/AndroidRuntime(469): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
02-21 13:13:11.169: E/AndroidRuntime(469): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
02-21 13:13:11.169: E/AndroidRuntime(469): at android.os.Handler.dispatchMessage(Handler.java:99)
02-21 13:13:11.169: E/AndroidRuntime(469): at android.os.Looper.loop(Looper.java:130)
02-21 13:13:11.169: E/AndroidRuntime(469): at android.app.ActivityThread.main(ActivityThread.java:3683)
02-21 13:13:11.169: E/AndroidRuntime(469): at java.lang.reflect.Method.invokeNative(Native Method)
02-21 13:13:11.169: E/AndroidRuntime(469): at java.lang.reflect.Method.invoke(Method.java:507)
02-21 13:13:11.169: E/AndroidRuntime(469): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
02-21 13:13:11.169: E/AndroidRuntime(469): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
02-21 13:13:11.169: E/AndroidRuntime(469): at dalvik.system.NativeStart.main(Native Method)
02-21 13:13:11.169: E/AndroidRuntime(469): Caused by: java.lang.ClassCastException: android.app.Application
02-21 13:13:11.169: E/AndroidRuntime(469): at com.mylibraryproject.app.activity.MyActivity.onResume(MyActivity.java:277)
02-21 13:13:11.169: E/AndroidRuntime(469): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1150)
02-21 13:13:11.169: E/AndroidRuntime(469): at android.app.Activity.performResume(Activity.java:3832)
02-21 13:13:11.169: E/AndroidRuntime(469): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2110)
02-21 13:13:11.169: E/AndroidRuntime(469): ... 12 more
Line 277 is this line:
MyApp app = (MyApp)getApplication();
Application an ApplicationContext aren't the same thing. You need to cast a getApplication() result instead
Of course, casting just says that "I know this object is an xyz so let me treat it as that" ... it doesn't actually transmute one object into another type
Edit:
Change your onResume like below
#Override
protected void onResume() {
super.onResume();
MyApp app = (MyApp)getApplication();
if (app.getUserId() == -1 && !app.getUserConnected() && app.loadLastUser()) {
updateDisplay();
} else if (!mBack && app.getUserConnected()) {
updateDisplay();
}
}
<application android:name="com.mypackage.MyApp"
....>

Adding custom views dynamically in RelativeLayout

I am trying to add a custom view from xml to a RelativeLayout inside a ScrollView.
The custom View contains a couple of TextView. I set the text of the TextViews and set the width, height and topMargin of the view and add it to the relativeLayout. But i keep getting error and i dont know why.
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
RelativeLayout board = (RelativeLayout) findViewById(R.id.Dashboard);
List<Data> dummyData = new InitData().getDummyData();
for (Data data : dummyData) {
View view = null;
LayoutInflater inflater = LayoutInflater.from(MainActivity.this);
view = inflater.inflate(R.layout.my_view, board);
TextView titleTextView = (TextView) view
.findViewById(R.id.title_text_view);
titleTextView.setText(data.getTitle()); //I think error occurs here
int width = LayoutParams.MATCH_PARENT;
int height = data.getHeight();
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
width, height);
params.topMargin = data.getTopMargin();
view.setLayoutParams(params);
}
}
LogCat Error
02-21 20:33:56.903: E/AndroidRuntime(3322): FATAL EXCEPTION: main
02-21 20:33:56.903: E/AndroidRuntime(3322): java.lang.ClassCastException: android.widget.RelativeLayout$LayoutParams
02-21 20:33:56.903: E/AndroidRuntime(3322): at android.widget.LinearLayout.measureHorizontal(LinearLayout.java:654)
02-21 20:33:56.903: E/AndroidRuntime(3322): at android.widget.LinearLayout.onMeasure(LinearLayout.java:306)
02-21 20:33:56.903: E/AndroidRuntime(3322): at android.view.View.measure(View.java:8171)
02-21 20:33:56.903: E/AndroidRuntime(3322): at android.widget.ScrollView.measureChildWithMargins(ScrollView.java:989)
02-21 20:33:56.903: E/AndroidRuntime(3322): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
02-21 20:33:56.903: E/AndroidRuntime(3322): at android.widget.ScrollView.onMeasure(ScrollView.java:286)
02-21 20:33:56.903: E/AndroidRuntime(3322): at android.view.View.measure(View.java:8171)
02-21 20:33:56.903: E/AndroidRuntime(3322): at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:578)
02-21 20:33:56.903: E/AndroidRuntime(3322): at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:362)
02-21 20:33:56.903: E/AndroidRuntime(3322): at android.view.View.measure(View.java:8171)
02-21 20:33:56.903: E/AndroidRuntime(3322): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
02-21 20:33:56.903: E/AndroidRuntime(3322): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
02-21 20:33:56.903: E/AndroidRuntime(3322): at android.view.View.measure(View.java:8171)
02-21 20:33:56.903: E/AndroidRuntime(3322): at android.widget.LinearLayout.measureVertical(LinearLayout.java:526)
02-21 20:33:56.903: E/AndroidRuntime(3322): at android.widget.LinearLayout.onMeasure(LinearLayout.java:304)
02-21 20:33:56.903: E/AndroidRuntime(3322): at android.view.View.measure(View.java:8171)
02-21 20:33:56.903: E/AndroidRuntime(3322): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
02-21 20:33:56.903: E/AndroidRuntime(3322): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
02-21 20:33:56.903: E/AndroidRuntime(3322): at android.view.View.measure(View.java:8171)
02-21 20:33:56.903: E/AndroidRuntime(3322): at android.view.ViewRoot.performTraversals(ViewRoot.java:801)
02-21 20:33:56.903: E/AndroidRuntime(3322): at android.view.ViewRoot.handleMessage(ViewRoot.java:1727)
02-21 20:33:56.903: E/AndroidRuntime(3322): at android.os.Handler.dispatchMessage(Handler.java:99)
02-21 20:33:56.903: E/AndroidRuntime(3322): at android.os.Looper.loop(Looper.java:123)
02-21 20:33:56.903: E/AndroidRuntime(3322): at android.app.ActivityThread.main(ActivityThread.java:4627)
02-21 20:33:56.903: E/AndroidRuntime(3322): at java.lang.reflect.Method.invokeNative(Native Method)
02-21 20:33:56.903: E/AndroidRuntime(3322): at java.lang.reflect.Method.invoke(Method.java:521)
02-21 20:33:56.903: E/AndroidRuntime(3322): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
02-21 20:33:56.903: E/AndroidRuntime(3322): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
02-21 20:33:56.903: E/AndroidRuntime(3322): at dalvik.system.NativeStart.main(Native Method)
R.layout.my_view
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="#+id/title_text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/data_text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
Looks like you're using the wrong kind of LayoutParams. Be aware, that the LayoutParams must match the parent view you're adding your children to. So if you have e.g. a LinearLayout and want to add a RelativeLayout to it, you have to use the LinearLayout.LayoutParams, not the RelativeLayout.LayoutParams.

apk failed to install & logcat shows NoSuchMethodException

As mentioned in the title, when compiling, the Console says: Failed to install ap.apk
But the logcat shows this:
02-21 00:45:25.052: W/dalvikvm(921): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
02-21 00:45:25.272: E/AndroidRuntime(921): FATAL EXCEPTION: main
02-21 00:45:25.272: E/AndroidRuntime(921): java.lang.IllegalStateException: Could not find a method retour(View) in the activity class hd.android.contact.ContactActionActivity for onClick handler on view class android.widget.Button with id 'button5'
02-21 00:45:25.272: E/AndroidRuntime(921): at android.view.View$1.onClick(View.java:3031)
02-21 00:45:25.272: E/AndroidRuntime(921): at android.view.View.performClick(View.java:3511)
02-21 00:45:25.272: E/AndroidRuntime(921): at android.view.View$PerformClick.run(View.java:14105)
02-21 00:45:25.272: E/AndroidRuntime(921): at android.os.Handler.handleCallback(Handler.java:605)
02-21 00:45:25.272: E/AndroidRuntime(921): at android.os.Handler.dispatchMessage(Handler.java:92)
02-21 00:45:25.272: E/AndroidRuntime(921): at android.os.Looper.loop(Looper.java:137)
02-21 00:45:25.272: E/AndroidRuntime(921): at android.app.ActivityThread.main(ActivityThread.java:4424)
02-21 00:45:25.272: E/AndroidRuntime(921): at java.lang.reflect.Method.invokeNative(Native Method)
02-21 00:45:25.272: E/AndroidRuntime(921): at java.lang.reflect.Method.invoke(Method.java:511)
02-21 00:45:25.272: E/AndroidRuntime(921): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
02-21 00:45:25.272: E/AndroidRuntime(921): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
02-21 00:45:25.272: E/AndroidRuntime(921): at dalvik.system.NativeStart.main(Native Method)
**02-21 00:45:25.272: E/AndroidRuntime(921): Caused by: java.lang.NoSuchMethodException: retour [class android.view.View]**
02-21 00:45:25.272: E/AndroidRuntime(921): at java.lang.Class.getConstructorOrMethod(Class.java:460)
02-21 00:45:25.272: E/AndroidRuntime(921): at java.lang.Class.getMethod(Class.java:915)
02-21 00:45:25.272: E/AndroidRuntime(921): at android.view.View$1.onClick(View.java:3024)
I commented all my "retour" methods and deleted all android:onClick related to this method, and it did not help...Everything was working fine before...
Can anybody help please?
Thank you in advance
IllegalStateException: Could not find a method retour(View)
I think the problem is that you (definitely) have specified onClick on a method retour in the XML but the method
is not present in the Java code.
If the problem continues, try cleaning the project and shutting down your softphone.

i get allways this errors when i execute web service application, can you help me please?

02-21 14:00:32.442: W/WindowManager(88): Failure taking screenshot for (180x300) to layer 21010
02-21 14:00:32.621: W/NetworkManagementSocketTagger(88): setKernelCountSet(10004, 1) failed with errno -2
02-21 14:00:34.962: W/NetworkManagementSocketTagger(88): setKernelCountSet(10061, 0) failed with errno -2
02-21 14:00:38.403: D/AndroidRuntime(583): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
02-21 14:00:38.403: D/AndroidRuntime(583): CheckJNI is ON
02-21 14:00:40.521: D/AndroidRuntime(583): Calling main entry com.android.commands.pm.Pm
02-21 14:00:40.592: D/AndroidRuntime(583): Shutting down VM
02-21 14:00:40.611: I/AndroidRuntime(583): NOTE: attach of thread 'Binder Thread #3' failed
02-21 14:00:40.621: D/dalvikvm(583): GC_CONCURRENT freed 100K, 78% free 462K/2048K, paused 2ms+2ms
02-21 14:00:40.621: D/jdwp(583): Got wake-up signal, bailing out of select
02-21 14:00:40.621: D/dalvikvm(583): Debugger has detached; object registry had 1 entries
02-21 14:00:41.421: D/AndroidRuntime(596): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
02-21 14:00:41.421: D/AndroidRuntime(596): CheckJNI is ON
02-21 14:00:42.471: D/AndroidRuntime(596): Calling main entry com.android.commands.am.Am
02-21 14:00:42.521: I/ActivityManager(88): START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.pfe/.SoappActivity} from pid 596
02-21 14:00:42.531: W/WindowManager(88): Failure taking screenshot for (180x300) to layer 21005
02-21 14:00:42.611: W/NetworkManagementSocketTagger(88): setKernelCountSet(10061, 1) failed with errno -2
02-21 14:00:43.221: W/System.err(536): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:95)
02-21 14:00:42.661: I/AndroidRuntime(596): NOTE: attach of thread 'Binder Thread #3' failed
02-21 14:00:42.661: D/dalvikvm(596): GC_CONCURRENT freed 101K, 77% free 483K/2048K, paused 1ms+3ms
02-21 14:00:42.661: D/jdwp(596): Got wake-up signal, bailing out of select
02-21 14:00:42.671: D/dalvikvm(596): Debugger has detached; object registry had 1 entries
02-21 14:00:43.021: W/System.err(536): android.os.NetworkOnMainThreadException
02-21 14:00:43.021: W/System.err(536): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1084)
02-21 14:00:43.071: W/System.err(536): at java.net.InetAddress.lookupHostByName(InetAddress.java:391)
02-21 14:00:43.071: W/System.err(536): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:242)
02-21 14:00:43.081: W/System.err(536): at java.net.InetAddress.getAllByName(InetAddress.java:220)
02-21 14:00:43.081: W/System.err(536): at libcore.net.http.HttpConnection.<init>(HttpConnection.java:71)
02-21 14:00:43.081: W/System.err(536): at libcore.net.http.HttpConnection.<init>(HttpConnection.java:50)
02-21 14:00:43.127: W/System.err(536): at libcore.net.http.HttpConnection$Address.connect(HttpConnection.java:351)
02-21 14:00:43.127: W/System.err(536): at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:86)
02-21 14:00:43.131: W/System.err(536): at libcore.net.http.HttpConnection.connect(HttpConnection.java:128)
02-21 14:00:43.332: W/System.err(536): at dalvik.system.NativeStart.main(Native Method)
02-21 14:01:30.961: D/dalvikvm(536): GC_CONCURRENT freed 231K, 4% free 10112K/10503K, paused 23ms+23ms
02-21 14:04:36.751: D/gralloc_goldfish(640): Emulator without GPU emulation detected.
02-21 14:05:40.481: D/AndroidRuntime(640): Shutting down VM
02-21 14:05:40.481: W/dalvikvm(640): threadid=1: thread exiting with uncaught exception (group=0x409951f8)
02-21 14:05:40.571: E/AndroidRuntime(640): FATAL EXCEPTION: main
02-21 14:05:40.571: E/AndroidRuntime(640): java.lang.RuntimeException: Unable to create service com.pfe.MonService: java.lang.IllegalArgumentException: provider=network
02-21 14:05:40.571: E/AndroidRuntime(640): at android.app.ActivityThread.handleCreateService(ActivityThread.java:2262)
02-21 14:05:40.571: E/AndroidRuntime(640): at android.app.ActivityThread.access$1600(ActivityThread.java:122)
02-21 14:05:40.571: E/AndroidRuntime(640): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1200)
02-21 14:05:40.571: E/AndroidRuntime(640): at android.os.Handler.dispatchMessage(Handler.java:99)
02-21 14:05:40.571: E/AndroidRuntime(640): at android.os.Looper.loop(Looper.java:137)
02-21 14:05:40.571: E/AndroidRuntime(640): at android.app.ActivityThread.main(ActivityThread.java:4340)
02-21 14:05:40.571: E/AndroidRuntime(640): at java.lang.reflect.Method.invokeNative(Native Method)
02-21 14:05:40.571: E/AndroidRuntime(640): at java.lang.reflect.Method.invoke(Method.java:511)
02-21 14:05:40.571: E/AndroidRuntime(640): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
02-21 14:05:40.571: E/AndroidRuntime(640): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
02-21 14:05:40.571: E/AndroidRuntime(640): at dalvik.system.NativeStart.main(Native Method)
02-21 14:05:40.571: E/AndroidRuntime(640): Caused by: java.lang.IllegalArgumentException: provider=network
02-21 14:05:40.571: E/AndroidRuntime(640): at android.os.Parcel.readException(Parcel.java:1331)
02-21 14:05:40.571: E/AndroidRuntime(640): at android.os.Parcel.readException(Parcel.java:1281)
02-21 14:05:40.571: E/AndroidRuntime(640): at android.location.ILocationManager$Stub$Proxy.requestLocationUpdates(ILocationManager.java:646)
02-21 14:05:40.571: E/AndroidRuntime(640): at android.location.LocationManager._requestLocationUpdates(LocationManager.java:582)
02-21 14:05:40.571: E/AndroidRuntime(640): at android.location.LocationManager.requestLocationUpdates(LocationManager.java:446)
02-21 14:05:40.571: E/AndroidRuntime(640): at com.pfe.MonService.onCreate(MonService.java:58)
02-21 14:05:40.571: E/AndroidRuntime(640): at android.app.ActivityThread.handleCreateService(ActivityThread.java:2252)
02-21 14:05:40.571: E/AndroidRuntime(640): ... 10 more
You try to execute network call on main (UI) thread. This is not acceptable, because UI should be responsive and network calls are long in most cases. What you need is to run your code on the other thread using Thread class or AsyncTask. Also, you can check out this question for some details.

Categories

Resources