• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Socket exception Permission denied in VirtualBox (with Ubuntu) from Device

Hi

I'm running Android Studio 4.0.1 (it has api 27, 28 and 29 installed). The physical device is a Samsung Active2 (Model SM-T390) and has Android version 9 (api 28) on it.

I am running Android Studio in a Virtualbox (version 6.1) with Ubuntu 20.04 installed in it. The Virtualbox is running on Windows 10. There is some port forwarding being done in the Virutalbox as seen in the pic below
upload_2020-10-6_11-22-18.png



When trying to open an AsynchronousSocketChannel, it throws an exception and complains about 'Permission denied', the stack trace is here (relevant lines are bold):
Code:
aunching 'app' on samsung SM-T390.
$ adb shell am start -n "com.elbit.elbittoandroidtest/com.elbit.edmandroidtest.EDMtoAndroidTest" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Connected to process 17757 on device 'samsung-sm_t390-5200bd485e8766fd'.
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
I/ittoandroidtes: The ClassLoaderContext is a special shared library.
I/MultiWindowDecorSupport: updateCaptionType >> com.android.internal.policy.MultiWindowDecorSupport@a6ae311, isFloating: false, isApplication: true, hasWindowDecorCaption: false, hasWindowControllerCallback: true
D/MultiWindowDecorSupport: setCaptionType = 0
W/ittoandroidtes: Accessing hidden method Landroid/graphics/drawable/Drawable;->getOpticalInsets()Landroid/graphics/Insets; (light greylist, linking)
W/ittoandroidtes: Accessing hidden field Landroid/graphics/Insets;->left:I (light greylist, linking)
    Accessing hidden field Landroid/graphics/Insets;->right:I (light greylist, linking)
    Accessing hidden field Landroid/graphics/Insets;->top:I (light greylist, linking)
    Accessing hidden field Landroid/graphics/Insets;->bottom:I (light greylist, linking)
D/NetworkManagementSocketTagger: tagSocket(-1) with statsTag=0xffffffff, statsUid=-1
I/AsynchronousSocketChannel IOException: java.net.SocketException: Permission denied
        at sun.nio.ch.Net.socket0(Native Method)
        at sun.nio.ch.Net.socket(Net.java:420)
        at sun.nio.ch.Net.socket(Net.java:413)
        at sun.nio.ch.AsynchronousSocketChannelImpl.<init>(AsynchronousSocketChannelImpl.java:90)
        at sun.nio.ch.UnixAsynchronousSocketChannelImpl.<init>(UnixAsynchronousSocketChannelImpl.java:102)
        at sun.nio.ch.LinuxAsynchronousChannelProvider.openAsynchronousSocketChannel(LinuxAsynchronousChannelProvider.java:88)
        at java.nio.channels.AsynchronousSocketChannel.open(AsynchronousSocketChannel.java:169)
        at java.nio.channels.AsynchronousSocketChannel.open(AsynchronousSocketChannel.java:190)
        at (EDMtoAndroidTest.java:101)
        at android.app.Activity.performCreate(Activity.java:7335)
        at android.app.Activity.performCreate(Activity.java:7326)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1275)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3121)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3284)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1972)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7179)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:975)
W/System.err: java.net.SocketException: Permission denied
        at sun.nio.ch.Net.socket0(Native Method)
W/System.err:     at sun.nio.ch.Net.socket(Net.java:420)
        at sun.nio.ch.Net.socket(Net.java:413)
        at sun.nio.ch.AsynchronousSocketChannelImpl.<init>(AsynchronousSocketChannelImpl.java:90)
        at sun.nio.ch.UnixAsynchronousSocketChannelImpl.<init>(UnixAsynchronousSocketChannelImpl.java:102)
W/System.err:     at sun.nio.ch.LinuxAsynchronousChannelProvider.openAsynchronousSocketChannel(LinuxAsynchronousChannelProvider.java:88)
        at java.nio.channels.AsynchronousSocketChannel.open(AsynchronousSocketChannel.java:169)
        at java.nio.channels.AsynchronousSocketChannel.open(AsynchronousSocketChannel.java:190)
        at android.app.Activity.performCreate(Activity.java:7335)
        at android.app.Activity.performCreate(Activity.java:7326)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1275)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3121)
W/System.err:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3284)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1972)
W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:106)


The line of code referred to in the exception stack trace is here:
Java:
        try
        {
[B][SIZE=5]            java.nio.channels.AsynchronousSocketChannel client = java.nio.channels.AsynchronousSocketChannel.open(); // this is [B]EDMtoAndroidTest.java:101[/B][/SIZE][/B]
//            InetSocketAddress host = new InetSocketAddress("127.0.0.1",1870);
            InetSocketAddress host = new InetSocketAddress("10.0.2.2",1870);
            Future<Void> future = client.connect(host);
            future.get(); // wait for connection to succeed
            Log.i("AsynchronousChannel", "Connection Successful");
        catch (InterruptedException e)
        {
            Log.i("AsynchronousSocketChannel IOException", Log.getStackTraceString(e));
            e.printStackTrace();
        }

Any idea what I am missing when trying to get a physical device to open a socket to Ubuntu running in a Virtualbox which it self is running on Windows 10?

Thanks...

Help Videos pause when H96 max loses connection to output

Hi,

I have a scenario that might not be too common but I'm hoping someone can help.

I have a H96Max RK3318 android TV box. It's connected via HDMI to an encoder device that captures video and can create streams for my decoder device. I use this setup to play looped videos (for example ads) on different displays.

My issue is that whenever I reboot the encoder all the videos on the H96Max are paused ,so I have to go to each box and press play. But on another android box (H96 MAX+) I don't have this issue and the video continues playing if the encoder is rebooting. I wonder if there are any settings that I can change to make the video continue even though the encoder is rebooting. Any suggestion would be appreciated. Thanks!

Model: H96Max RK3318
Version: 9
Kernel Version: 4.4.159
Build: rk3318-user9 PQ2A

How do I block calls from private numbers?

If the calls are coming from the same numbers, you can block them right from your call log.

Long press the call in question while in the log, and a menu offering to block the call should appear.

Of course, that is just how my device works.
Not to mention that calls like this often come from an endless stream of invalid numbers, so blocking them one by one is fruitless.

Try BlackList Blocker.
Yes, you will need to allow the app access.

The plus side is that it is not affiliated with Google, is totally FOSS, and has no use for your information.

This app has been the only way to msintain my sanity with the amount of crap calls that I would otherwise get.

https://f-droid.org/en/packages/com.kaliturin.blacklist/

My phone is 8.1.0, so I know that it should work on your device as well.

I believe@RhinoCan doesn't want to use third party apps :(

Is the apk which is available on apkpure safe and reliable?

Apkmirror is fine, although they often don't have the apps I want.

I do use ApkPure, and like it very much.
I have not had any issues with any app I have downloaded from there.
Occasionally, an app that Google claims is not compatible (and so Google won't even allow me to try) is on ApkPure and I can download it and it works fine.

You also may want to try UpToDown, as they are the #2 app store on Earth.

Both have websites, which are fine, and there are also apps for both appstores available.
The apps are great, and generally faster than the Play Store.

https://m.apkpure.com/

https://en.uptodown.com/

I use these, along with F-Droid (an extensive library of FOSS apps) all the time, and have room for all of them on even a small memory device.

https://f-droid.org/

Filter

Back
Top Bottom