【AS】Android Studio无法关联Api23源码-提示Souces for android api 23 platform not found

        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" />
          
        
        
          
		  	
		  
        
      
      
    
    
      
      
      
      
      
        
          
            
          
        
        
          
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
          
        
        
          
            
          
        
        
          
            
          
        
      
      
    
  

 

 

 

 

 

 

你可能感兴趣的:(Android,adt)