Rahul Baradia
Rahul Baradia

Reputation: 11951

Add androidx.viewpager2 to android.mk file

Trying to add androidx.viewpager2 to android.mk as below:

LOCAL_STATIC_ANDROID_LIBRARIES += \
    androidx.viewpager2_viewpager2

Not able to build code using MMA command and gives below error.

ninja: error: 'out/target/common/obj/JAVA_LIBRARIES/androidx.viewpager2_viewpager2_intermediates/package-res.apk', needed by 'out/target/product/apps/obj/APPS/app_intermediates/package-res.apk', missing and no known rule to make it

05:31:24 ninja failed with: exit status 1

failed to build some targets (05:38 (mm:ss))

How can I add androidx.viewpager2 to Android.mk Makefile.

Upvotes: 0

Views: 1118

Answers (2)

Rahul Baradia
Rahul Baradia

Reputation: 11951

Add following blocks to support/sync with .AAR library file in Android.mk file

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
.
.
LOCAL_PACKAGE_NAME := App_Name
.
LOCAL_PRIVATE_PLATFORM_APIS := true
.
LOCAL_STATIC_JAVA_LIBRARIES := AAR_file-alias
.
include $(BUILD_PACKAGE)
include $(CLEAR_VARS)
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := AAR_file-alias:lib_path/AAR_file.aar
include $(BUILD_MULTI_PREBUILT)

Upvotes: 1

Martin Zeitler
Martin Zeitler

Reputation: 76669

You'll have to add viewpager2-1.0.0.aar into LOCAL_STATIC_JAVA_LIBRARIES (or LOCAL_STATIC_JAVA_AAR_LIBRARIES).

Upvotes: 1

Related Questions