Andriod:如何为 aapt 命令设置 lib 路径?

Yun*_* Li 5 android compilation aapt

我试图在 Windows 中使用命令行编译 Android 项目。当我使用aapt生成R文件时,出现如下错误:

 D:\SampleProject\MyApplication>aapt package -f -m -J ./gen -S ./app/src/main/res
 -I "D:\ProgramInstall\Android\Android SDK\platforms\android-21\android.jar" -M
./app/src/main/AndroidManifest.xml 

 .\app\src\main\res\values\styles.xml:4: error: Error retrieving parent for item:
 No resource found that matches the given name 'Theme.AppCompat.Light.DarkAction
Bar'.    
Run Code Online (Sandbox Code Playgroud)

我发现 Theme.Appcompact.Light.DarkActionBar 与 APPcompat_v7 floder 相关,而 floder 在 libs floder 下,我如何让编译器知道在哪里可以找到它需要的库?

小智 3

我知道为时已晚,或者您可能已经找到了答案但仍在发布:

D:\SampleProject\MyApplication>aapt package **--auto-add-overlay** -f -m -J ./gen -S ./app/src/main/res **-S "path_to_prebuilts\prebuilts\devtools\extras\android\support\v7\appcompat\res\"** -I "D:\ProgramInstall\Android\Android SDK\platforms\android-21\android.jar" -M ./app/src/main/AndroidManifest.xml
Run Code Online (Sandbox Code Playgroud)

  • 嗨@jal,我已经尝试过,它解决了一些错误,但显示“找不到资源......”错误 (2认同)