0

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.

Rahul Baradia
  • 11,802
  • 17
  • 73
  • 121
  • Note that we prefer a technical style of writing here. We gently discourage greetings, hope-you-can-helps, thanks, advance thanks, notes of appreciation, regards, kind regards, signatures, please-can-you-helps, chatty material and abbreviated txtspk, pleading, how long you've been stuck, voting advice, meta commentary, etc. Just explain your problem, and show what you've tried, what you expected, and what actually happened. – halfer Nov 25 '19 at 22:58
  • I don't downvote where someone makes one or two mistakes. I do sometimes downvote if the same errors are made despite a long history of my editing the old ones. We do not have enough editor resource here to maintain the levels of quality we would like, so it helps greatly if we can encourage posters to assist with curation (if only on their own material). – halfer Nov 26 '19 at 09:52
  • 1
    https://stackoverflow.com/q/31205856/3801327 – Rick Sanchez Nov 29 '19 at 18:36

2 Answers2

1

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

Martin Zeitler
  • 1
  • 19
  • 155
  • 216
1

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)
Rahul Baradia
  • 11,802
  • 17
  • 73
  • 121