OK, a couple hours of googling and experimenting seems to have found the solution.
Documenting it here for others to find:
The key was to
- Define
LOCAL_STATIC_JAVA_LIBRARIES
with a symbolic name for the library I want to include, e.g.libjsch
- Execute
CLEAR_VARS
(why?) - Define
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES
aslibjsch:<path-to-jar-file>
- Include
BUILD_MULTI_PREBUILT
.
(Testing showed that any symbolic name (e.g. "foo") works fine, as long as it matches in the two declarations.)
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_PACKAGE_NAME := MyProject
LOCAL_STATIC_JAVA_LIBRARIES := libjsch
include $(BUILD_PACKAGE)
include $(CLEAR_VARS)
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := libjsch:libs/jsch-0.1.49.jar
include $(BUILD_MULTI_PREBUILT)