I meets some problems so I want to find the source code of the Android support libraries . For example , I want to read the ActionBarActivity.java source code in version 19.0.1 and 20.0.0 in support.appcompat-v7 , and find out the difference between the two versions.
I found the https://github.com/android/platform_frameworks_base , but the release have named as android-x.x.x_rxx but not like 19.0.1 .
6 Answers
Answers 1
You can browse to your sdk directory and support directory and you can find the aar files there- on mac its i located on
/Users/username/Library/Android/sdk/extras/android/m2repository/com/android/support/
Ensure you are having the the version you want to see. And Then change the version in your gradle.build to the one you need. Then sync the project, Now Change the explorer mode of android studio to the project mode.
Now you can browse to the external libraries to see the sources.
Answers 2
You can download prebuilt source jars by version from here https://android.googlesource.com/platform/prebuilts/maven_repo/android/+/master/com/android/support/appcompat-v7
Although it seems they have removed sources for anything older than 22.1.0 there.
Alternatively you can get all changes for a specific file here https://android.googlesource.com/platform/frameworks/support/+log/master/v7/appcompat/src/android/support/v7/app/ActionBarActivity.java
Answers 3
So simple Just create a project with version 19.0.1 and crate other project with version 20.0.0 , then extend your activity from actionbaractivity or else , Hold on ctrl key and click on actionbaractivity .
Answers 4
If you have downloaded the sources, you should be able to find them versioned at one of these three places (using OSX, but should be familiar enough to deduce the OS locations)
Android Sources
~/Library/Android/sdk/sources/
Maven Local Repo
~/.m2/repository
Gradle Cache (location could probably be a different name)
~/.gradle/caches/modules-2/files-2.1
Using either of these, it shouldn't be too hard to do a diff of the source code that you need.
Answers 5
If you don't want to use any IDE, you can download command line tools only from https://developer.android.com/studio/index.html#downloads
This example is for OSX:
- After download command line tools, you can run SDK Manager using this command: "sh android", maybe you need to add "sudo" before the command.
- SDK Manager will show up
- Select Sources for Android SDK or any packages you want to download
- Click button Install, and accept licences.
- After download succeed, you can navigate to the folder where you put the SDK, and then go to sources and navigate to ActionBarActivity or any sources you want
Answers 6
You can use grepcode to see Android source code
For example you want want to see ActionBarActivity.java
source code in version 19.0.1 and 20.0.0 in support.appcompat-v7 .
Well API 19.0.1 will be Android version 4.4 as seen from Wiki
Now you can pick desired android version from grepcode. For example you can see Android 4.4 (Api 19) source code on grepcode here
Next you can see source code for ActionBarActivity inside support package
Similarly you can see Android source code for different build versions without IDE.
0 comments:
Post a Comment