我正在尝试将应用程序添加到自定义Android构建中,但它无法理解Theme.AppCompat.Light.DarkActionBar和colorPrimary以及colorAccent等资源,这让我相信它在阅读和构建R时遇到了问题的.java。
target R.java/Manifest.java: MyApplication21 (out/target/common/obj/APPS/MyApplication21_intermediates/src/R.stamp)
packages/apps/MyApplication21/res/values/styles.xml:4: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.
packages/apps/MyApplication21/res/values/styles.xml:8: error: Error: No resource found that matches the given name: attr 'colorAccent'.
packages/apps/MyApplication21/res/values/styles.xml:6: error: Error: No resource found that matches the given name: attr 'colorPrimary'.
packages/apps/MyApplication21/res/values/styles.xml:7: error: Error: No resource found that matches the given name: attr 'colorPrimaryDark'.
build/core/package_internal.mk:236: recipe for target 'out/target/common/obj/APPS/MyApplication21_intermediates/src/R.stamp' failed
make: *** [out/target/common/obj/APPS/MyApplication21_intermediates/src/R.stamp] Error 1
make: Leaving directory '/home/mkemp/android'
#### make failed to build some targets ####
android/packages/apps/MyApplication21
创建了一个Android.mk文件
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
# Java sources are in src
LOCAL_SRC_FILES := $(call all-java-files-under, src)
# Resources are in res
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
# These jars are needed
LOCAL_STATIC_JAVA_LIBRARIES += android-support-v7-appcompat \
android-support-v4
# The name of this application
LOCAL_PACKAGE_NAME := MyApplication21
# No proguard
LOCAL_PROGUARD_ENABLED := disabled
到目前为止,我已经解决了错误,包括无法通过将android-support-v7-appcompat
和android-support-v4
按顺序包含在Android.mk文件中来理解ActionBarActivity和TaskStackBuilder等Java类,但我没有想知道我应该调用什么Java库来生成R.java文件。
有人可以帮忙吗?
编辑:
我注意到android/out/target/common/obj/APPS/MyApplication21/src
中没有创建R.stamp文件,应该根据APPS文件夹中的其他应用程序来构建这个文件...并再次让我相信罪魁祸首是R .java文件未正确生成。