Package: apksigner<div>Version: 35.0.2-1</div><div>Severity: normal</div><div><br></div><div>Dear Maintainer,</div><div><br></div><div>I noticed that apksigner depends on default-jre, although it is a command line tool for signing and verifying APKs. On a minimal headless installation, this dependency causes APT to install the GUI capable Java runtime and its additional dependencies.</div><div><br></div><div><span style="font-size: 0.875rem;">apksigner works correctly  without installing the full default-jre, only with <span>default-jre-headless</span> runtime, manually tested.</span></div><div><br></div><div>I then inspected the Debian source package android-platform-tools-apksig (35.0.2-1) to identify the source of the dependency.</div><div><br></div><div>The relevant part of debian/rules is:</div><div><br></div><div>export JAVA_HOME=/usr/lib/jvm/default-java</div><div><br></div><div>The executable JAR is built using jh_build, and its manifest contains:</div><div><br></div><div>Debian-Java-Home: /usr/lib/jvm/default-java</div><div>Main-Class: com.android.apksigner.ApkSignerTool</div><div><br></div><div>In the installed javahelper 0.80, jh_build sets the Debian-Java-Home manifest attribute from JAVA_HOME:</div><div><br></div><div>$main_section->set_value('Debian-Java-Home', $JAVA_HOME);</div><div><br></div><div>jh_depends subsequently reads this attribute:</div><div><br></div><div>JHOME=""extractline META-INF/MANIFEST.MF Debian-Java-Home""</div><div>JVM=""home-to-jvm "$JHOME"""</div><div><br></div><div>The resulting JVM identifier is "default". Since no headless modifier is selected, jh_depends generates the dependency on default-jre:</div><div><br></div><div>JVMDEPS="default-jre$headless $alternateversiondeps "</div><div><br></div><div>The binary package's debian/control contains:</div><div><br></div><div>Depends: ${misc:Depends}, ${java:Depends}</div><div><br></div><div>This allows the generated dependency to be incorporated into the final package.</div><div><br></div><div>A runtime tests indicate that apksigner does not require the GUI capable runtime for its CLI functionality.</div><div><br></div><div>Debian Java Policy ยง2.3 states that Java programs must depend on the required runtime environment, using default-jre or default-jre-headless depending on whether a GUI is needed.</div><div style="font-family: Arial, sans-serif; font-size: 14px; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);"><br></div><div style="font-family: Arial, sans-serif; font-size: 14px; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">I'm not sure that apksigner is the only that have this problem in its metadata or in other packages also. </div><div style="font-family: Arial, sans-serif; font-size: 14px; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);"><br></div><div>Could the runtime dependency be generated using the headless option instead?</div><div><br></div><div>This would avoid requiring the GUI capable Java runtime on headless systems, including minimal containers and automated Android signing environments.</div><div><br></div><div>Thank you for your time.</div><div style="font-family: Arial, sans-serif; font-size: 14px; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);"><br></div><div style="font-family: Arial, sans-serif; font-size: 14px; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">-krecod</div>