Android app not showing in the emulator

♀尐吖头ヾ 提交于 2020-05-15 07:00:09

问题


I installed eclipse, android sdk, created AVD (tried with different versions), then created simple hello world program (autogenerated).

When I run it, it supposed to load up and show helloworld screen... but nothing happens. Emulator just loads up and shows android main screen. My app is nowhere to be seen.

Log:

[2012-05-19 19:09:34 - GameTest] Android Launch!
[2012-05-19 19:09:34 - GameTest] adb is running normally.
[2012-05-19 19:09:34 - GameTest] Performing org.test.game1.GameTestActivity activity launch
[2012-05-19 19:09:34 - GameTest] Automatic Target Mode: launching new emulator with compatible AVD 'def_avd'
[2012-05-19 19:09:34 - GameTest] Launching a new emulator with Virtual Device 'def_avd'

And that's it...

What is wrong and how can I actually load up my program?

Some clarifications: I tried to run emulator beforehand, and then running my app. I tried running emulator directly from eclipse "Run as - Android application" but still the same exact thing.


回答1:


The thing missing is given below XML snippet in your AndroidManifest.xml

<intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

Add this tag in your xml under activity tag, then your application will be launched on your Emulator




回答2:


Unfortunately nothing suggested in other replies helped, but I found a decent workaround.

If you have an android device probably the simplest thing to do would be to connect it to usb and just hit "debug as android application" and in 3 or 4 seconds it will load up on your android device.

To use that option you need to instal USB driver package, but that is no problem.




回答3:


Try this, first open the avd manager and launch the emulator, and wait until the emulator boots and android home screen shows up. Now try running the program.




回答4:


clean the projects and refresh the emulator.

Other wise create new emulator and run it.

close the emulator and adb in windows task manager and

then try to create new emulator and run it.




回答5:


I know this is an old question but I just had the same issue so here is how I fixed it in Android Studio 2.1.

In the Run configuration I had it set to start the AVD that I wanted automatically, and it would always start another AVD and none of them would have the app. So, I set the configuration to "Show Device Choose Dialog", started the AVD manually, and then when I hit Run I selected the running AVD and it popped right up. I hope it works for you too!

Also, I had set the Launch Option to start my main activity explicitly, and then I turned it back to default and it still worked after changing to default. So if it doesn't work for you the first time maybe try doing that too.




回答6:


Several things you might try :

  • Make sure the emulator build version is the same as code
  • Try and do :

    > adb kill-server
    > adb start-server
    
  • Restart Eclipse?

  • Check out This question and follow the answer guide.

  • Similar question Here, And Here check it out




回答7:


Be sure to click "Use Host GPU" on Virtual Device Screen and then start your device. Wait until UI of the device is loaded.




回答8:


Just once check build path and support android libraries and android emulator version and application support version and all




回答9:


I had same issue when I was having one intent-filter for all the options, then I separated into 2 intent-filters, app started showing up

<intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data
             android:host="java-lang-programming"
             android:scheme="android-app-google-plus-demo" />
    </intent-filter>



回答10:


I tried to fix it myself, but nothing seemed to be working,

So I just:

  1. Re-installed Visual Studio
  2. Reset my phone to factory default
  3. Went through the quick process of enabling USB Debugging (Settings > About phone > Software information > Tap Build number seven times to enable Developer options > Go to Developer options (which is just below About phone in the Settings > Search for USB Debugging and enable it)
  4. Then I plugged in my phone again, and after installing USB driver package like NewProger suggested, I followed the usual steps to setting up my phone as an Android Emulator.

And it's working just fine now.

I can't exactly pinpoint what did it for me, but I guess there's no harm in trying all four steps, as a last resort, after backing up necessary files, and what not.

Hope this helps!



来源:https://stackoverflow.com/questions/10665113/android-app-not-showing-in-the-emulator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!