How to define v7 appcompat dependency correctly?

前端 未结 3 544
一个人的身影
一个人的身影 2021-02-05 15:17

I\'m trying to get an (inherited) Android project to build. I\'m using Ant & command line tools (and IDEA).

In styles.xml, there are references that cannot be resolv

3条回答
  •  粉色の甜心
    2021-02-05 15:38

    As Jay indicated, only relative paths will work on Unix/Mac.

    For the Ant build to work, I also needed to generate build.xml for the appcompat project, using the command android update project -p

    , in my case:

    /opt/android-sdk-macosx/tools/android update project 
        -p /opt/android-sdk-macosx-r22.0.1/extras/android/support/v7/appcompat
    

    The exact config for me was:

    android.library.reference.1=../../../../../../../opt/android-sdk-macosx/extras/‌​android/support/v7/appcompat

    (This also works in local.properties, which I think is a better place since the same path won't work for all developers.)


    I merely promoted my comment from 6 months ago into an answer as someone suggested.

    By the way, now that I actually know something about Android development, I'd urge anyone who has the chance to ditch Ant and look into the new Gradle-based build system which is totally sweet in comprarison. It is CI-friendly and makes it easy to automate useful things (like using different package name and app icon for different build types). Stack Overflow will help when you run into problems.

    Using the support libraries with Gradle, you'd skip all the above hassle and simply do:

    dependencies {
        compile "com.android.support:appcompat-v7:18.0.+"
    }
    

提交回复
热议问题