1
votes

This is a repeat of a question I posted last month that I still haven't resolved. I'm trying to use jcifs in an Android app to talk to my Windows computer, but the app aborts without an error message when it tries to connect to the network. I don't see a problem my code nor the network parameters, and after a month of digging the only hints I've found are the two ideas below.

Can someone verify if either of these are true: 1. The Java SMB will not work in Android. If that is true then which do I have and how do I get the Android version? 2. Putting the jcifs.jar in the libs folder will not work with jcifs. If my program compiles correctly then does that mean the jar is ok?

Trying to use SmbFileInputStream

1

1 Answers

0
votes
  1. It works with Android, I am using jcifs-1.3.17.jar
  2. Putting it into the libs folder works for me

Make sure, that you are executing your network code not in your GUI thread. Android does not like that and your app will crash on runtime. As a workaround for now you can add the following before doing your network stuff in the GUI thread:

ThreadPolicy tp = ThreadPolicy.LAX;
StrictMode.setThreadPolicy(tp);

But I highly recommend using this only for testing purposes.