Skip to content

Conversation

Copy link

Copilot AI commented Jan 8, 2026

Summary

Replaces android.util.Log with java.util.logging.Logger in the executorch_android library's main source code, making it portable for non-Android JVM environments.

Files modified:

  • Tensor.java - Log.e()LOGGER.severe()
  • Module.java - Log.e()LOGGER.severe(), Log.w()LOGGER.warning()
  • TrainingModule.java - Log.e()LOGGER.severe()

Note: LlmModule.java (mentioned in the issue) already had no Android dependencies. Test code in androidTest/ retains Android imports as expected.

Test plan

Verified no android.* imports remain in main source:

grep -r "import android\." extension/android/executorch_android/src/main/java
# No matches found

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • dl.google.com
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -XX:MaxMetaspaceSize=384m -XX:+HeapDumpOnOutOfMemoryError -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en (dns block)
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED -Xmx2048m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/REDACTED/.gradle/wrapper/dists/gradle-8.2-bin/bbg7u40eoinfdyxsxr3z4i7ta/gradle-8.2/lib/gradle-launcher-8.2.jar -javaagent:/home/REDACTED/.gradle/wrapper/dists/gradle-8.2-bin/bbg7u40eoinfdyxsxr3z4i7ta/gradle-8.2/lib/agents/gradle-instrumentation-agent-8.2.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 8.2 (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

On LlmModule.java, is it possible to remove all android specific dependencies from this file (and other files under executorch_android) ? like android.util.log; what about others?


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI self-assigned this Jan 8, 2026
@pytorch-bot
Copy link

pytorch-bot bot commented Jan 8, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/16502

Note: Links to docs will display an error until the docs builds have been completed.

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jan 8, 2026
@github-actions
Copy link

github-actions bot commented Jan 8, 2026

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

Copilot AI changed the title [WIP] Remove Android specific dependencies from LlmModule Remove android.util.Log dependency from executorch_android main source Jan 8, 2026
Copilot AI requested a review from kirklandsign January 8, 2026 01:56
@kirklandsign
Copy link
Contributor

@copilot can I still see the logs from logcat?

Copy link
Author

Copilot AI commented Jan 8, 2026

@copilot can I still see the logs from logcat?

No, java.util.logging.Logger messages are not automatically routed to logcat on Android by default. This would be a regression in debug experience.

To preserve logcat visibility, we would need to either:

  1. Keep android.util.Log (current approach won't work for the portability goal)
  2. Add a custom logging handler that routes to logcat on Android
  3. Use a logging abstraction that can be configured differently per platform

Would you like me to revert these changes, or would you prefer a different approach that maintains logcat compatibility while still achieving the portability goal?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants