5

I get "cannot resolve symbol" errors because android.jar is missing some classes. For example:

import android.annotation.MainThread;
import android.annotation.WorkerThread;

import android.annotation.CallSuper;
import android.annotation.DrawableRes;
import android.annotation.IdRes;
import android.annotation.IntDef;
import android.annotation.LayoutRes;
import android.annotation.MainThread;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.StyleRes;
import android.annotation.SystemApi;

and many others.

These classes are present as .java files in sources/android-xx but not in actual .jar file.

What am I doing wrong?

user2758776
  • 421
  • 1
  • 5
  • 15

2 Answers2

0

The problem is android.annotation.Nullable and others are marked with @hide javadoc attribute, so it cannot be used outside of google. See here about @hide: What does @hide mean in the Android source code?

For android annotations try to use support annotations: https://developer.android.com/studio/write/annotations.html

igork
  • 568
  • 7
  • 8
-1

First of all you go to default settings.After that in the search box type gradle.next you see the offline.remove the tick mark.apply the settings.Then after restart the android studio.after the restart studio missing jar files are automatically download. Next step is delete your gradle file completely.start the new project in your android studio.all gradle files and jar files are automatically download through the internet