0

I would like to remove the hardcode file path from Android.mk.

ifeq ($(TARGET_BUILD_VARIANT),user)
  LOCAL_SRC_FILES     := ./app/build/outputs/apk/release/app-release.apk
else
  LOCAL_SRC_FILES     := ./app/build/outputs/apk/debug/app-debug.apk
endif

Maybe I can run a find command but not sure how can I get the user version with from release folder and userdebug version from debug folder.

Maybe something like below:

LOCAL_SRC_FILES :=$(some command)

lucky1928
  • 8,708
  • 10
  • 43
  • 92
  • You haven't really told us much about your project, which makes it hard to answer your question. It's certainly possible to run shell command from within an `Android.mk` (look up `$(shell)`). However, if you're building with Gradle, then it might be a better solution to determine the path from within your `build.gradle` and pass it as an argument when invoking `ndk-build`. – Michael Mar 09 '22 at 16:01

1 Answers1

0

Something like below:

LOCAL_SRC_FILES  := $(shell find -name '*.apk'|grep '$(FOLDER)/.*$(ARCH)')
beetlej
  • 1,841
  • 4
  • 13
  • 27