Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using java library from android framework in packages/apps

I am adding an app as part of my android build. The app make use of android-support-v4.jar. So I put the jar file inside libs folder of my application and make a reference to it from the Android.mk file of the application as shown.

include $(BUILD_PACKAGE)
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := libs/android-support-v4.jar
include $(BUILD_MULTI_PREBUILT)

On compiling the source code, I get the following error:

build/core/base_rules.mk:170: *** packages/apps/Personalization:  MODULE.TARGET.JAVA_LIBRARIES.android-support-v4 already defined by frameworks/support/v4.   Stop.
DDK build start.

error: build_android



build/core/base_rules.mk:170: *** packages/apps/Personalization:  MODULE.TARGET.JAVA_LIBRARIES.android-support-v4 already defined by frameworks/support/v4.   Stop.
DDK build start.

error: build_android

Can someone please let me know what need to be done such that, I can get rid of this error and get my build to work ok

UPDATE

My complete Android.mk file

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)

LOCAL_SRC_FILES := $(call all-subdir-java-files)
LOCAL_STATIC_JAVA_LIBRARIES := \
    android-support-v4 \
LOCAL_PACKAGE_NAME := Personalization
LOCAL_CERTIFICATE := platform

include $(BUILD_PACKAGE)
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := libs/android-support-v4.jar
include $(BUILD_MULTI_PREBUILT)
like image 887
user1400538 Avatar asked Mar 10 '26 12:03

user1400538


1 Answers

LOCAL_STATIC_JAVA_LIBRARIES := \
        android-support-v4

This should work. Put it anywhere before include $(BUILD_PACKAGE)

like image 114
StarPinkER Avatar answered Mar 12 '26 03:03

StarPinkER