Other Please try this APK and tell me if it works for your SMB2/3 Share

DonManfred

Expert
Licensed User
Longtime User
https://www.dropbox.com/s/5haq2g3vhyqtt71/SMBB4A.apk?dl=0

Please fill in your SMB-Credentials like
- Domainname (or PC-Name)
- Username
- Password
- Share-Link: for ex. smb://192.168.192.168/

Press the Button Init.
It is works then you should get to another activity and here a Filelisting is shown (hopefully :D).

I want to know it that works for your SMB2/3 enabled Share?

PD: The Library used has partially Support for SMB3.
But SMB2 should work.

Please share your results and, if known, the used SMB-Version.

I tested it on my Samsung Note 8 device running Android 9. Using TargetSDK 26 and Android.jar from Api 28.

It does work fine for me to Access my Windows 10 Shares (I make sure it (Windows 10) does not allow SMB1 connections) from within the same network.
 
Last edited:

josejad

Expert
Licensed User
Longtime User
Hi Don:

I've tried your app, but it's strange.
- First time, I tried to access to a SMB share we have in my job, wich can be accessed througth internet (a synology server). Something like smb://myjob.synology.me/share
I got an error "App stops to work: restart, close..."

- I open it again, so I tried with my home network (smb://192.168.1.3/photos).
This time, when I opened the app, I got de toast message "waiting for debugger to connect"... I had b4a brigde opened, so It could be a message from it. I closed it.
But now, nothing happen when I click "Init".

- I've closed the app several times, I've reinstalled, but nothing happen when I click init.

I have a BQ Aquaris X5 Plus, with android nougat 7.1.1
Of course, all the test with Domainname, username, password...
I will try again tomorrow in my job.
 
Upvote 0

rboeck

Well-Known Member
Licensed User
Longtime User
Hi Don,

i also tried it; to be shure to use the correct parameters, i made an parallel file copy per smb1 on the same network with b4j. The sharing computer is using win10, last version, but i already installed smb1 on it because i use it with current smb1 apps on android. I think and hope, that the additional smb1 install does not disturb the current smb3 installation on win10.
The effect was the same - no change an the screen. I opened b4a with b4a bridge, but didnt get any debug information.
You could use the #BridgeLogger attribute; so we can get your debugging log information on runtime too.
Android used was 8.0.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
You could use the #BridgeLogger attribute; so we can get your debugging log information on runtime too.
Thank you for your feedback. Good Idea. Next Version will include it.

The Library does not use SMB1. It is disabled. Minimum SMB Version should be 2.01 i guess.
You can try to disable SMB1 Support, reboot your system and try again.
 
Upvote 0

rboeck

Well-Known Member
Licensed User
Longtime User
Now i have deinstalled smb1, my b4j does no file transfer, but the result is the same. Will the new library also useable from b4j and maybe b4i?
 
Upvote 0

josejad

Expert
Licensed User
Longtime User
I've tried at work, same result (press Init and nothing occurs).
My synology has activated the SMB1, 2 AND 3 protocols.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
My customer, i wrote the lib for him, has tested the lib on his 2019 Server.

File-listing:
Meizu m3 note mit Android 5.1, WORKS
Lenovo TAB3 10 Plus mit Android 6, WORKS
Samsung Galaxy TAB S3 mit Android 8, WORKS
Xiaomi Mi Mix 2 mit Android 8 WORKS

The Library was using SMB 2.1 to communicate with the Server.
 
Upvote 0

josejad

Expert
Licensed User
Longtime User
Well, I've reinstalled again.
- First time test: "this app stopped to work," Share: smb://192.168.1.254/
- Second time test: It had worked. Share: smb://192.168.1.254/web/

Screenshot_20190402-131933.png
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

josejad

Expert
Licensed User
Longtime User
What is different with this share to the one in the 1st try?
First share is the "root" of the server, not really a shared folder, probably that's the problem. I tested it to see if it lists all the shares folders
The second one it's a shared folder, same as for example the "admon" or "prl" shared showed in the capture.
EDIT: btw, it works too if the shared is the DNS name (smb://diskstation/prl)

Captura.JPG
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I'm getting this error:

Create CIFSContext
Create NtlmPasswordAuthentication
Create SmbResource
Create SmbFile
SMBClient_Resource(smb://192.168.0.104/Users/Public, smb://192.168.0.104/Users/Public)
CanonicalPath = smb://192.168.0.104/Users/Public
CanonicalUncPath = smb://192.168.0.104/Users/Public
ContentEncoding = null
starter_smbclient_resource (java line: 241)
android.os.NetworkOnMainThreadException
at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1513)
at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:117)
at java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:105)
at java.net.InetAddress.getAllByName(InetAddress.java:1154)
at jcifs.netbios.NameServiceClientImpl.getAllByName(NameServiceClientImpl.java:1008)
at jcifs.netbios.NameServiceClientImpl.getAllByName(NameServiceClientImpl.java:54)
at jcifs.smb.SmbTransportPoolImpl.getSmbTransport(SmbTransportPoolImpl.java:170)
at jcifs.smb.SmbTransportPoolImpl.getSmbTransport(SmbTransportPoolImpl.java:47)
at jcifs.smb.DfsImpl.getDcReferrals(DfsImpl.java:189)
at jcifs.smb.DfsImpl.getDc(DfsImpl.java:234)
at jcifs.smb.DfsImpl.getTrustedDomains(DfsImpl.java:112)
at jcifs.smb.DfsImpl.resolve(DfsImpl.java:347)
at jcifs.smb.DfsImpl.resolve(DfsImpl.java:321)
at jcifs.smb.SmbTreeConnection.connectHost(SmbTreeConnection.java:525)
at jcifs.smb.SmbTreeConnection.connectHost(SmbTreeConnection.java:484)
at jcifs.smb.SmbTreeConnection.connect(SmbTreeConnection.java:460)
at jcifs.smb.SmbTreeConnection.connectWrapException(SmbTreeConnection.java:421)
at jcifs.smb.SmbFile.ensureTreeConnected(SmbFile.java:551)
at jcifs.smb.SmbFile.exists(SmbFile.java:838)
at jcifs.smb.SmbFile.createTime(SmbFile.java:1091)
at de.donmanfred.SMBFilewrapper.getcreateTime(SMBFilewrapper.java:65)
at de.donmanfred.jcifsngex.starter._smbclient_resource(starter.java:241)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
at anywheresoftware.b4a.BA$2.run(BA.java:370)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6642)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
ContentEncoding = null
starter_smbclient_resource (java line: 241)
android.os.NetworkOnMainThreadException
Thank you!

Seems like a method i am calling in the result is using additionl traffic.
Mayb be related to the Share one is using.

Will ivestigate and put them in a runable where applicable.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Note that you will not see this error in debug mode as it disables the "network on main thread" check.
That´s the reason i compiled it in Releasemode to get this error when it happens.
I did the initialization and the get filelist in a runnable already. Also true for copy.

Need to find out which other methods are using Networktraffic and make them running in a runable too.
 
Upvote 0
Top