6

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'
}

That resolves to get v4 as well.

How to see source when clicking to into classes?

e.g. android.support.v4.widget.DrawerLayout

Currently Android Studio says

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

For ADT it was How to add source + javadoc for android-support-v7?

Community
  • 1
  • 1
Paul Verest
  • 60,022
  • 51
  • 208
  • 332
  • please refer to http://stackoverflow.com/questions/12718753/how-to-download-dependency-sources-for-gradle-project-in-idea and http://gradle.org/docs/current/dsl/org.gradle.plugins.ide.idea.model.IdeaModule.html – madteapot Dec 22 '14 at 09:22

2 Answers2

1

Thanks to Setu for hint. As I already had all sources before, I just added in app/build.gradle

apply plugin: 'idea'
idea {
    module{
        sourceDirs += file("E:\\Android\\sdk\\extras\\android\\support\\v4\\src\\")
        sourceDirs += file("E:\\Android\\sources\\platform_frameworks_support\\v7\\appcompat\\src")
    }
}

below dependencies section and press "Sync project with Gradle Files"

Community
  • 1
  • 1
Paul Verest
  • 60,022
  • 51
  • 208
  • 332
1

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

IDE: Android studio 1.3.2

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

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) Rebuild project.

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

dessertcook
  • 361
  • 3
  • 5