appcompat v7 package does not exist

2019-07-18 12:57发布

问题:

Using tools 23.0.2 And latest SDK

Using manual ant build.

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

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

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

And in my main project project.properties:

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

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

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;

What else is needed?

回答1:

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;