Alin
Alin

Reputation: 14581

Fail to find annotations.jar after updating to ADT 23

So, seeing that the new Android L is out, I said I should give it a try. I installed the new ADT update from SDK tools and then from the updates. After Eclipse restart, I get the error that Android Dependencies failed to load because \android-sdk\tools\support\annotations.jar cannot be found.

I checked the folder and it does not have the file.

Well, I said to myself that maybe the ADT update didn't go well so seeing that the new eclipse 4.4 is out I thought I could do a fresh install. So downloaded eclipse 4.4, installed the ADT tools and android sdk... and I get the same error.

Any ideas on how to fix this ?

Upvotes: 55

Views: 20514

Answers (9)

S.Thiongane
S.Thiongane

Reputation: 6905

I have already answered it here : https://stackoverflow.com/a/25785428/2178259

I think Google has changed the location of that jar file from <SDK_DIR>/extras/android/support/annotations.jar to <SDK_DIR>/extras/android/support/annotations/android-support-annotations.jar

To solve this issue, I followed these steps on all projects and libraries in my workspace using this jar:

  • Just removed the file from Java Build Path -> Libray Tab,
  • then Add External Jars
  • Chose file from the given location above.

Upvotes: 0

Ingo
Ingo

Reputation: 5381

You have to Update your ADT to the Latest Version!

In Eclipse go to Help

Install New Software ---> Add

inside Add Repository write:

https://dl-ssl.google.com/android/eclipse/

Double click in the opening Box the 1 entry.

Follow the Eclipse instructions.

After loading some time you will get the newest Developer Tools and NDK Plugins

Repeat this for 2 times

Tom

Upvotes: 0

user3790477
user3790477

Reputation: 1

If you use build.gradle script, then just set the "compileSdkVersion" to 19.

... android {

compileSdkVersion 19
buildToolsVersion "19.1.0"

sourceSets {

...

Upvotes: 0

Kyle Ivey
Kyle Ivey

Reputation: 6042

A temporary solution from someone at google has been posted on the issue tracker: http://code.google.com/p/android/issues/detail?id=72419#c12

Please wait for an updated version within a day or two. Until then, your workaround is to do download one of:

and copy over the following files:

  • tools/hprof-conv
  • tools/support/annotations.jar
  • tools/proguard

Upvotes: 19

user2967137
user2967137

Reputation: 330

Uninstall/install Support library didn't help, so I did this:

Found ..\android-sdk\extras\android\support\annotations\android-support-annotations.jar and copied it to ..\android-sdk\tools\support\annotations.jar

The problem is gone since then. Doesn't look as incredibly awesome solution but at least now I can build my project in Eclipse.

Upvotes: 33

Luca Sepe
Luca Sepe

Reputation: 2445

Tomorrow I had the same problem after the update to ADT 23.

The problem is related to the annotations.

There are two libraries with annotations in the Android SDK:

android-sdk/extras/android/support/annotations/android-support-annotations.jar

this package contains:

  • AnimRes
  • AnimatorRes
  • AnyRes
  • ArrayRes
  • AttrRes
  • BoolRes
  • ColorRes
  • DimenRes
  • DrawableRes
  • FractionRes
  • IdRes
  • IntDef
  • IntegerRes
  • InterpolatorRes
  • LayoutRes
  • MenuRes
  • NonNull
  • Nullable
  • PluralsRes
  • RawRes
  • StringDef
  • StringRes
  • StyleRes
  • StyleableRes
  • XmlRes

and

android-sdk/tools/support/annotations.jar

that...with the new ADT update, for some reason disappeared.

This package contains the two annotations (probably the most used :-)):

  • SupportLint
  • TargetApi

Without them, if your code (or dependencies use them) Eclipse will complain.

To fix this problem, we need the previous annotation.jar.

So I downloaded the file from the link suggested by @aarati:

http://central.maven.org/maven2/com/google/android/annotations/4.1.1.4/annotations-4.1.1.4.jar

Renamed it in annotation.jar and moved to: android-sdk/tools/support/

Restarting Eclipse everything will be fine.

Upvotes: 8

GavinCT
GavinCT

Reputation: 129

Right click on your project --> project.properties --> target=android-19

Upvotes: 13

SHS
SHS

Reputation: 1412

On Eclipse - After updating ADT or Updating Google SDK version, we find problem for the existing version of Google Play Service Lib.

From the help of Above answers and other search, found the following way to correct it.

From Project menu of Eclipse, uncheck 'Build Automatically'

1) Delete the existing lib project of 'google-play-services_lib'.

2) Eclipse Menu --> File --> Import --> 'Existing Android Code Into Workspace'

select the project from 'android-sdk\extras\google\google_play_services\libproject\google-play-services_lib'

3) Select the same project by checkbox in 'Project to Import'

4) Also check 'Copy projects into workspace'

5) When the project appears in 'package explorer', right click on it and select Properties.

Select 'Android'

( as solution of 'Gavin Chen' ) - select the latest platform and Api level for this library project and click OK to close properties

5) again right click on same lib project from 'Package Explorer', click on 'Build project'

Now you will find the Google Play Service Library is built properly.

Then you may build your other projects, which are dependent on it. You may also need to 'Remove' and 'Add' the google-play-service_lib, from your project -- properties -- Android -- Library.

You may re select 'Build Automatically' option from 'Project' Menu.

Upvotes: 0

aarati
aarati

Reputation: 87

Adding http://central.maven.org/maven2/com/google/android/annotations/4.1.1.4/annotations-4.1.1.4.jar as annotations.jar resolved my errors

Upvotes: 1

Related Questions