Android Studio: doesn't build on simulator after clean install

感情迁移 提交于 2019-12-25 07:02:27

问题


How annoying is it that a blank activity doesn't just auto build on a clean Android Studio v1.3 install? I understand needing Java installed for a simulator to run, but the rest is unacceptable..Xcode builds on any device in seconds..

Can someone please explain how this is possible? I mean I've been developing Android apps for years, but this a completely different issue.

No Connected Devices
No Debuggable Application

That's what I get with a brand new install on a Windows 8.1 Parallels VM, with a 4GB partition, actually did drop the simulator's memory to 1GB, because it defaults to a Nexus 5 with 1.5GB needed? That makes no sense if they suggest 512 to 1GB recommended during install...

You understand the question right? How can this happen? Maybe this should be community wiki...

If I was honest with myself, I actually don't know how to fix this out of the box...

UPDATE

Getting

emulator window was out of view and was recentered

and blank emulator screens still after changing:

    minSdkVersion 15
    targetSdkVersion 22

    //to

    minSdkVersion 14
    targetSdkVersion 21

This post doesn't help either...


回答1:


I had the same issue than you but in Windows 7 and in Android Studio v1.1. My Android Studio couldn't auto build a blank activity. I don't know why but changing my minSdkVersion and my targetSdkVersion at build.gradle script to:

minSdkVersion 14
targetSdkVersion 21

It fix my problems and worked perfectly.

I expect your problems will disapear.




回答2:


Well, after messing around with a few things in Project Structure, I starting getting new error related to the JDK. You have to set the JAVA_HOME variable...I was running JDK 6, with 7 and 8 installed. When I tried to change it to 8, there seemed to be more problems than solutions, so I set the JAVA_HOME variable on my Mac by setting the JDK location to the correct location for JDK 7, then used this command in the terminal:

echo export "JAVA_HOME=\$(/usr/libexec/java_home -v 1.7)" >> ~/.bash_profile

I've had to do that in the past with Android Studio for Windows, but forgot about all that during setup, since my Mac was defaulting to JDK 6, and my compile version wasn't compatible.

Also, and this is important for other issues I was having...don't run Xcode and Android Studio at the same time inside a Parallels VM? I had the Xcode sim open, which conflicts with HAXM trying to run the emulator. That can lead you down a confusing path that will mislead you to what's really going on.



来源:https://stackoverflow.com/questions/32163302/android-studio-doesnt-build-on-simulator-after-clean-install

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