Skip to content

Docs/Add Android instructions, demo app and example#882

Open
Chiogros wants to merge 2 commits intoapache:masterfrom
Chiogros:docs-add-android-demo-app
Open

Docs/Add Android instructions, demo app and example#882
Chiogros wants to merge 2 commits intoapache:masterfrom
Chiogros:docs-add-android-demo-app

Conversation

@Chiogros
Copy link

@Chiogros Chiogros commented Feb 12, 2026

Hi 👋🏻 ,

I'm developing Trante, an Android app to allow remote storage access from Android's file manager.
I used mina-sshd for SFTP access to remote servers and I wanted to contribute back to help future developers to use it.

This PR brings:

  • a complete Kotlin example
  • a link to my app as a demo, with direct reference to the class handling sshd-sftp calls
  • Proguard instructions to help with app optimizations
  • moving examples first and issues + next features then

I addition,

we would appreciate feedback on problems and solutions our users have encountered when running on Android

so here it is.

  1. Configuring filesystem.
    The existing example didn't do the trick for me. I targeted Android SDK 35 and as far as I can remember, I couldn't get a Path to use in Supplier because some methods were not available anymore on the JDK. After some digging, here's what worked:
// Set Android's filesystem path
val path: Supplier<Path> = Supplier { Paths.get("") }
setUserHomeFolderResolver(path)
val client: SshClient = SshClient.setUpDefaultClient()

client.start()
  1. Release builds optimization
    Only during release builds, the app crashed. During release builds, R8 (an app optimizer) struggles to find any reference to some code pieces using reflection in the library and deletes those from the final build. Unfortunately at runtime, these deleted pieces of code were really needed for the app to work.
    After hours of build & trial, I've figured out which classes need to be protected from R8 wiping. It led to this proguard-rules.pro ruleset:
-keep,allowoptimization,allowobfuscation class org.apache.sshd.common.io.nio2.Nio2ServiceFactoryFactory { *; }
-keep,allowoptimization,allowobfuscation class org.apache.sshd.common.session.helpers.SessionHelper { *; }
-keep,allowoptimization class org.apache.sshd.common.util.security.bouncycastle.BouncyCastleSecurityProviderRegistrar { *; }
-keep,allowoptimization class org.apache.sshd.common.util.security.eddsa.EdDSASecurityProviderRegistrar { *; }
-keep,allowoptimization class org.apache.sshd.common.util.security.SunJCESecurityProviderRegistrar { *; }
-dontwarn org.apache.sshd.**

Thank you!

Added a Kotlin example for connecting to a server using SSHD in Android. Updated the section on demo applications to emphasize the need for more Android examples.
Updated Android support documentation with example usage and Proguard configuration.
@Chiogros Chiogros marked this pull request as ready for review February 12, 2026 19:15
@PortaSFTPServer
Copy link

PortaSFTPServer commented Feb 12, 2026

Thank you. I am developing a library that uses IKVM to make use of Apache Mina SSHD Java Library in .NET/.NET Core. This will attract more developer to use Apache Mina SSHD in the future. Sample demo for simple SFTP Server using C# https://github.com/PortaSFTPServer/ApacheMinaSSHDNetServer

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants