应用程序兼容性V7包不存在 [英] appcompat v7 package does not exist

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

问题描述

使用工具23.0.2
而最新的SDK

Using tools 23.0.2 And latest SDK

使用手动Ant构建。

我检查了我的XML资源的错误。结果
我已经通过整齐运行他们,他们都OK。
我已经清理项目。

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

但我依然得到错误尝试使用应用程序兼容性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

当我运行蚁调试它建立的应用程序兼容性库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

和这里就是我看到的错误:

And here's the errors I'm seeing:

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;

这篇关于应用程序兼容性V7包不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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