0

How can I create and Android project that links to complete android source code, including classes in "android.annotation" ?

More precisely:

  • Create a new android project in Android Studio 1.5.1, Minimum SDK = API 23. Template: Add no activity.
  • Add this fix to resolve junit dependency: https://stackoverflow.com/a/32566057/4182868
  • gradle sync, make project
  • open class android.app.Activity

Result: a number of import statements are not resolved:

enter image description here

Community
  • 1
  • 1
Desik
  • 604
  • 2
  • 8
  • 21

1 Answers1

0

That's because those classes are actually marked as @hide, and are stripped out of the Android SDK at build time. The SDK android.jar that your project is linked with simply doesn't contain those methods and classes, which is why the IDE gets confused when it looks up the source code for the SDK classes.

(Note: We include the same annotations in the support library, but with a different package prefix: android.support.annotation.*. Those are the annotations applications should be using. But the framework itself doesn't depend on the support library, the dependency is in the other direction.)

Tor Norbye
  • 9,062
  • 3
  • 29
  • 24
  • What I'm trying to do is to find the usages of a particular annotation in android source code. For that I would need to link to full Android source code from an IDE. – Desik Jan 09 '16 at 00:54