How to build intermediate classes.jar in android N

来源:互联网 发布:seo入门 编辑:程序博客网 时间:2024/06/16 13:22
in Android M, you can achieve that by using LOCAL_JACK_ENABLED = disabled variable in your makefile.

In Android N it is more tricky...it is broken and the solution to this is yet to come in AOSP mainline of Android N.
Solution is available in master.

Checked in 7.1.1 Android N.

You need to make use of javac-check target. This has been implemented for this purpose.

make javac-check-$(LOCAL_MODULE)

So, if your module name is "ABCD"

make javac-check-ABCD

This generates a classes-full-debug.jar, in the common\obj\JAVA_LIBRARIES\ABCD_intermediates.

This is the jar which you can use in your Studio environment.

Most important, this solution is not yet visible in any of the tags on Android N branch. It is part of the master hence you need to add this solution to your branch manually.

https://android.googlesource.com/platform/build/+/32bd0adf9c5dcd1560d77bdb886c7acc78496657

Add targets for building individual modules using javacThis is needed in order to be able to run error prone (which isa plugin replacement for javac) on a subset of the java code.Bug: 31507496Test: Build javac-check-core-tests and check the resulting JARChange-Id: I5a556920572fcdad7b39d67e3f00fe0e0f1f8f46
diff --git a/core/host_java_library.mk b/core/host_java_library.mkindex 0a7dd8a..cc26d7c 100644--- a/core/host_java_library.mk+++ b/core/host_java_library.mk
@@ -73,6 +73,7 @@ $(transform-host-java-to-package)  javac-check : $(full_classes_compiled_jar)+javac-check-$(LOCAL_MODULE) : $(full_classes_compiled_jar)  # Run jarjar if necessary, otherwise just copy the file. ifneq ($(strip $(LOCAL_JARJAR_RULES)),)
diff --git a/core/java.mk b/core/java.mkindex e505ffb..606b474 100644--- a/core/java.mk+++ b/core/java.mk
@@ -416,6 +416,7 @@ $(transform-java-to-classes.jar)  javac-check : $(full_classes_compiled_jar)+javac-check-$(LOCAL_MODULE) : $(full_classes_compiled_jar)  # Run jarjar if necessary, otherwise just copy the file. ifneq ($(strip $(LOCAL_JARJAR_RULES)),)

原创粉丝点击