Android Studio:如何查看 android 支持 v4 和 v7 的源代码? [英] Android Studio: How to see sources for android support v4 and v7?

查看:31
本文介绍了Android Studio:如何查看 android 支持 v4 和 v7 的源代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Android Studio 支持库中,appcompat(用于 ActionBar)被定义为 Gradle 依赖.

In Android Studio support library appcompat (for ActionBar) is defined as Gradle dependency.

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.0.3'
}

这也解决了 v4.

点击进入课程时如何查看源代码?

How to see source when clicking to into classes?

例如android.support.v4.widget.DrawerLayout

目前 Android Studio 说

Currently Android Studio says

//从类文件生成的 IntelliJ API 反编译器存根源
//方法的实现不可用

// IntelliJ API Decompiler stub source generated from a class file
// Implementation of methods is not available

对于 ADT,它是 如何为android-support-v7?

推荐答案

根据 Paul Verest 的上述研究...

Following from the above research done by Paul Verest...

IDE:Android Studio 1.3.2

IDE: Android studio 1.3.2

这是一个 2 步过程:考虑这个示例 build.gradle

It is a 2-step process: Consider this sample build.gradle

1) 将以下内容添加到您的 build.gradle (Module:app) - 搜索 2//Add comments 下面.

1) Add the following to your build.gradle (Module:app) - search the 2 //Add comments below.

apply plugin: 'com.android.application'
apply plugin: 'idea' //Add

android {
  compileSdkVersion 21
  buildToolsVersion "21.1.2"

  defaultConfig {
      applicationId "com.mycompany.android.myapp"
      minSdkVersion 16
      targetSdkVersion 21
      versionCode 1
      versionName "1.0"
  }
  buildTypes {
      release {
          proguardFiles getDefaultProguardFile('proguard-android.txt'),   'proguard-rules.pro'
      }
  }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.1.0'
}

//Add
idea {
      module {
          downloadJavadoc = true
          downloadSources = true
      }
  }

2) 重建项目.

此后如果您想在Android Studio中查看源代码,它将拉出源代码*.java而不是反编译的*.class

After this point if you want to see source in Android Studio, it will pull up the source *.java instead of decompiled *.class

这篇关于Android Studio:如何查看 android 支持 v4 和 v7 的源代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆