Errors in android.app.Activity.java

After setting up Android Studio, I tried to figure out how several methods work, but I see that the Activity class has a lot of errors.

For instance:

// 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 is working fine. How can I fix these errors and see documentation about structures that cannot be resolved now?

Android Studio 2.1.3 configuration details
Installed in the standalone SDK manager:

  • Android SDK Tools
  • Platforms for Android SDK
  • Built-in Android SDK Tools
  • Platform and SDK Sources for API 24
  • SDK Platform, Documentation, Google APIs, and Sources for API 23
  • Optional: Android support repository, Google repository, and USB driver for Google.
+5
source share
4 answers

To be precise, these are not errors in the source code for Activity/View , namely:

  • Your IDE cannot find the android.annotation.CallSuper class in this classpath.
  • It cannot enable the trackActivity method in the android.app.Activity class.

This is because the SDK is a subset of the real Android platform. The SDK provided by the aka Open API developers uses many of the capabilities of the aka platform Internal APIs , so they cannot be found in your path to the SDK 24 class.

So why are all these parts hidden from developers?
He was hiding from the developers, because most of its implementation varies from device to device, plus they are not needed in cases of 99.99% (a metaphorical figure is not actual statistics). You can look here .

+1
source

add to the build.gradle file:

 dependencies { compile 'com.android.support:support-annotations:22.2.0' } 
0
source

It just means that these classes arent on the way to classes. When you run the application on a mobile phone or in an emulator, make sure that all classes are present.

0
source

... I tried to figure out how little methods work

An easy way to take a look at the source code of Android is to simply browse it online. For example, here is the Activity class .

If you install the โ€œAndroid SDK Searchโ€ plugin for Chrome, it will automatically add source links to online Javadoc.

How can I remove these errors and see documentation about structures that cannot be resolved now?

The only way to view live code without compilation errors is to download and build the entire Android Open Source Project .

0
source

All Articles