diff --git a/core/package_internal.mk b/core/package_internal.mk index 64040e5f9c..1ab2cf88b3 100644 --- a/core/package_internal.mk +++ b/core/package_internal.mk @@ -188,7 +188,10 @@ ifeq (true,$(LOCAL_EMMA_INSTRUMENT)) ifeq (true,$(EMMA_INSTRUMENT_STATIC)) ifdef LOCAL_JACK_ENABLED # Jack supports coverage with Jacoco +ifneq ($(LOCAL_SRC_FILES)$(LOCAL_STATIC_JAVA_LIBRARIES)$(LOCAL_SOURCE_FILES_ALL_GENERATED),) +# Only add jacocoagent if the package contains some java code LOCAL_STATIC_JAVA_LIBRARIES += jacocoagent +endif # Contains java code else LOCAL_STATIC_JAVA_LIBRARIES += emma endif # LOCAL_JACK_ENABLED @@ -198,7 +201,10 @@ ifdef TARGET_BUILD_APPS # In unbundled build merge the emma library into the apk. ifdef LOCAL_JACK_ENABLED # Jack supports coverage with Jacoco +ifneq ($(LOCAL_SRC_FILES)$(LOCAL_STATIC_JAVA_LIBRARIES)$(LOCAL_SOURCE_FILES_ALL_GENERATED),) +# Only add jacocoagent if the package contains some java code LOCAL_STATIC_JAVA_LIBRARIES += jacocoagent +endif # Contains java code else LOCAL_STATIC_JAVA_LIBRARIES += emma endif # LOCAL_JACK_ENABLED