Android 更新到 ADT 23 后找不到 annotations.jar

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24438748/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 08:08:40  来源:igfitidea点击:

Fail to find annotations.jar after updating to ADT 23

androideclipseadt

提问by Alin

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.

所以,看到新的Android L出来了,我说我应该试一试。我从 SDK 工具然后从更新安装了新的 ADT 更新。Eclipse 重新启动后,我收到 Android Dependencies failed to load 因为找不到 \android-sdk\tools\support\annotations.jar 的错误。

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.

好吧,我对自己说,也许 ADT 更新不顺利,所以看到新的 eclipse 4.4 出来了,我想我可以重新安装。所以下载了 eclipse 4.4,安装了 ADT 工具和 android sdk ......我得到了同样的错误。

Any ideas on how to fix this ?

有想法该怎么解决这个吗 ?

采纳答案by Kyle Ivey

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

谷歌某人的临时解决方案已发布在问题跟踪器上: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

请等待一两天内的更新版本。在此之前,您的解决方法是下载以下之一:

并复制以下文件:

  • 工具/ hprof-conv
  • 工具/支持/annotations.jar
  • 工具/保护

回答by user2967137

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

卸载/安装支持库没有帮助,所以我这样做了:

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

找到..\android-sdk\extras\android\support\annotations\android-support-annotations.jar并复制到..\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.

问题从那时起就没有了。看起来不是非常棒的解决方案,但至少现在我可以在 Eclipse 中构建我的项目。

回答by GavinCT

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

右键单击您的项目--> project.properties-->target=android-19

回答by Luca Sepe

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

明天我在更新到 ADT 23 后遇到了同样的问题。

The problem is related to the annotations.

问题与注释有关。

There are two libraries with annotations in the Android SDK:

Android SDK 中有两个带有注解的库:

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

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

android-sdk/tools/support/annotations.jar

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

那...随着新的 ADT 更新,由于某种原因消失了。

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

这个包包含两个注释(可能是最常用的:-)):

  • SupportLint
  • TargetApi
  • 支持Lint
  • 目标API

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

没有它们,如果您的代码(或依赖项使用它们)Eclipse 会抱怨。

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

为了解决这个问题,我们需要以前的annotation.jar.

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

所以我从@aarati 建议的链接下载了文件:

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

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

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

将其重命名annotation.jar并移至:android-sdk/tools/support/

Restarting Eclipse everything will be fine.

重新启动 Eclipse 一切都会好起来的。

回答by SHS

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

在 Eclipse 上 - 更新 ADT 或更新 Google SDK 版本后,我们发现现有版本的 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'

从 Eclipse 的项目菜单中,取消选中“自动构建”

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

1)删除'google-play-services_lib'的现有lib项目。

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

2) Eclipse 菜单 --> 文件 --> 导入 --> 'Existing Android Code Into Workspace'

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

从“android-sdk\extras\google\google_play_services\libproject\google-play-services_lib”中选择项目

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

3)通过“要导入的项目”中的复选框选择相同的项目

4) Also check 'Copy projects into workspace'

4)同时选中“将项目复制到工作区”

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

5) 当项目出现在“包资源管理器”中时,右键单击它并选择属性。

Select 'Android'

选择“安卓”

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

(作为'Gavin Chen'的解决方案) - 为这个库项目选择最新的平台和Api级别,然后单击“确定”关闭属性

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

5)再次右键单击“Package Explorer”中的同一个lib项目,单击“Build project”

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

现在您会发现 Google Play 服务库已正确构建。

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.

然后,您可以构建依赖于它的其他项目。您可能还需要从您的项目 -- 属性 -- Android -- 库中“删除”和“添加”google-play-service_lib。

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

您可以从“项目”菜单中重新选择“自动构建”选项。

回答by user3790477

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

如果您使用 build.gradle 脚本,那么只需将“compileSdkVersion”设置为 19。

... android {

... 安卓 {

compileSdkVersion 19
buildToolsVersion "19.1.0"

sourceSets {

...

...

回答by Ingo

You have to Update your ADT to the Latest Version!

您必须将 ADT 更新到最新版本!

In Eclipse go to Help

在 Eclipse 中转到帮助

Install New Software ---> Add

安装新软件 ---> 添加

inside Add Repository write:

在 Add Repository 里面写:

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

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

Double click in the opening Box the 1 entry.

双击打开框中的 1 个条目。

Follow the Eclipse instructions.

按照 Eclipse 说明进行操作。

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

加载一段时间后,您将获得最新的开发者工具和 NDK 插件

Repeat this for 2 times

重复此操作2次

Tom

汤姆

回答by S.Thiongane

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

我已经在这里回答了:https: //stackoverflow.com/a/25785428/2178259

I think Google has changed the location of that jar file from <SDK_DIR>/extras/android/support/annotations.jarto <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.

我认为 Google 已将该 jar 文件的位置从<SDK_DIR>/extras/android/support/annotations.jar更改为<SDK_DIR>/extras/android/support/annotations/android-support-annotations.jar

为了解决这个问题,我使用这个 jar 在我的工作区中的所有项目和库上执行了以下步骤:

  • 刚刚从 Java Build Path -> Libray Tab 中删除了文件,
  • 然后 Add External Jars
  • 从上面给定的位置选择文件。