Android - Application has stopped unexpectedly


I am a beginner on this platform and I am wondering if you can give me a clue why my app fails on Android device (Nexus). The message I got is:
"The application has stopped unexpectedly. Please try again".
This is the scenario I've tried:

  1. Create a Titanium Mobile project with SDK 1.7.3 with IPad, IPhone and Android as targets.Do not add any code to the project generated by the Titanium Studio wizard.
  2. Run the project in the simulator (Android API 2.3.3, HVGA). Seems to be OK
  3. Close the simulator and select 'Run On Android device'
  4. The application is installed on the Nexus phone. When I launch it I can briefly see the red Titanium logo followed by the above massage.

I have tried to deploy the app through the ADB with the same results. I do the development on MAC OS 10.

Thank you,


4 Answers

  • Accepted Answer

    Not sure if this will work for you or not but sometimes I find that touching (i.e re-saving) your tiapp.xml file and then re-building the project solves this sort of issue. Might be worth a try?

    — answered 4 years ago by Richard Shergold
    1 Comment
    • it looks like the Android builds are not capable of eachothers environment. Spend a lot of time figuring this out. Every time you switch between emulator & device, remove your build!

      — commented 4 years ago by Rene Pot
  • Thank you all. I've changed a field in tiap.xml and it worked.

  • The same error is coming back this time on the Android emulator. I was a day into this project when the "The application has stopped unexpectedly" message pop up again (used to work fine for a while). The app was working fine on IOS. Start to roll back the code until literally everything was commented out but the error was still there!! Very unreliable and frustrating experience!! I spent a day on this thing and I am thinking to give up on evaluating Titanium.
    Any thoughts? Thx a lot.

    Marcel Farcas

    This is the adb call stack:

    I/ActivityManager( 60): Start proc com.Flicksoftware.NerfGun1 for activity com.Flicksoftware.NerfGun1/.NerfgunActivity: pid=865 uid=10038 gids={1015, 3003}
    D/AndroidRuntime( 859): Shutting down VM
    D/jdwp ( 859): adbd disconnected
    I/AndroidRuntime( 859): NOTE: attach of thread 'Binder Thread #3' failed
    I/TiApplication( 865): (main) [0,0] checkpoint, app created.
    D/dalvikvm( 60): GC_FOR_MALLOC freed 10597 objects / 553496 bytes in 229ms
    I/TiApplication( 865): (main) [465,465] Titanium 1.7.3 (2011/10/17 13:44 dcf4257)
    D/TiDeployData( 865): (main) [72,537] Read deploy data: {"debuggerPort":50784,"debuggerEnabled":true,"fastdevPort":50364}
    E/TiPlatformHelper( 865): (main) [103,640] renaming ID
    D/dalvikvm( 865): GC_FOR_MALLOC freed 3398 objects / 334904 bytes in 90ms
    I/TiRootActivity( 865): (main) [0,0] checkpoint, on root activity create, savedInstanceState: null
    E/TiApplication( 865): (main) [275,275] APP PROXY: [Ti.App]
    D/TiCommonContactsApi( 865): (main) [25,300] Using newer contacts api. Android SDK level: 8
    D/dalvikvm( 865): GC_FOR_MALLOC freed 5764 objects / 392800 bytes in 81ms
    D/TiDebugClient( 865): (Thread-11) [283,583] debugger connected
    D/TiDebugSession( 865): (Thread-11) [20,603] debug session started with /
    I/global ( 865): Default buffer size used in BufferedInputStream constructor. It would be better to be explicit if an 8k buffer is required.
    D/TiDebugSession( 865): (Thread-12) [8,611] session started
    D/TiFastDev( 865): (Thread-12) [95,706] Enabling Fastdev on port 50364
    D/TiFastDev( 865): (Thread-12) [16,722] sent tokens successfully
    D/TiFastDev( 865): (Thread-12) [2,724] Fastdev session handshake succesful.
    W/dalvikvm( 865): threadid=11: thread exiting with uncaught exception (group=0x4001d800)
    E/TiUncaughtHandler( 865): (Thread-12) [177,901] Sending event: exception on thread: Thread-12 msg:java.lang.IllegalArgumentException: 9; Titanium 1.7.3,2011/10/17 13:44,dcf4257
    E/TiUncaughtHandler( 865): java.lang.IllegalArgumentException: 9
    E/TiUncaughtHandler( 865): at$SourceInfo.breakpoint(
    E/TiUncaughtHandler( 865): at ti.modules.titanium.debug.handlers.a.a(Unknown Source)
    E/TiUncaughtHandler( 865): at ti.modules.titanium.debug.h.b(Unknown Source)
    E/TiUncaughtHandler( 865): at Source)
    E/AndroidRuntime( 865): FATAL EXCEPTION: Thread-12
    E/AndroidRuntime( 865): java.lang.IllegalArgumentException: 9
    E/AndroidRuntime( 865): at$SourceInfo.breakpoint(
    E/AndroidRuntime( 865): at ti.modules.titanium.debug.handlers.a.a(Unknown Source)
    E/AndroidRuntime( 865): at ti.modules.titanium.debug.h.b(Unknown Source)
    E/AndroidRuntime( 865): at Source)
    W/ActivityManager( 60): Force finishing activity com.Flicksoftware.NerfGun1/.NerfgunActivity
    W/ActivityManager( 60): Activity pause timeout for HistoryRecord{44034fd8 com.Flicksoftware.NerfGun1/.NerfgunActivity}
    W/ActivityManager( 60): Activity destroy timeout for HistoryRecord{44034fd8 com.Flicksoftware.NerfGun1/.NerfgunActivity}
    W/ActivityManager( 60): Timeout executing service: ServiceRecord{440886a0 com.Flicksoftware.NerfGun1/}
    I/ActivityManager( 60): Crashing app skipping ANR: ProcessRecord{440355d0 865:com.Flicksoftware.NerfGun1/10038} Executing service com.Flicksoftware.NerfGun1/
    D/SntpClient( 60): request time failed: Address family not supported by protocol
    I/Process ( 865): Sending signal. PID: 865 SIG: 9
    I/ActivityManager( 60): Process com.Flicksoftware.NerfGun1 (pid 865) has died.
    W/ActivityManager( 60): Service crashed 2 times, stopping: ServiceRecord{440886a0 com.Flicksoftware.NerfGun1/}
    W/InputManagerService( 60): Window already focused, ignoring focus gain of:$Stub$Proxy@43ebe0a8
    D/SntpClient( 60): request time failed: Address family not supported by protocol

  • 2.3.3 SDK is hosed for some reason I've found…Go with 2.2 for development. Make sure you set it in your debug configuration in Titanium Studio.

    There is a way to get the stack trace that says exactly why your app crashed. To do this go to terminal, navigate to android-sdk-macosx/platform-tools, and put ./adb -e logcat D (for emulator) or ./adb -d logcat D (for device). Then run your app and watch the output. If you print the contents of that stack trace here we can help you identify the problem.

    Usually if the app will not deploy, you probably need to clean your build folder out, just delete build/android folder entirely from your working dir.

    Is it working on the emulator? If not you can get the stack trace from there. Whenever you go back and forth between emulator and device I've found it's time to clean out that build/android directory again, sadly.