2016-01-12 52 views
1

我正嘗試使用android-support-design庫(因爲我使用的是來自支持設計庫的FAB),用於我的一個應用程序。我試着用下面Android.mk如何在Android.mk文件中包含android-support-design

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. 

有人可以幫助我在這個問題上。

回答

0

我也遇到了同樣的問題。

也許你的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) 
0

我的演示應用程序包括支持Android庫和leakcanary

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)