Android Studio 之 no render target selected

     今天第一次使用android studio,

  莫名其妙出现 no render target selected的错误,没有设计界面,

  各种百度之后在 stackoverflow.com/questions/22776653/no-rendering-target-selected-using-android-studio 找到了答案,

  I solved it with        File -> Invalidate Caches/Restart.

  虽然解决了还是莫名其妙,猜测原因可能是,在安装完Android Studio后没有先创建AVD,也没有打开Genymotion而导致的问题,因为都用Genymotion来代替IDE自带的模拟器,所以忽略了这一步,在完成上面两步骤后,就解决了问题。

  所以如果 File -> Invalidate Caches/Restart 不能解决问题的话,可以尝试先创建AVD,再重启试试

  1. You need to run the AVD Manager to add a virtual device that matches the target API version your project is set to.

  2. Click Tools->Android->AVD Manager. Click on 'New', add virtual devices targeting higher API levels, e.g 18, 19, etc.

  3. Then restart Android Studio, and open your project, it should find a target device to allow you access to the Design view.

 

      还有一个问题就是API21,API18也是在 

  File -> Invalidate Caches/Restart. 后才出现的。

学会勇敢
原文地址:https://www.cnblogs.com/Sir-Lin/p/4936286.html