Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Errors in android.app.Activity.java

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'
android.annotation.CallSuper();  

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

// Gives: cannot resolve symbol 'MainThread'
@MainThread

// **312 errors in android.app.Activity, 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
like image 613
user3009344 Avatar asked Nov 08 '22 09:11

user3009344


1 Answers

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 android.app.Activity.

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.

like image 121
Sakchham Avatar answered Nov 15 '22 04:11

Sakchham