Running app in android emulator with titanium 1.2.1: try and error

You must Login before you can answer or comment on any questions.

Hi,

running an app in android emulator with titanium 1.2.1 is try and error. First launch: emulator opens, but must be unlocked with menu button. After unlocking, nothing happens. Second 'launch': Most of the time nothing happens, and the trace shows:

[DEBUG] C:android-sdktoolsadb.exe -e devices [TRACE] wait_for_device returned: List of devices attached [TRACE] [TRACE] [DEBUG] C:android-sdktoolsadb.exe -e devices [TRACE] wait_for_device returned: List of devices attached [TRACE] [TRACE] [DEBUG] C:android-sdktoolsadb.exe -e devices [TRACE] wait_for_device returned: List of devices attached [TRACE] [TRACE] [DEBUG] C:android-sdktoolsadb.exe -e devices [TRACE] wait_for_device returned: List of devices attached [TRACE] [TRACE] [DEBUG] C:android-sdktoolsadb.exe -e devices [TRACE] wait_for_device returned: List of devices attached [TRACE] [TRACE] [DEBUG] C:android-sdktoolsadb.exe -e devices [TRACE] wait_for_device returned: List of devices attached [TRACE] [TRACE] [DEBUG] C:android-sdktoolsadb.exe -e devices [TRACE] wait_for_device returned: List of devices attached [TRACE] [TRACE]

My 'workaround' is: switch to another application, switch back to target application, maybe close emulator again and then: miracle !! - app loads into the emulator.

The only stable situation can be created here if you leave your test app open in the emulator after a debug run and then again launch the test app.

Bye bye post in the nirwana of Q/A !

r.

8 Answers

Hi rb,

I've had a lot of good experience with the changes in 1.2.1 when it comes to launching the Android emulator from Titanium Developer. I'd like to try to help you get it to the point where it works the first time. But to help out, could you...

  • Paste the whole trace from your "first launch attempt" into a pastie and give us the URL to the pastie here.
  • Tell me what OS version you're running (windows xp or ubuntu 9.10 or osx leopard or whatever).
  • Tell me what version of the Titanium Mobile SDK you are targeting in your project. Because i wasn't sure if by 1.2.1 you meant the Titanium Developer 1.2.1 (the developer GUI), or the Titanium Mobile SDK 1.2.1 which is available from the source repository on github.

Don't worry, your post won't be lost in the nirvana! :) I'll stay on the case with you.

Regards,

Bill

Thank you Bill !

I am running Titanium Version 1.2.1 on windows 7. There are all android SDK versions on my computer. I am building with android SDK 1.6. The version of the Mobile SDK is 1.2.0.

I start titanium and select my project. Then I select 'Test & Package' and 'run on emulator'.

The emulator starts up and the emulator screen holds at the lock welcome screen, then I unlock it with the menu button of the emulator. Then the desktop of the emulated phone appears and nothing more.

If you have a titanium newbie this would be the first 'hold' and some frustration. It would be absolutely great if you would have an INFO message on titanium here what happened and why the project does not get loaded.

The trace is here:

http://pastie.org/935462

See my next post what happens next.

I press 'launch' button again. Nothing happens.

I only get (TRACE):

http://pastie.org/935476

Titanium seems to be waiting for the device list, which seems not to be complete, although the emulator is up and running.

The 'workaround' is in my initial post. So I can develop and test, it is just uncomfortable to predict when loading will work or not.

Best regards

r.

Interesting. In your first trace we can see on line 197 that it does successfully connect up with the emulator. But then on line 420 we see that -- when it's ready to try to launch the app -- the device is no longer found. Did you maybe click "Stop" while you were waiting for the build process to finish?

Anyway, this is all very much improved in the next version of the Titanium mobile sdk (1.3). Until that release comes out, I highly recommend following my advice in this blog entry and creating a batch file to launch the emulator before Titanium.

After you do that, you will want to create a new project, not use an existing one. The reason for this is that the state of your emulator and the state of the build directories inside your project are now out-of-sync. It's best to...

  • Launch the emulator per my blog post.
  • Launch Titanium.
  • Create a new project.
  • Code and test that new project.

Tell me how that goes for you.

Best of luck,

Bill

Thank you !

I was able to identify the line in which the emulator starts in your blog. The last line

C:android-sdktoolsemulator.exe -avd titanium_4_HVGA -port 5560 -sdcard C:Users\user.titaniumandroid.sdcard -logcat "*:d *" -no-boot-anim

was copied to a batch file.

Now the emulator starts up correctly, and the app gets loaded :-)

unfortunately now I do not get INFO outputs from my application in titanium.

Do you want me to put only the last line of the trace emu starting part into the batch file ? Or all lines which you showed in your blog ? Maybe you could post an example batch file ? I know that this depends on the emulator selected and screen res ....

Thank you, this seems to be a progress.

Yeah, that's pretty crappy that the info() messages aren't visible then. I wasn't really worried about them when I first did that blog post, but i have to admit it's annoying to not have them.

How do you feel about building the mobile SDK from source? That's what I do now. Marshall Culpepper (@marshall_law) has really, really improved the Android launch stuff for the upcoming release, and it's all available if you build the sources.

Would you be interested in building from source? If so, and you're not sure how, I can type up some instructions.

Regards,

Bill

[UPDATE]. A quick and very short (and not very "friendly") blog post about building Titanium from source.

Thanks a lot,

Maybe I try building this later.

In the meantime I can cope with the situation as it is now, because I finally get the apps emulator-loading any time.

Good to know that the people at @appcelerator work on this.

Overall, titanium is amazing.

Best regards

rudolf

Maybe it is interesting for newbies to clarify the version jungle once again:

Titanium has versions (mine is currently 1.2.1. Titanium versions should get updated automatically.)

Android SDK has versions (you need at least 1.6 installed to make titanium work under windows with android. Although listed on the emulator page, Android 1.5 is not supported by titanium 1.+. Do NOT waste time in trying to build android 1.5 apps with current titanium !)

Mobile SDK has versions (I have 1.2.0 installed, they are working on 1.3.0. Mobile SDK's should get updated automatically. You can switch back to older SDK versions on the 'edit' page of your project, if you have the mobile SDK installed)

I am quite sure that desktop SDK has versions too.

So if you have requests to people @appcelerator or the community, it is important to state (in your question):

Operating system (that runs titanium - Windows XP, Vista, 7, Linux, Mac), titanium version, mobile SDK version, eventually desktop SDK version and finally: desktop or mobile project (if mobile, android or iphone or ipad type of question).

One more: It is not possible to build iphone or ipad apps on a windows host. You NEED a Mac to install the iphone SDK and run the iphone emulator. You can, however, develop your app for android and switch to iphone later.

I want a Mac, by the way :-)

Cheers

rudolf

Your Answer

Think you can help? Login to answer this question!