Android: Main Activity not found - android

my App was already running fine, but suddenly the main activity is not found any more. Don't have a clue why.
In the end I get java.lang.ClassNotFoundException: de.xxx.android.shopper.MyShopperActivity
I did a software update using the Android SDK manager. After that I get the error in this special app, all others are not affected.
My manifest
<uses-sdk android:minSdkVersion="11" android:targetSdkVersion="19"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:icon="#drawable/shoppericon2"
android:allowBackup="true"
android:label="#string/AppNameAppString" >
<activity
android:name=".MyShopperActivity"
android:label="#string/AppNameActivityString"
android:screenOrientation="portrait"
android:configChanges="orientation|keyboardHidden|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".MenuActivity" />
<activity
android:name="com.google.ads.AdActivity"
android:label="#string/AppNameActivityString"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
android:configChanges="orientation|keyboard|keyboardHidden|screenLayout|uiMode|screenSize|smallestScreenSize" />
</application>
The activity
package de.xxx.android.shopper;
import ...
#SuppressLint("ParserError")
public class MyShopperActivity extends Activity implements AdListener
{
...
}
This is what logcat says:
06-10 10:45:57.464: D/AndroidRuntime(1518): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
06-10 10:45:57.474: D/AndroidRuntime(1518): CheckJNI is ON
06-10 10:45:58.133: D/AndroidRuntime(1518): Calling main entry com.android.commands.pm.Pm
06-10 10:45:58.193: D/AndroidRuntime(1518): Shutting down VM
06-10 10:45:58.203: D/dalvikvm(1518): GC_CONCURRENT freed 100K, 78% free 454K/2048K, paused 1ms+4ms
06-10 10:45:58.213: D/dalvikvm(1518): Debugger has detached; object registry had 1 entries
06-10 10:45:58.623: D/AndroidRuntime(1532): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
06-10 10:45:58.623: D/AndroidRuntime(1532): CheckJNI is ON
06-10 10:45:59.244: D/AndroidRuntime(1532): Calling main entry com.android.commands.am.Am
06-10 10:45:59.284: I/ActivityManager(863): Force stopping package de.xxx.android.shopper uid=10039
06-10 10:45:59.284: I/ActivityManager(863): Killing proc 1500:de.xxx.android.shopper/10039: force stop
06-10 10:45:59.284: W/ActivityManager(863): Force removing ActivityRecord{b5cbedc0 de.xxx.android.shopper/.MyShopperActivity}: app died, no saved state
06-10 10:45:59.304: W/NetworkManagementSocketTagger(863): setKernelCountSet(10039, 0) failed with errno -2
06-10 10:45:59.314: W/NetworkManagementSocketTagger(863): setKernelCountSet(10012, 1) failed with errno -2
06-10 10:45:59.334: I/ActivityManager(863): START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=de.xxx.android.shopper/.MyShopperActivity} from pid 1532
06-10 10:45:59.384: D/AndroidRuntime(1532): Shutting down VM
06-10 10:45:59.414: D/dalvikvm(1532): GC_CONCURRENT freed 100K, 77% free 478K/2048K, paused 5ms+2ms
06-10 10:45:59.424: D/dalvikvm(1532): Debugger has detached; object registry had 1 entries
06-10 10:45:59.454: D/dalvikvm(1544): Not late-enabling CheckJNI (already on)
06-10 10:45:59.484: I/ActivityManager(863): Start proc de.xxx.android.shopper for activity de.xxx.android.shopper/.MyShopperActivity: pid=1544 uid=10039 gids={3003}
06-10 10:45:59.514: E/jdwp(1544): Failed writing handshake bytes: Broken pipe (-1 of 14)
06-10 10:45:59.514: D/dalvikvm(1544): Debugger has detached; object registry had 0 entries
06-10 10:45:59.554: W/NetworkManagementSocketTagger(863): setKernelCountSet(10039, 1) failed with errno -2
06-10 10:45:59.575: W/ActivityThread(1544): Application de.xxx.android.shopper is waiting for the debugger on port 8100...
06-10 10:45:59.575: I/System.out(1544): Sending WAIT chunk
06-10 10:46:00.307: I/dalvikvm(1544): Debugger is active
06-10 10:46:00.431: I/System.out(1544): Debugger has connected
06-10 10:46:00.431: I/System.out(1544): waiting for debugger to settle...
06-10 10:46:00.641: I/System.out(1544): waiting for debugger to settle...
06-10 10:46:00.778: W/ActivityManager(863): Launch timeout has expired, giving up wake lock!
06-10 10:46:00.850: I/System.out(1544): waiting for debugger to settle...
06-10 10:46:01.055: I/System.out(1544): waiting for debugger to settle...
06-10 10:46:01.267: I/System.out(1544): waiting for debugger to settle...
06-10 10:46:01.482: I/System.out(1544): waiting for debugger to settle...
06-10 10:46:01.688: I/System.out(1544): waiting for debugger to settle...
06-10 10:46:01.897: I/System.out(1544): waiting for debugger to settle...
06-10 10:46:02.103: I/System.out(1544): waiting for debugger to settle...
06-10 10:46:02.321: I/System.out(1544): waiting for debugger to settle...
06-10 10:46:02.535: I/System.out(1544): waiting for debugger to settle...
06-10 10:46:02.740: I/System.out(1544): debugger has settled (1314)
06-10 10:46:02.894: I/dalvikvm(1544): Failed resolving Lde/xxx/android/shopper/MyShopperActivity; interface 58 'Lcom/google/ads/AdListener;'
06-10 10:46:02.894: W/dalvikvm(1544): Link of class 'Lde/xxx/android/shopper/MyShopperActivity;' failed
06-10 10:46:04.593: W/NetworkManagementSocketTagger(863): setKernelCountSet(10012, 0) failed with errno -2
06-10 10:46:09.561: W/ActivityManager(863): Activity idle timeout for ActivityRecord{b5af65b8 de.xxx.android.shopper/.MyShopperActivity}

Hi i think ur parent package you noted in the manifest.xml and package name for the MyShopperActivity class is different. I hope that is the problem.

Related

Adding addmob adds to main.xml crashes my app

Let me start by saying that this app was working fine the day before. I have restarted the pc, removed the project and added a previous version of the project and it keeps crashing. If i remove this from main.xml which gets loaded from the mainactivity the app does not crash. If i have this in the main.xml :
<com.google.ads.AdView
android:id="#+id/adView"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="a14ee1ad68dcbdb"
ads:loadAdOnCreate="true" />
the app crashes. If i run the app and this code is not in the main.xml file but in other xml files the app works fine and it will show adds from other activities.
I tried removing all the code in the xml file and just have the above admob adds in there and it still crashed. I was thinking about uninstalling eclipse and installing it again???
Any ideas????
Here is a Everything from start to finish in logcat:
03-30 11:39:17.215: D/AndroidRuntime(338): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
03-30 11:39:17.215: D/AndroidRuntime(338): CheckJNI is ON
03-30 11:39:17.335: D/AndroidRuntime(338): --- registering native functions ---
03-30 11:39:17.825: D/AndroidRuntime(338): Shutting down VM
03-30 11:39:17.825: D/dalvikvm(338): Debugger has detached; object registry had 1 entries
03-30 11:39:17.845: I/AndroidRuntime(338): NOTE: attach of thread 'Binder Thread #3' failed
03-30 11:39:18.215: D/AndroidRuntime(346): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
03-30 11:39:18.215: D/AndroidRuntime(346): CheckJNI is ON
03-30 11:39:18.345: D/AndroidRuntime(346): --- registering native functions ---
03-30 11:39:18.835: I/ActivityManager(59): Force stopping package com.petermihaylov.android.cardcounter uid=10040
03-30 11:39:18.835: I/Process(59): Sending signal. PID: 331 SIG: 9
03-30 11:39:18.896: I/UsageStats(59): Unexpected resume of com.android.launcher while already resumed in com.petermihaylov.android.cardcounter
03-30 11:39:18.905: W/InputManagerService(59): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#45094eb8
03-30 11:39:18.945: I/ActivityManager(59): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.petermihaylov.android.cardcounter/.MainActivity }
03-30 11:39:18.945: D/AndroidRuntime(346): Shutting down VM
03-30 11:39:18.955: D/jdwp(346): Got wake-up signal, bailing out of select
03-30 11:39:18.955: D/dalvikvm(346): Debugger has detached; object registry had 1 entries
03-30 11:39:19.039: I/AndroidRuntime(346): NOTE: attach of thread 'Binder Thread #3' failed
03-30 11:39:19.155: I/ActivityManager(59): Start proc com.petermihaylov.android.cardcounter for activity com.petermihaylov.android.cardcounter/.MainActivity: pid=353 uid=10040 gids={3003}
03-30 11:39:19.345: D/dalvikvm(33): GC_EXPLICIT freed 285 objects / 10864 bytes in 186ms
03-30 11:39:19.475: W/ActivityThread(353): Application com.petermihaylov.android.cardcounter is waiting for the debugger on port 8100...
03-30 11:39:19.525: I/System.out(353): Sending WAIT chunk
03-30 11:39:19.565: I/dalvikvm(353): Debugger is active
03-30 11:39:19.595: D/dalvikvm(33): GC_EXPLICIT freed 47 objects / 2056 bytes in 249ms
03-30 11:39:19.745: I/System.out(353): Debugger has connected
03-30 11:39:19.745: I/System.out(353): waiting for debugger to settle...
03-30 11:39:19.945: I/System.out(353): waiting for debugger to settle...
03-30 11:39:20.075: D/dalvikvm(33): GC_EXPLICIT freed 2 objects / 64 bytes in 422ms
03-30 11:39:20.207: I/System.out(353): waiting for debugger to settle...
03-30 11:39:20.405: I/System.out(353): waiting for debugger to settle...
03-30 11:39:20.605: I/System.out(353): waiting for debugger to settle...
03-30 11:39:20.823: I/System.out(353): waiting for debugger to settle...
03-30 11:39:21.025: I/System.out(353): waiting for debugger to settle...
03-30 11:39:21.225: I/System.out(353): waiting for debugger to settle...
03-30 11:39:21.468: I/System.out(353): waiting for debugger to settle...
03-30 11:39:21.677: I/System.out(353): debugger has settled (1469)
03-30 11:39:29.005: W/ActivityManager(59): Launch timeout has expired, giving up wake lock!
03-30 11:39:29.421: W/ActivityManager(59): Activity idle timeout for HistoryRecord{450bae78 com.petermihaylov.android.cardcounter/.MainActivity}
Looks like you're trying to debug the app, and it's hanging on debug. Do you get any more relevant logs if you try to just run it?
Also, have you updated to r17 of the Android Tools by any chance? r17 of the tools force you to place the SDK in the libs/ folder of your project.
Are you sure you have stepped through a tutorial properly and added the permissions and imported the SDK?
Try stepping through this guide from the beginning:
https://developers.google.com/mobile-ads-sdk/docs/android/fundamentals
Cleaning the project in Eclipse sometimes solves some problems.
I had a very similar bizarre issue with Admob recently after a fresh install of Eclipse. After hours of looking into why, it ended up being my build order in the project preferences. I set the Google AdMob jar to the top, cleaned the project and all my issues were resolved.
The logcat text you have pasted does not give any error information. Can you paste the logcat text from the point of failure, generally you can see the communications with AdMob in here.
May help, just a thought.
New version of Android LED Clock just uploaded to the market
Jason

Android Application crashing before running. Intent Problem or else?

Problem is simple.
Two Activities. One throwing intent at other.
Project have name : "Stupidroid"
package : "com.examples.stupidroid"
activity : "stupidOnSteroids"
below is stupidOnSteroids .java
package com.examples.stupidroid;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class stupidOnSteroids extends Activity {
private Button buttonThatWillTakeYouPlacesButton;
private Intent intentThatwillTakeYouPlacesIntent;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
InitLayouts();
InitSetOnClickListeners();
}
private void InitSetOnClickListeners() {
buttonThatWillTakeYouPlacesButton.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
intentThatwillTakeYouPlacesIntent.setAction("");
}
});
}
private void InitLayouts() {
buttonThatWillTakeYouPlacesButton = (Button)findViewById(R.id.buttonThatWillGiveThyPowerButton);
intentThatwillTakeYouPlacesIntent = new Intent(stupidOnSteroids.this, Calc_print_codefile.class);
}
}
now is main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="right"
>
<Button android:id="#+id/goToOtherMoronButton"
android:text="Next Activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
></Button>
</LinearLayout>
now is another java file : Calc_print_codefile.java
package com.examples.stupidroid;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class Calc_print_codefile extends Activity{
Button buttonThatWillHelpYouCalculateButton;
TextView textThatWillTakeTheHitText;
Button buttonThatWillTakeYouHomeButton;
Intent intentThatWillTakeYouHomeIntent;
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.calc_prin_layout);
InitLayouts();
InitSetOnClickListener();
}
private void InitSetOnClickListener() {
buttonThatWillHelpYouCalculateButton.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
for(int i=0; i<32000; i++){
textThatWillTakeTheHitText.setText(i);
}
}
});
}
private void InitLayouts() {
buttonThatWillHelpYouCalculateButton = (Button)findViewById(R.id.buttonThatWillGiveThyPowerButton);
textThatWillTakeTheHitText = (TextView)findViewById(R.id.textThatWillAbsolveThyText);
intentThatWillTakeYouHomeIntent = new Intent(Calc_print_codefile.this, stupidOnSteroids.class);
}
}
corresponding xml : calc_prin_layout.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView android:id="#+id/textThatWillAbsolveThyText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=" "
/>
<Button android:id="#+id/buttonThatWillGiveThyPowerButton"
android:text="Press ME, hard!"
android:layout_width="fill_parent"
android:layout_height="wrap_content"></Button>
</LinearLayout>
below is AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.examples.stupidroid"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".stupidOnSteroids"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="Calc_print_codefile"></activity>
</application>
<uses-sdk android:minSdkVersion="8" />
</manifest>
Here are images (actually one only):
now is information from DDMS
07-29 14:13:31.344: WARN/ActivityThread(379): Application com.examples.stupidroid is waiting for the debugger on port 8100...
07-29 14:13:31.374: INFO/System.out(379): Sending WAIT chunk
07-29 14:13:31.434: INFO/dalvikvm(379): Debugger is active
07-29 14:13:31.594: INFO/System.out(379): Debugger has connected
07-29 14:13:31.604: INFO/System.out(379): waiting for debugger to settle...
07-29 14:13:31.804: INFO/System.out(379): waiting for debugger to settle...
07-29 14:13:31.824: DEBUG/dalvikvm(33): GC_EXPLICIT freed 2 objects / 64 bytes in 556ms
07-29 14:13:32.038: INFO/System.out(379): waiting for debugger to settle...
07-29 14:13:32.296: INFO/System.out(379): waiting for debugger to settle...
07-29 14:13:32.444: WARN/ActivityManager(60): Activity destroy timeout for HistoryRecord{440534a8 com.examples.stupidroid/.stupidOnSteroids}
07-29 14:13:32.494: INFO/System.out(379): waiting for debugger to settle...
07-29 14:13:32.694: INFO/System.out(379): waiting for debugger to settle...
07-29 14:13:32.894: INFO/System.out(379): waiting for debugger to settle...
07-29 14:13:33.113: INFO/System.out(379): waiting for debugger to settle...
07-29 14:13:33.356: INFO/System.out(379): waiting for debugger to settle...
07-29 14:13:33.574: INFO/System.out(379): waiting for debugger to settle...
07-29 14:13:33.795: INFO/System.out(379): waiting for debugger to settle...
07-29 14:13:34.008: INFO/System.out(379): waiting for debugger to settle...
07-29 14:13:34.215: INFO/System.out(379): waiting for debugger to settle...
07-29 14:13:34.423: INFO/System.out(379): waiting for debugger to settle...
07-29 14:13:34.634: INFO/System.out(379): waiting for debugger to settle...
07-29 14:13:34.868: INFO/System.out(379): debugger has settled (1504)
07-29 14:13:40.587: WARN/ActivityManager(60): Launch timeout has expired, giving up wake lock!
07-29 14:13:41.254: WARN/ActivityManager(60): Activity idle timeout for HistoryRecord{44078b28 com.examples.stupidroid/.stupidOnSteroids}
07-29 14:13:46.454: DEBUG/dalvikvm(135): GC_EXPLICIT freed 1190 objects / 62584 bytes in 179ms
07-29 14:13:57.363: DEBUG/dalvikvm(60): GC_FOR_MALLOC freed 12320 objects / 698248 bytes in 153ms
07-29 14:13:58.423: DEBUG/AndroidRuntime(379): Shutting down VM
07-29 14:13:58.423: WARN/dalvikvm(379): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
**07-29 14:13:58.543: ERROR/AndroidRuntime(379): FATAL EXCEPTION: main
07-29 14:13:58.543: ERROR/AndroidRuntime(379): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.examples.stupidroid/com.examples.stupidroid.stupidOnSteroids}: java.lang.NullPointerException**
07-29 14:13:58.543: ERROR/AndroidRuntime(379): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
07-29 14:13:58.543: ERROR/AndroidRuntime(379): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
07-29 14:13:58.543: ERROR/AndroidRuntime(379): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
07-29 14:13:58.543: ERROR/AndroidRuntime(379): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
07-29 14:13:58.543: ERROR/AndroidRuntime(379): at android.os.Handler.dispatchMessage(Handler.java:99)
07-29 14:13:58.543: ERROR/AndroidRuntime(379): at android.os.Looper.loop(Looper.java:123)
07-29 14:13:58.543: ERROR/AndroidRuntime(379): at android.app.ActivityThread.main(ActivityThread.java:4627)
07-29 14:13:58.543: ERROR/AndroidRuntime(379): at java.lang.reflect.Method.invokeNative(Native Method)
07-29 14:13:58.543: ERROR/AndroidRuntime(379): at java.lang.reflect.Method.invoke(Method.java:521)
07-29 14:13:58.543: ERROR/AndroidRuntime(379): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-29 14:13:58.543: ERROR/AndroidRuntime(379): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-29 14:13:58.543: ERROR/AndroidRuntime(379): at dalvik.system.NativeStart.main(Native Method)
07-29 14:13:58.543: ERROR/AndroidRuntime(379): Caused by: java.lang.NullPointerException
07-29 14:13:58.543: ERROR/AndroidRuntime(379): at com.examples.stupidroid.stupidOnSteroids.InitSetOnClickListeners(stupidOnSteroids.java:20)
07-29 14:13:58.543: ERROR/AndroidRuntime(379): at com.examples.stupidroid.stupidOnSteroids.onCreate(stupidOnSteroids.java:17)
07-29 14:13:58.543: ERROR/AndroidRuntime(379): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
07-29 14:13:58.543: ERROR/AndroidRuntime(379): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
07-29 14:13:58.543: ERROR/AndroidRuntime(379): ... 11 more
07-29 14:13:58.613: WARN/ActivityManager(60): Force finishing activity com.examples.stupidroid/.stupidOnSteroids
07-29 14:13:59.128: WARN/ActivityManager(60): Activity pause timeout for HistoryRecord{44078b28 com.examples.stupidroid/.stupidOnSteroids}
07-29 14:14:09.273: WARN/ActivityManager(60): Activity destroy timeout for HistoryRecord{44078b28 com.examples.stupidroid/.stupidOnSteroids}
07-29 14:14:13.443: INFO/Process(379): Sending signal. PID: 379 SIG: 9
07-29 14:14:13.465: INFO/ActivityManager(60): Process com.examples.stupidroid (pid 379) has died.
07-29 14:14:13.483: WARN/InputManagerService(60): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#43ef9a68
Please tell me what can I do? I have followed same approach the other guy followed. My other project is working. what can it be? is it wrong nomenclature or what?
From my past experiences, it looks like very small very narrow mistake , might be silly, still can't put my finger at it.
Thanks for spending time reading this.
And oh, if I remove InitSetOnClickListeners(); from stupidOnSteroids.java file, I can at least see a button. So, there might be error.
You initializing of your button is wrong. In your main xml you don't have a button with the id R.id.buttonThatWillGiveThyPowerButton. You should change it to
R.id.goToOtherMoronButton.
You should take the time you spend to create this question to read the stacktrace (it says where to find the null pointer) and than spend the rest of the time to debug (if it is more complex than the simple null pointer). But a plus point for the quality of your question. Everything is there... code, log, pictures :)
Change:
textThatWillTakeTheHitText.setText(i);
to:
textThatWillTakeTheHitText.setText(String.valueOf(i));
Make sure that this line:
buttonThatWillTakeYouPlacesButton = (Button)findViewById(R.id.buttonThatWillGiveThyPowerButton);
Actually returns something and not just null.

Why Internet Application not installed on emulator?

I have created an android application which plays music from the Internet.
It is working properly when I run it from eclipse, but when I try to start the application from emulator by clicking icon on emulator, it shows a Toast, saying "Application is not installed on your phone".
I don't understand the reason. Can someone help me out?
07-27 18:40:17.543: DEBUG/AndroidRuntime(537): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
07-27 18:40:17.543: DEBUG/AndroidRuntime(537): CheckJNI is ON
07-27 18:40:19.543: DEBUG/AndroidRuntime(537): Calling main entry com.android.commands.pm.Pm
07-27 18:40:19.683: DEBUG/AndroidRuntime(537): Shutting down VM
07-27 18:40:19.703: INFO/AndroidRuntime(537): NOTE: attach of thread 'Binder Thread #4' failed
07-27 18:40:19.715: DEBUG/dalvikvm(537): GC_CONCURRENT freed 100K, 72% free 296K/1024K, external 0K/0K, paused 2ms+4ms
07-27 18:40:19.715: DEBUG/jdwp(537): Got wake-up signal, bailing out of select
07-27 18:40:19.715: DEBUG/dalvikvm(537): Debugger has detached; object registry had 1 entries
07-27 18:40:20.283: DEBUG/AndroidRuntime(548): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
07-27 18:40:20.283: DEBUG/AndroidRuntime(548): CheckJNI is ON
07-27 18:40:21.193: DEBUG/AndroidRuntime(548): Calling main entry com.android.commands.am.Am
07-27 18:40:21.233: INFO/ActivityManager(61): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.nine.patch/.Patch } from pid 548
07-27 18:40:21.303: DEBUG/AndroidRuntime(548): Shutting down VM
07-27 18:40:21.383: INFO/AndroidRuntime(548): NOTE: attach of thread 'Binder Thread #3' failed
07-27 18:40:21.799: DEBUG/dalvikvm(548): GC_CONCURRENT freed 102K, 69% free 319K/1024K, external 0K/0K, paused 1ms+2ms
07-27 18:40:21.799: DEBUG/jdwp(548): Got wake-up signal, bailing out of select
07-27 18:40:21.799: DEBUG/dalvikvm(548): Debugger has detached; object registry had 1 entries
07-27 18:40:22.583: DEBUG/dalvikvm(467): GC_EXTERNAL_ALLOC freed 4K, 53% free 2564K/5379K, external 2626K/3030K, paused 67ms
07-27 18:40:22.653: DEBUG/MediaPlayer(467): Couldn't open file on client side, trying server side
07-27 18:40:22.653: INFO/StagefrightPlayer(34): setDataSource('http://www.perlgurl.org/podcast/archives/podcasts/PerlgurlPromo.mp3')
07-27 18:40:22.664: INFO/NuHTTPDataSource(34): connect to www.perlgurl.org:80/podcast/archives/podcasts/PerlgurlPromo.mp3 #0
07-27 18:40:31.286: WARN/ActivityManager(61): Launch timeout has expired, giving up wake lock!
07-27 18:40:31.356: WARN/ActivityManager(61): Activity idle timeout for HistoryRecord{407f6138 com.nine.patch/.Patch}
07-27 18:40:31.706: DEBUG/AudioSink(34): bufferCount (4) is too small and increased to 12
07-27 18:40:32.073: INFO/ActivityManager(61): Displayed com.nine.patch/.Patch: +10s81ms
07-27 18:40:32.667: WARN/AudioFlinger(34): write blocked for 87 msecs, 1437 delayed writes, thread 0xc650
07-27 18:40:34.757: INFO/NuCachedSource2(34): ERROR_END_OF_STREAM
07-27 18:40:37.223: DEBUG/dalvikvm(140): GC_EXPLICIT freed 85K, 51% free 2950K/5959K, external 6050K/7443K, paused 81ms
07-27 18:40:37.696: WARN/AudioFlinger(34): write blocked for 72 msecs, 1493 delayed writes, thread 0xc650
07-27 18:40:42.715: WARN/AudioFlinger(34): write blocked for 71 msecs, 1557 delayed writes, thread 0xc650
07-27 18:40:47.728: WARN/AudioFlinger(34): write blocked for 71 msecs, 1620 delayed writes, thread 0xc650
07-27 18:40:52.731: WARN/AudioFlinger(34): write blocked for 71 msecs, 1684 delayed writes, thread 0xc650
07-27 18:40:57.752: WARN/AudioFlinger(34): write blocked for 71 msecs, 1748 delayed writes, thread 0xc650
07-27 18:41:02.791: WARN/AudioFlinger(34): write blocked for 73 msecs, 1809 delayed writes, thread 0xc650
07-27 18:41:07.803: WARN/AudioFlinger(34): write blocked for 75 msecs, 1874 delayed writes, thread 0xc650
07-27 18:41:11.637: ERROR/MP3Extractor(34): Unable to resync. Signalling end of stream.
That's the LogCat output.
Following is my Manifest xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.nine.patch"
android:installLocation="preferExternal"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="9" />
<application android:icon="#drawable/icon" android:label="#string/app_name" android:permission="android.permission.INTERNET" android:debuggable="false">
<activity android:name=".Patch"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
One thing you can do - painful but should work - is to create another application, dead simple, which does next to nothing. That should install and work. Then start looking at every last difference between your working and non-working apps. Potentially including just moving all your code over to the new one.
I've seen something like this happen when there was a desktop shortcut icon pointing to an old and no longer present version of the app.
Try trashing any desktop shortcuts and launching from the app drawer.
NOTE: this didn't work

textview keeps crashing while trying to setText

I'm trying to create an application such that when I click on a button in the 1st layout, it will extract the text from an EditText and place that value into a TextView from the 2nd layout. However, it seems that the application will crash because of the setText for the TextView.
I didn't put the logCat as it doesn't tell much. I believe that the error comes from the setText part. But I have no idea on how to fix that part, or maybe that my way of coding is wrong. Hope that someone will help me. Thanks in advance.
<TextView android:id="#+id/showtitle"
android:layout_marginTop="1dip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:textStyle="bold" />
<TextView android:id="#+id/showtemplate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/showtitle"
android:layout_alignLeft="#+id/showtitle"
android:paddingBottom="4dip"
android:includeFontPadding="false"
android:textSize="15sp"
android:textStyle="normal" />
Below is my java code:
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.widget.EditText;
import android.widget.Button;
import android.widget.Toast;
import android.app.Activity;
public class AndroidGroupSMS extends Activity{
private EditText title;
private EditText template;
private Button btnsave;
private Button btnload;
private TextView text,text2;
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
title = (EditText) findViewById(R.id.title);
template = (EditText) findViewById(R.id.template);
btnsave = (Button) findViewById(R.id.save);
btnload = (Button) findViewById(R.id.load);
text = (TextView) findViewById(R.id.showtitle);
text2 = (TextView) findViewById(R.id.showtemplate);
btnsave.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
String sTitle = title.getText().toString();
String sTemplate = template.getText().toString();
if(sTitle.length() > 0 && sTemplate.length() > 0)
{
//this is where i'm setting the text extracted from the edittext boxes
text.setText(sTitle.toString());
text2.setText(sTemplate.toString());
}
else
Toast.makeText(getBaseContext(),"Please enter the title and template" + "", Toast.LENGTH_SHORT).show();
}
});
}
I have no idea how to read this.
Below is my logCat as requested:
11-12 04:32:51.652: DEBUG/AndroidRuntime(283): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
11-12 04:32:51.662: DEBUG/AndroidRuntime(283): CheckJNI is ON
11-12 04:32:51.982: DEBUG/AndroidRuntime(283): --- registering native functions ---
11-12 04:32:52.464: DEBUG/ddm-heap(283): Got feature list request
11-12 04:32:53.092: DEBUG/AndroidRuntime(283): Shutting down VM
11-12 04:32:53.102: DEBUG/dalvikvm(283): DestroyJavaVM waiting for non-daemon threads to exit
11-12 04:32:53.102: DEBUG/dalvikvm(283): DestroyJavaVM shutting VM down
11-12 04:32:53.102: DEBUG/dalvikvm(283): HeapWorker thread shutting down
11-12 04:32:53.112: DEBUG/dalvikvm(283): HeapWorker thread has shut down
11-12 04:32:53.112: DEBUG/jdwp(283): JDWP shutting down net...
11-12 04:32:53.122: INFO/dalvikvm(283): Debugger has detached; object registry had 1 entries
11-12 04:32:53.132: DEBUG/dalvikvm(283): VM cleaning up
11-12 04:32:53.192: DEBUG/dalvikvm(283): LinearAlloc 0x0 used 629532 of 5242880 (12%)
11-12 04:32:53.842: DEBUG/AndroidRuntime(291): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
11-12 04:32:53.842: DEBUG/AndroidRuntime(291): CheckJNI is ON
11-12 04:32:54.182: DEBUG/AndroidRuntime(291): --- registering native functions ---
11-12 04:32:54.682: DEBUG/ddm-heap(291): Got feature list request
11-12 04:32:55.302: DEBUG/dalvikvm(104): GC freed 2293 objects / 132304 bytes in 2157ms
11-12 04:32:55.352: DEBUG/ActivityManager(52): Uninstalling process joel.AndroidGroupSMS
11-12 04:32:55.362: DEBUG/ActivityManager(52): Force removing process ProcessRecord{43d9daf0 275:joel.AndroidGroupSMS/10024} (joel.AndroidGroupSMS/10024)
11-12 04:32:55.401: INFO/Process(52): Sending signal. PID: 275 SIG: 9
11-12 04:32:55.492: INFO/UsageStats(52): Unexpected resume of com.android.launcher while already resumed in joel.AndroidGroupSMS
11-12 04:32:55.512: INFO/WindowManager(52): WIN DEATH: Window{43cf7840 joel.AndroidGroupSMS/joel.AndroidGroupSMS.AndroidGroupSMS paused=false}
11-12 04:32:55.592: INFO/ActivityManager(52): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=joel.AndroidGroupSMS/.AndroidGroupSMS }
11-12 04:32:55.612: DEBUG/ActivityManager(52): Received spurious death notification for thread android.os.BinderProxy#43bc8370
11-12 04:32:55.652: DEBUG/AndroidRuntime(291): Shutting down VM
11-12 04:32:55.652: DEBUG/dalvikvm(291): DestroyJavaVM waiting for non-daemon threads to exit
11-12 04:32:55.662: DEBUG/dalvikvm(291): DestroyJavaVM shutting VM down
11-12 04:32:55.662: DEBUG/dalvikvm(291): HeapWorker thread shutting down
11-12 04:32:55.672: DEBUG/dalvikvm(291): HeapWorker thread has shut down
11-12 04:32:55.672: DEBUG/jdwp(291): JDWP shutting down net...
11-12 04:32:55.672: INFO/dalvikvm(291): Debugger has detached; object registry had 1 entries
11-12 04:32:55.672: DEBUG/dalvikvm(291): VM cleaning up
11-12 04:32:55.732: ERROR/AndroidRuntime(291): ERROR: thread attach failed
11-12 04:32:55.832: DEBUG/dalvikvm(291): LinearAlloc 0x0 used 639500 of 5242880 (12%)
11-12 04:32:55.952: INFO/ActivityManager(52): Start proc joel.AndroidGroupSMS for activity joel.AndroidGroupSMS/.AndroidGroupSMS: pid=298 uid=10024 gids={1015}
11-12 04:32:56.062: WARN/InputManagerService(52): Got RemoteException sending setActive(false) notification to pid 275 uid 10024
11-12 04:32:56.392: DEBUG/ddm-heap(298): Got feature list request
11-12 04:32:56.592: WARN/ActivityThread(298): Application joel.AndroidGroupSMS is waiting for the debugger on port 8100...
11-12 04:32:56.642: INFO/System.out(298): Sending WAIT chunk
11-12 04:32:56.691: INFO/dalvikvm(298): Debugger is active
11-12 04:32:56.872: INFO/System.out(298): Debugger has connected
11-12 04:32:56.882: INFO/System.out(298): waiting for debugger to settle...
11-12 04:32:57.082: INFO/System.out(298): waiting for debugger to settle...
11-12 04:32:57.282: INFO/System.out(298): waiting for debugger to settle...
11-12 04:32:57.483: INFO/System.out(298): waiting for debugger to settle...
11-12 04:32:57.692: INFO/System.out(298): waiting for debugger to settle...
11-12 04:32:57.893: INFO/System.out(298): waiting for debugger to settle...
11-12 04:32:58.092: INFO/System.out(298): waiting for debugger to settle...
11-12 04:32:58.300: INFO/System.out(298): waiting for debugger to settle...
11-12 04:32:58.502: INFO/System.out(298): waiting for debugger to settle...
11-12 04:32:58.707: INFO/System.out(298): waiting for debugger to settle...
11-12 04:32:58.912: INFO/System.out(298): waiting for debugger to settle...
11-12 04:32:59.112: INFO/System.out(298): waiting for debugger to settle...
11-12 04:32:59.322: INFO/System.out(298): debugger has settled (1361)
11-12 04:33:00.792: INFO/ActivityManager(52): Displayed activity joel.AndroidGroupSMS/.AndroidGroupSMS: 4860 ms (total 4860 ms)
11-12 04:33:02.942: WARN/KeyCharacterMap(298): No keyboard for id 0
11-12 04:33:02.952: WARN/KeyCharacterMap(298): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
11-12 04:33:04.592: DEBUG/dalvikvm(99): GC freed 481 objects / 24704 bytes in 185ms
Everything looks fine except the part where you use toString() on String object, that is not neccessary.
But are the text and the text2 TextViews located in the same XML layout as EditText views? In this case the main.xml? If the answer is no, then you have NullPointerException when you try to use them because findViewById can't find them.
You could just do text2.setText(template.getText().toString());
Instead of text2.setText(sTemplate.toString());
See if that works.
Joel,
Considering you have the edittext's in a different xml file. You might be able to create another resource file for what is displayed in your xml files. For instance you could create an xml file that will hold the values of what is displayed in your other xml files. Take a look at this example (notepad). The example is from the android development web site. You could use the values that are placed in your "values" xml for the values as all your other xml files. This way, you have a central place for your other xml files to grab their values. This may solve your problem. Let us know what results you find.
You will need to open the res folder and the values folder to see what im talking about when you are viewing the example.

how to debug ExceptionInInitializationError?

I am getting an exception in a very simple 'study' application, so I expect the problem to be in my project setup, but I don't know how to debug ...
What is the context of the exception, "ExceptionInInitializationError"?
Where is it documented? A: Search Android Developers Guide
Stack trace from within Eclipse Debugger with: select thread -> right-click -> copy stack
Thread [<3> main] (Suspended (exception ExceptionInInitializerError))
Class.newInstance() line: 1479
Instrumentation.newActivity(ClassLoader, String, Intent) line: 1021
ActivityThread.performLaunchActivity(ActivityThread$ActivityRecord, Intent) line: 2367
ActivityThread.handleLaunchActivity(ActivityThread$ActivityRecord, Intent) line: 2470
ActivityThread.access$2200(ActivityThread, ActivityThread$ActivityRecord, Intent) line: 119
ActivityThread$H.handleMessage(Message) line: 1821
ActivityThread$H(Handler).dispatchMessage(Message) line: 99
Looper.loop() line: 123
ActivityThread.main(String[]) line: 4310
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]
Method.invoke(Object, Object...) line: 521
ZygoteInit$MethodAndArgsCaller.run() line: 860
ZygoteInit.main(String[]) line: 618
NativeStart.main(String[]) line: not available [native method]
Here is the logcat:
I/ActivityManager( 52): Starting activity: Intent { flg=0x10000000 cmp=com.androidcode.study_wikinotes/.WikiNotes }
D/AndroidRuntime( 198): Shutting down VM
D/dalvikvm( 198): DestroyJavaVM waiting for non-daemon threads to exit
D/dalvikvm( 198): DestroyJavaVM shutting VM down
D/dalvikvm( 198): HeapWorker thread shutting down
D/dalvikvm( 198): HeapWorker thread has shut down
D/jdwp ( 198): JDWP shutting down net...
I/jdwp ( 198): adbd disconnected
D/dalvikvm( 198): VM cleaning up
E/AndroidRuntime( 198): ERROR: thread attach failed
I/ActivityManager( 52): Start proc com.androidcode.study_wikinotes for activity com.androidcode.study_wikinotes/.WikiNotes: pid=219 uid=10023 gids={}
D/dalvikvm( 198): LinearAlloc 0x0 used 634508 of 5242880 (12%)
D/ddm-heap( 155): Got feature list request
D/ddm-heap( 169): Got feature list request
D/ddm-heap( 183): Got feature list request
D/ddm-heap( 206): Got feature list request
D/ddm-heap( 219): Got feature list request
W/ActivityThread( 219): Application com.androidcode.study_wikinotes is waiting for the debugger on port 8100...
I/System.out( 219): Sending WAIT chunk
I/dalvikvm( 219): Debugger is active
I/System.out( 219): Debugger has connected
I/System.out( 219): waiting for debugger to settle...
I/System.out( 219): waiting for debugger to settle...
I/System.out( 219): waiting for debugger to settle...
I/System.out( 219): waiting for debugger to settle...
I/System.out( 219): waiting for debugger to settle...
I/System.out( 219): waiting for debugger to settle...
I/System.out( 219): waiting for debugger to settle...
I/System.out( 219): waiting for debugger to settle...
I/System.out( 219): waiting for debugger to settle...
I/System.out( 219): waiting for debugger to settle...
I/System.out( 219): waiting for debugger to settle...
I/System.out( 219): debugger has settled (1382)
W/dalvikvm( 219): Exception Ljava/util/regex/PatternSyntaxException; thrown during Lcom/androidcode/study_wikinotes/WikiNotes;.<clinit>
W/dalvikvm( 219): Class init failed in newInstance call (Lcom/androidcode/study_wikinotes/WikiNotes;)
Ahh ... I have an incomplete class in WikiNotes. Would you say the answer is to "start with logcat"? :) Thanks for the help. Go ahead and add your answer and I will accept it.
Yes the first thing to do when debugging in Android is to start by looking in LogCat.

Categories

Resources