appcompat v7 包不存在 [英] appcompat v7 package does not exist

查看:29
本文介绍了appcompat v7 包不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用工具 23.0.2和最新的SDK

Using tools 23.0.2 And latest SDK

使用手动 ant 构建.

Using manual ant build.

我已经检查了我的 xml 资源是否有错误.
我已经把它们整理干净了,它们没问题.我已经清理了项目.

I've checked my xml resources for errors.
I've run them through tidy and they are ok. I've cleaned the project.

但我仍然在尝试使用 appcompat v7 支持库时遇到错误.

But still I'm getting errors trying to use appcompat v7 support library.

这里是我有 appcompat_v7 库的地方:

here's where I have the appcompat_v7 library:

$ ls  ../sdk/extras/android/support/v7/appcompat/
AndroidManifest.xml  build.xml  libs              proguard-project.txt  README.txt  src
bin                  gen        local.properties  project.properties    res

在我的主要项目 project.properties 中:

And in my main project project.properties:

android.library.reference.4=../sdk/extras/android/support/v7/appcompat

当我运行ant debug"时,它会构建 appcompat 库 classes.jar

When I run 'ant debug' it builds the appcompat library classes.jar

这是生成的 classes.jar 和 R.java:

Here's the generated classes.jar and R.java:

$ ls -l ../sdk/extras/android/support/v7/appcompat/bin/classes.jar 
-rw-rw-r--. 1 androidin androidin 538 Jul 19 12:24    ../sdk/extras/android/support/v7/appcompat/bin/classes.jar

$ ls -l ../sdk/extras/android/support/v7/appcompat/gen/android/support/v7/appcompat/R.java 
-rw-rw-r--. 1 androidin androidin 174070 Jul 19 12:24 ../sdk/extras/android/support/v7/appcompat/gen/android/support/v7/appcompat/R.java

这是我看到的错误:

ListPopupWindow.java:26: error: package android.support.v7.appcompat does not exist
[javac] import android.support.v7.appcompat.R;

还需要什么?

推荐答案

如果其他人遇到此问题:

In case anyone else runs into this issue:

问题源于使用了部分支持库本身的文件.

The problem stemmed from utilizing a file from part of the support library itself.

我需要在该文件中修改以下内容:

All I needed to modify in that file was the following:

import android.support.v7.appcompat.R;
to
import my.package.R;

这篇关于appcompat v7 包不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆