【问题标题】:where does aapt look for resource identifiersaapt 在哪里查找资源标识符
【发布时间】:2012-11-08 01:19:06
【问题描述】:

我正在尝试从命令行构建一个 android 应用程序(在 "Minimal" source files to create Android app using Eclipse + ADT 中描述的那个)并且 aapt 失败并出现一些错误。
错误看起来像:

AndroidManifest.xml:1:错误:找不到资源标识符 包“android”中的属性“versionCode”
并重复一次 对于 AndroidManifest.xml 中的每个属性。

我正在运行的命令是:
aapt package -M AndroidManifest.xml -S res -J gen

所以我认为我无法为 aapt 定义在哪里查找资源标识符。这是正确的吗?
我如何告诉 aapt 在哪里查找资源标识符?
我正在运行 Android 资产打包工具 v0.2。
谢谢,吉姆。

编辑:我应该包含一个指向我复制的源页面的链接:
http://stackoverflow.com/questions/11888398/minimal-source-files-to-create-android-app-using -eclipse-adt

【问题讨论】:

  • 你的 AndroidManifest.xml 是什么样子的?
  • <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.minimal" android:versionCode="1" android:versionName="1.0"> <uses-sdk android:minSdkVersion="15" android:targetSdkVersion="15" /><br> <application android:label="Minimal"><br> <activity android:name="Minimal"><br> <intent-filter><br> <action android:name="android.intent.action.MAIN"/><br> </intent-filter><br> </activity><br> </application><br> </manifest><br>
  • 试图修复格式,我是新手。
  • 我找到了答案。资源标识符来自 android-sdk-linux/platforms/android-vv/android.jar
  • 我最终得到的命令是 --- aapt package -v -m -J $WORKINGDIR/gen -M $WORKINGDIR/AndroidManifest.xml -S $WORKINGDIR/res -I $PLATFORM/android .jar:

标签: android build aapt


【解决方案1】:

到目前为止,我在 Internet 上找到的创建 android 应用程序的最佳示例是 https://geosoft.no/development/android.html,如果您使用支持库应用程序主题,则很难弄清楚如何创建 R.java 类,我建议你可以使用这个参考答案How to compile an Android app with aapt2 without using any build tools?,通过它你将能够使用 android.jar 的通用主题,而不依赖于任何支持库。

【讨论】:

    猜你喜欢
    • 2012-03-16
    • 1970-01-01
    • 1970-01-01
    • 2016-02-21
    • 2019-09-03
    • 2011-06-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多