我正在尝试为我的一个应用程序使用android-support-design
库(因为我使用了来自支持设计库的FAB.)。我试着用下面的Android.mk 来构建它
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_STATIC_JAVA_LIBRARIES := android-support-v4
LOCAL_STATIC_JAVA_LIBRARIES += android-support-v7-appcompat
LOCAL_STATIC_JAVA_LIBRARIES += android-support-design-res
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res frameworks/support/v7/appcompat/res frameworks/support/design/res
LOCAL_PACKAGE_NAME := TestApp
LOCAL_AAPT_FLAGS :=
--auto-add-overlay
--extra-packages android.support.v7.appcompat
--extra-packages android.support.design
include $(BUILD_PACKAGE)
但我总是收到这样的错误:
make: *** No rule to make target `out/target/common/obj/JAVA_LIBRARIES/android-support-design-res_intermediates/javalib.jar', needed by `out/target/common/obj/APPS/TestApp/classes-full-debug.jar'. Stop.
有人能在这个问题上帮我吗。
我也遇到了同样的问题。
也许你的mk错了。
我解决了这个问题。
单向:
mmm frameworks/support/design/
mmm your app
其他方式:
使用使命令
例如。
make -j4 TestApp
我的Android.mk是
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_STATIC_JAVA_LIBRARIES := android-support-v4 android-support-design android-support-v7-appcompat
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES :=
$(call all-java-files-under, src)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
frameworks/support/v7/appcompat/res
frameworks/support/design/res
LOCAL_PACKAGE_NAME := MyDemo
LOCAL_CERTIFICATE := platform
LOCAL_PRIVILEGED_MODULE := true
LOCAL_AAPT_FLAGS :=
--auto-add-overlay
--extra-packages android.support.design
--extra-packages android.support.v7.appcompat
include $(BUILD_PACKAGE)
我的Demo应用程序包括Android支持库和Leakanary
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_PROGUARD_ENABLED := disabled
#LOCAL_PROGUARD_FLAG_FILES := proguard.flags
LOCAL_MODULE_TAGS := optional
LOCAL_STATIC_JAVA_LIBRARIES :=
commonData-support-v4
dpt-haha-2.0.2
dpt-leakcanary-analyzer-1.4-beta2
dpt-leakcanary-watcher-1.4-beta2
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_STATIC_JAVA_AAR_LIBRARIES:=
commonData-recyclerview-v7
commonData-appcompat-v7
commonData-design
commonData-cardview-v7
dpt-leakcanary-android-1.4-beta2
LOCAL_PACKAGE_NAME := AndroidAARDependDemo
LOCAL_AAPT_FLAGS := --auto-add-overlay
--extra-packages android.support.v7.recyclerview
--extra-packages android.support.design
--extra-packages android.support.v7.cardview
--extra-packages android.support.v7.appcompat
--extra-packages com.squareup.leakcanary
LOCAL_CERTIFICATE := platform
include $(BUILD_PACKAGE)
include $(CLEAR_VARS)
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES :=
commonData-support-v4:libs/android-support-v4.jar
commonData-appcompat-v7:libs/appcompat-v7-23.2.1.aar
commonData-recyclerview-v7:libs/recyclerview-v7-23.2.1.aar
commonData-design:libs/design-23.2.1.aar
commonData-cardview-v7:libs/cardview-v7-23.2.1.aar
dpt-leakcanary-android-1.4-beta2:libs/leakcanary-android-1.4- beta2.aar
dpt-haha-2.0.2:libs/haha-2.0.2.jar
dpt-leakcanary-analyzer-1.4-beta2:libs/leakcanary-analyzer-1.4-beta2.jar
dpt-leakcanary-watcher-1.4-beta2:libs/leakcanary-watcher-1.4-beta2.jar
include $(BUILD_MULTI_PREBUILT)