Error:(28, 34) error: package android.support.annotation does not exist

Ehsan picture Ehsan · Apr 28, 2016 · Viewed 13k times · Source

After importing an Eclipse ADT project into Android Studio, I'm seeing these errors:

Error:(28, 34) error: package android.support.annotation does not exist

Error:(34, 34) error: package android.support.v4.content does not exist

Error:(26, 30) error: package android.support.v4.app does not exist

I have installed the Android Support Library and Repository through SDK Manager, and here's my dependencies in the build.grade file for the module:

compile project(':pullToRefreshListView')
compile project(':facebook')
compile 'com.android.support:support-v4:23.3.0'
compile 'com.android.support:design:23.3.0'
compile 'com.google.android.gms:play-services:+'
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
compile files('libs/google-play-services.jar')

Not sure why it doesn't see the Android support library.

Answer

oguzhan picture oguzhan · Jul 28, 2016

My result is not so qualified but it works for my project.

When i look an old project, i had that problem at facebook module which was added in my project. (That problem is not about facebook.)

There is a jar file called android-support-annotations.jar.

This jar file is in sdk_direction/extras/android/support/annotations/ path.

As first, I took it and i added it in that module's libs folder under my project.

Then i added below line in that module's build.gradle file;

compile fileTree(dir: 'libs', include: ['*.jar'])

As last, i synced the project and that problem has been resolved.

useful ref : Missing annotations.jar

This error also can occur while porting or accidental removal of dependencies: reference link