mac下安装android studio 遇到问题及解决方案

           最近学习android 开发,由于官方提供android studio,就尝试的用了下,在ubuntu下,用着没什么问题。这两天在家用mac来配置系统,发现步履艰难。先把解决问题纪录如下,以便提醒自己,随便可能会帮助到和我遇到相同问题的亲们~

           大体遇到两个问题,现总结如下:

            1、java sdk问题

                  1、下载android studio地址:https://dl.google.com/dl/android/studio/install/1.0.1/android-studio-ide-1641136.dmg

                  2、点击安装,如果没有出现问题,略过此步骤;如果有问题,继续往下看:

                   Android Studio was unable to find a valid Jvm

                   在终端中输入:java -version,看看自己是不是安装java sdk:

                  java version "1.7.0_71"
                 Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
                 Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

           这是我的java版本,已经安装,为什么还会弹出找不到jvm的提示呢?

           在网上搜了下,大体上都是android studio配置文件问题引起的,这个稍后具体展开。其实安装一个东西最应该看的是官方安装说明及步骤,最后才去认真看了一下:

            Before you set up Android Studio, be sure you have installed JDK 6 or higher (the JRE alone is not sufficient)—JDK 7 is required when developing for Android 5.0 and higher. To check if you have JDK installed (and which version), open a terminal and type javac -version. If the JDK is not available or the version is lower than 6, go download JDK

          android官网上已经提到了,使用JDK1.6或者更高是可以的。但是实际情况不是这样的。

扫描二维码关注公众号,回复: 3847933 查看本文章

          下面是提示的安装步骤:

           

To set up Android Studio on Mac OSX:

  1. Launch the .dmg file you just downloaded.
  2. Drag and drop Android Studio into the Applications folder.
  3. Open Android Studio and follow the setup wizard to install any necessary SDK tools.

    Depending on your security settings, when you attempt to open Android Studio, you might see a warning that saysthe package is damaged and should be moved to the trash. If this happens, go to System Preferences > Security & Privacy and under Allow applications downloaded from, select Anywhere. Then open Android Studio again.

If you need use the Android SDK tools from a command line, you can access them at:

/Users/<user>/Library/Android/sdk/

       注意这个第3步骤 ,这个会在这个问题的解决方案1还有下面那个问题中用到-----需要修改dmg中文档参数以满足要求。       

       解决方案1:

        

    1、Finder中,应用程序中找到Android Studio;
     2、右击显示包内容,在目录下找到 info.plist 并用任意文本编辑器打开;
     3、找到 JVMVersion 并将 <string>1.6*</string>中的版本号改为你系统JDK的版本号(注意:Android Studio只支持jdk1.6及以上版本)
      例如<string>1.6+</string>或者现有系统版本<string>1.7.0_71</string>
      然后再去点击安装,这边会出现提示,如步骤3:类似”包已经损坏,移动到回收站中“的提示。当时我就按照提示移动到回收站了~

        正确的做法,按照步骤3提示:点击“系统(系统偏好设置)”---“安全和隐私”---“允许从以下位置下载的程序”中选择“任何来源”(如果不能选择,看到左下角的锁,点击一下,输入密码即可);然后就可以点击安装了。。。

        解决方法2,相对比较简单的方法,从apple官网,下载一个软件:

        http://supportdownload.apple.com/download.info.apple.com/Apple_Support_Area/Apple_Software_Updates/Mac_OS_X/downloads/031-03190.20140529.Pp3r4/JavaForOSX2014-001.dmg

        安装即可,这个软件,应该包含老的JDK版本,安装上就可以,不需要用解决方案1了。

        此问题到此为止。  

     2、Fetching android sdk component information一直加载问题       

安装完成后,如果直接启动,Android Studio会去获取 android sdk 组件信息,这个过程相当慢,还经常加载失败,导致Android Studio启动不起开。解决办法就是不去获取android sdk 组件信息。方法如下:

  1)进入应用程序,找到Android Studio,右键-->显示包内容-->Contents-->bin,找到文件idea.properties,使用文本工具打开

  2)在idea.properties文件末尾添加一行:disable.android.first.run=true,然后保存文件。

  3)关闭Android Studio后重新启动,便可进入界面。

      参考网络解决方案,和解决SDK中解决方案1中一样,需要修改内容。

      这个慢的原因,是因为android网站被墙了,必须翻墙才能访问到!

      重新启动后,提示需要android SDK目录,这个需要单独从android官方网站下载SDK。

            

猜你喜欢

转载自blog.csdn.net/richerg85/article/details/42809693
今日推荐