【问题标题】:Error:(28, 34) error: package android.support.annotation does not exist错误:(28, 34) 错误:包 android.support.annotation 不存在
【发布时间】:2016-08-22 17:04:52
【问题描述】:

将 Eclipse ADT 项目导入 Android Studio 后,我看到以下错误:

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

我已经通过 SDK 管理器安装了 Android 支持库和存储库,这是我在模块的 build.grade 文件中的依赖项:

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')

不知道为什么它看不到 Android 支持库。

【问题讨论】:

标签: android android-studio dependencies android-support-library eclipse-adt


【解决方案1】:

我的结果不太合格,但它适用于我的项目。

当我查看一个旧项目时,我在我的项目中添加的 facebook 模块中遇到了这个问题。 (这个问题与 facebook 无关。)

有一个名为 android-support-annotations.jar 的 jar 文件。

此 jar 文件位于 sdk_direction/extras/android/support/annotations/ 路径中。

首先,我把它添加到我项目下该模块的 libs 文件夹中。

然后我在该模块的build.gradle 文件中添加以下行;

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

最后,我同步了项目,这个问题已经解决了。

有用的参考Missing annotations.jar

移植或意外删除依赖项时也会出现此错误:reference link

【讨论】:

    猜你喜欢
    • 2020-03-13
    • 1970-01-01
    • 2020-05-05
    • 1970-01-01
    • 2019-03-24
    • 1970-01-01
    • 1970-01-01
    • 2014-06-23
    • 2017-05-24
    相关资源
    最近更新 更多