如何正确定义 v7 appcompat 依赖项? [英] How to define v7 appcompat dependency correctly?

查看:33
本文介绍了如何正确定义 v7 appcompat 依赖项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构建一个(继承的)Android 项目.我正在使用 表示绝对路径将在 Windows 上与 android.library.reference 一起使用,但不适用于 Unix 或 Mac.

和平.

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 resolved such as:

<style name="AppBaseTheme" parent="@style/Theme.AppCompat.Light">

This is the original error I ran into:

[...]/res/values/styles.xml:8: error: Error retrieving parent for item:
No resource found that matches the given name '@style/Theme.AppCompat.Light'.

I then noticed that project.properties has this appcompat reference which is broken on my (OS X) machine:

target=android-18
android.library.reference.1=../../../../adt-bundle-linux-x86_64/sdk/extras/android/support/v7/appcompat

I tried to fix that by making the reference relative to ${sdk.dir}:

android.library.reference.1=${sdk.dir}/extras/android/support/v7/appcompat

So now that path should be correct. But now when I run ant debug:

BUILD FAILED
/opt/android-sdk-macosx/tools/ant/build.xml:573: 
  /opt/android-sdk-macosx/extras/android/support/v7/appcompat resolve to a 
  path with no project.properties file for project /Users/joka/devel/project/

So, any ideas? What's the simplest way to get this project built?

(Please note that Ecplise-specific advice won't be useful to me.)

Edit: The Android SDK installation looks like this:

解决方案

I ran into the same problem, so I tried using a relative path and that fixed the problem for me. It looks like only relative paths work with android.library.reference. I did a quick search to verify this, and came across this stackoverflow link which indicates that absolute paths will work with android.library.reference on Windows, but not on Unix or Mac.

Peace.

这篇关于如何正确定义 v7 appcompat 依赖项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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