无法找到Android支持库源代码(v4、v7、v13)

时间:2022-04-06 15:20:00

I am unable find the source when after I downloaded the sdk. Has it been removed from public access?

下载sdk后找不到源文件。它是否已从公众渠道移除?

4 个解决方案

#1


34  

Some of the src folders on my copy of the samples, found at $SDK_DIR/extras/android/support/ seem to be empty. For example, v7/gridlayout/src/ is an empty folder, but most of my v4 folders have the source code supplied alongside the download from the SDK Manager, so I'm going to guess you and I are seeing the same issue.

在我的示例副本中,在$SDK_DIR/extras/android/support/上找到的一些src文件夹似乎是空的。例如,v7/gridlayout/src/是一个空文件夹,但是我的大多数v4文件夹都提供了SDK管理器下载时附带的源代码,所以我猜您和我看到了同样的问题。

However, you can always download the source directly from the source (no pun intended):

但是,您可以直接从源代码下载源代码(没有双关语):

Doing a git clone https://android.googlesource.com/platform/frameworks/support/ to download the support library files direct from Google's repository seems to contain all of the source files.

通过使用git克隆https://android.googlesource.com/platform/frameworks/support/直接从谷歌的存储库下载支持库文件,似乎包含了所有的源文件。

#2


2  

Those that are looking for sources per version, can find it locally (provided that you downloaded it previously) at:

那些正在寻找每个版本的源代码的人,可以在本地找到它(前提是您之前下载了它):

$SDK_DIR/extras/android/m2repository/com/android/support/$libname/$version/$libname-$version-sources.jar

美元SDK_DIR /配件/ android / m2repository /com/android/support/库名/版本/美元库名- version-sources.jar美元

Jar file (as you probably know) is essentially a zip file - therefore you can simply extract its contents.

Jar文件(您可能知道)本质上是一个zip文件——因此您可以简单地提取它的内容。

For example, support-v4 v23.1.1 located at:

例如,support-v4 v23.1.1位于:

$SDK_DIR/extras/android/m2repository/com/android/support/support-v4/23.1.1/support-v4-23.1.1-sources.jar

#3


0  

Using Android Studio to read support library source is a more convenient way.Please follow these steps:

使用Android Studio来读取支持库源代码是一种更方便的方式。请遵循以下步骤:

  • Add dependency to support library in build.gradle. For example, compile 'com.android.support:appcompat-v7:23.1.0' in Android Studio project's build.gradle.
  • 在build.gradle中添加对库的支持。例如,在Android Studio项目的build.gradle中,编译“com.android.support:appcompat-v7:23.1.0”。
  • Sync or build your project.
  • 同步或构建项目。
  • Add a reference to support library class from your code file and then ctrl+right click.This will lead you to the source code.
  • 从代码文件中添加一个支持库类的引用,然后按ctrl+右键单击。这将引导您找到源代码。
  • There is a "Scrool from Source" toolbar button in project view.Click it and you will be navigated to the source code tree in project view.For example, at $PROJ/build/intermediates/exploded-aar/com.android.support/design/23.1.0/jars
  • 在项目视图中有一个“来自源的Scrool”工具栏按钮。单击它,您将被导航到项目视图中的源代码树。例如,美元项目/构建/中间体/ exploded-aar com.android.support /设计/ 23.1.0 / jar

#4


-3  

go to Android SDK manager then> go to extras>select Android Support Libraries >check on that and install it

转到Android SDK管理器然后转到extras>选择Android Support库>检查一下并安装它

#1


34  

Some of the src folders on my copy of the samples, found at $SDK_DIR/extras/android/support/ seem to be empty. For example, v7/gridlayout/src/ is an empty folder, but most of my v4 folders have the source code supplied alongside the download from the SDK Manager, so I'm going to guess you and I are seeing the same issue.

在我的示例副本中,在$SDK_DIR/extras/android/support/上找到的一些src文件夹似乎是空的。例如,v7/gridlayout/src/是一个空文件夹,但是我的大多数v4文件夹都提供了SDK管理器下载时附带的源代码,所以我猜您和我看到了同样的问题。

However, you can always download the source directly from the source (no pun intended):

但是,您可以直接从源代码下载源代码(没有双关语):

Doing a git clone https://android.googlesource.com/platform/frameworks/support/ to download the support library files direct from Google's repository seems to contain all of the source files.

通过使用git克隆https://android.googlesource.com/platform/frameworks/support/直接从谷歌的存储库下载支持库文件,似乎包含了所有的源文件。

#2


2  

Those that are looking for sources per version, can find it locally (provided that you downloaded it previously) at:

那些正在寻找每个版本的源代码的人,可以在本地找到它(前提是您之前下载了它):

$SDK_DIR/extras/android/m2repository/com/android/support/$libname/$version/$libname-$version-sources.jar

美元SDK_DIR /配件/ android / m2repository /com/android/support/库名/版本/美元库名- version-sources.jar美元

Jar file (as you probably know) is essentially a zip file - therefore you can simply extract its contents.

Jar文件(您可能知道)本质上是一个zip文件——因此您可以简单地提取它的内容。

For example, support-v4 v23.1.1 located at:

例如,support-v4 v23.1.1位于:

$SDK_DIR/extras/android/m2repository/com/android/support/support-v4/23.1.1/support-v4-23.1.1-sources.jar

#3


0  

Using Android Studio to read support library source is a more convenient way.Please follow these steps:

使用Android Studio来读取支持库源代码是一种更方便的方式。请遵循以下步骤:

  • Add dependency to support library in build.gradle. For example, compile 'com.android.support:appcompat-v7:23.1.0' in Android Studio project's build.gradle.
  • 在build.gradle中添加对库的支持。例如,在Android Studio项目的build.gradle中,编译“com.android.support:appcompat-v7:23.1.0”。
  • Sync or build your project.
  • 同步或构建项目。
  • Add a reference to support library class from your code file and then ctrl+right click.This will lead you to the source code.
  • 从代码文件中添加一个支持库类的引用,然后按ctrl+右键单击。这将引导您找到源代码。
  • There is a "Scrool from Source" toolbar button in project view.Click it and you will be navigated to the source code tree in project view.For example, at $PROJ/build/intermediates/exploded-aar/com.android.support/design/23.1.0/jars
  • 在项目视图中有一个“来自源的Scrool”工具栏按钮。单击它,您将被导航到项目视图中的源代码树。例如,美元项目/构建/中间体/ exploded-aar com.android.support /设计/ 23.1.0 / jar

#4


-3  

go to Android SDK manager then> go to extras>select Android Support Libraries >check on that and install it

转到Android SDK管理器然后转到extras>选择Android Support库>检查一下并安装它