Issue with 'Hello Android' tutorial

后端 未结 7 1361
忘掉有多难
忘掉有多难 2021-01-06 00:46

I am brand new to Eclipse and Android, but somewhat familiar with Java. That having been said, I tried to follow the \'Hello Android\' tutorial from the developer site usin

相关标签:
7条回答
  • 2021-01-06 00:58

    what i did was to move the circle that appears when the AVD launches to the unlock position, and there it was 'Hello, Android'!

    0 讨论(0)
  • 2021-01-06 00:58

    I had this same problem when I tried to run the emulator using a 4.0 AVD. It used to crash at the bootup screen and show 'Segmentation fault' in the console. I was able to fix it by increasing the SD card size of the AVD to 1GB from 32MB.

    0 讨论(0)
  • 2021-01-06 00:59

    No direct experience, but this seems to be a recurrent issue:

    This thread suggests:

    You haven't let the emulator boot all the way up. Start it then wait until you see a desktop, just like on a real phone.

    This one mentions (I suspect point 1. is not a concern for you):

    1. Get more RAM. I was running on 256 MB (which I believe is below minimum requirements), just upgraded today to 1024 MB (long time coming), application now starts fine. Although I still do see some error messages in the emulator, they don't seem to actually do anything.

    2. Install from command line. This is a bit laborius, but you can launch an emulator from the command line (assuming <android sdk path>\tools is added to your PATH variable) just type emulator, then browse to the location of your_app_here.apk, and execute

    adb install your_app_here.apk
    

    If you launch the emulator from Eclipse, execute adb kill-service and then adb start-service first (or kill-server / start-server. not sure the exact commands). Then your app will be installed on the emulator.


    Also (a bit old but might still be relevant)

    Maybe the emulator is running so slow, and the adb server, or another component like "DDMS" is a little "desperate" because seems it's waiting to the emulator to iniatialize the some HOME aplication.
    But the emulator is running slow, the console in Eclipse send a message: emulator-5554 disconnected! Cancelling 'com.android.hello.HelloAndroid' launch!; and the emulator continues running normally and boot it's system, but don't run application that I build.

    So for that problem I run program, and when the emulator is opened, I go back to eclipse in DDMS Perspective and in the Device tab y press a button "restart adb server" before the console shows me the message of "emulator-5554 disconnected!".
    I do it several times until the emulator finally boot the OS.
    After booted the OS on the emulator, eclipse don't send that disconnect error, and "sends" the app that I've built, also the console shows messages about this.
    Then finally appears on the mobile "Hello, Android".

    0 讨论(0)
  • 2021-01-06 01:15

    For whatever reason, I stopped getting the segmentation fault when I added:

    this.setContentView(tv);
    

    the 'this' seemingly solved the issue. The seg fault happens if you try to run the emulator without any .apk file I assume. (I was getting that from the command line as well). I hope the tutorial will be updated.

    0 讨论(0)
  • 2021-01-06 01:17

    This seems to be a timing issue. For some reason Eclipse attempts to load the application on to the emulator before it is "ready". I'm not sure why this occurs but I did find a work around: just start the emulator from the command line before you run the application.

    1. Start clean by closing Eclipse (maybe the OP didn't exit Eclipse before he tried to run via the command line?)
    2. Start the emulator via Terminal by navigating to the android-sdk-mac_86/tools directory and typing:

      ./emulator -avd my_avd

    3. Open Eclipse and attempt to run the tutorial again using the same steps as before

    4. A dialog box should open asking whether you would like to start a new AVD or use the one that is already running--choose to use the one that is already running.
    0 讨论(0)
  • 2021-01-06 01:18

    There has been a discussion on this with two proposed solutions http://code.google.com/p/android/issues/detail?id=724

    Comment 17 by zachrcrowe, Jan 06, 2010 FYI - I had to change a line in the Hello Android example to read this.setContentView(tv); in order for it to work. As mentioned above, the deprecation warning shouldn't affect the functionality of the emulator.

    Comment 18 by mfrony, Jan 14, 2010 I had the same problem when I ran the Hello Android example. The way I solved it and could run my first Android code was by changing the Project Build Target from 1.1 to 1.5.

    0 讨论(0)
提交回复
热议问题