user3009344 user3009344 - 1 month ago 12x
Android Question

Errors in

After setting up Android Studio, I tried to find out how few of the methods work but I can see that Activity class have got a lot of errors.

For example:

// Gives: cannot resolve symbol 'CallSuper'

// Gives: cannot resolve method 'trackActivity('
private final Object mInstanceTracker = StrictMode.trackActivity(this);

// Gives: cannot resolve symbol 'MainThread'

// **312 errors in, 579 in android.view.View**

My application works fine though. How can i make those errors disappear and be able to see documentation of structures that cannot be resolved now?

Details on my Android Studio 2.1.3 configuration

Installed in Standalone SDK Manager:

  • Android SDK Tools

  • Android SDK Platform-tools

  • Android SDK Build-tools

  • SDK Platform and Sources for API 24

  • SDK Platform, Documentation, Google APIs and sources for API 23

  • Extras: Android Support Repository, Google Repository and Google USB Driver


Being precise, those aren't errors in the source code for Activity/View it's just that :

  • Your IDE can't find the class android.annotation.CallSuper in it's classpath.
  • It cannot resolve method trackActivity in class

This is because the SDK is subset of the actual Android platform. The SDK shipped to the developers a.k.a Public API utilizes a lot of platform features a.k.a. Internal APIs, hence you can't find them in your SDK 24 classpath.

So why are all these portions hidden from developers?
It's kept hidden from developers because most of its implementation varies from device to device, plus they wouldn't be required in 99.99% cases (metaphorical figure not actual stats). You might want to have a look here.