Android Studio 中关联源码跟 Eclipse 不太一样:

        Eclipse 关联的 SDK 默认没附带源码,需要自己去下载,存放在 $USER_HOME$/charo/software/sdk/sdk/source/src 之下,源码中附带有源码的注释文档,以 Android 中 Activity 的 findViewById 方法为例,如下所示(Activity.class):

 

/**     * Finds a view that was identified by the id attribute from the XML that     * was processed in {@link #onCreate}.     *     * @return The view if found or null otherwise.     */    @Nullable    public View findViewById(@IdRes int id) {        return getWindow().findViewById(id);    }

        Android Studio 关联的 SDK 本身就自带有源码,但默认源码中不带注释,如下(Activity.class):

 

 

    /** @deprecated */    @Deprecated    public void stopManagingCursor(Cursor c) {        throw new RuntimeException("Stub!");    }    public View findViewById(int id) {        throw new RuntimeException("Stub!");    }    public ActionBar getActionBar() {        throw new RuntimeException("Stub!");    }

所以 Android Studio 需要我们自己去下载并关联注释文档,首先是下载:

 

【AS】Android Studio无法关联Api23源码-提示Souces for android api 23 platform not found_第1张图片

其次是关联,vi $USER_HOME$/.AndroidStudio2.1/config/options/jdk.table.xml(粗体彩色字为添加的内容):

 

                                                                                                                                                                         file://$USER_HOME$/charo/software/adt-bundle-linux-x86-20140321/sdk/docs/reference" />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                file://$USER_HOME$/charo/software/adt-bundle-linux-x86-20140321/sdk/docs/reference" />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                

 

 

 

 

 

 

更多相关文章

  1. Android轻量级存储源码分析
  2. Android 网络框架 Retrofit 源码解析
  3. Android 反编译apk 到java源码的方法
  4. Android属性动画AnimatorSet源码简单分析
  5. Android内存泄露专题——leakCanary源码分析
  6. Android ThreadLocal 源码分析
  7. Android2.2 API 中文文档系列(9) ―― ZoomButton

随机推荐

  1. layer-list使用
  2. 「Android」SurfaceFlinger分析
  3. Android常遇疑难问题
  4. 转发:bitmap 设置图片尺寸,避免 内存溢出 O
  5. Android - 永不锁屏,开机不锁屏,删除设置中
  6. Android在listview添加checkbox实现单选
  7. 部署Android SDK 和Eclipse 插件
  8. android PopUp window的使用
  9. Android(安卓)lifecycle 实战及使用进阶
  10. Android FloatingActionButton控件