[Galaxy S 4 Q&A, Help & Troubleshooting] KitKat500:
Thank you All. Following is how I got LAN Ethernet to work on my Galaxy S4. Some of these steps are very risky and may wipe out all your phone data or make your phone unusable. So I am not recommending you to try it. I am only sharing what I did in my phone to make it work with OTG Ethernet. Also the procedures are very device and version specific. Even same model phones with different Build version and Android version may give different results.

My Devices:

Samsung Galaxy S4 Model Number: SGH-I337M

Android version: 5.0.1 (Lollipop) SDK 21

CPU Architecture: ARMv7

Build Fingerprint: jfltevl/jfltecan

BobJGear OTG Ethernet

ASIX AX88772A Chipset

Following is the Summary of the key steps and troubleshooting. You can search online to find the APKs and Installers or to know more details.

Install Droid Info App to get details of the phone CPU

Install Kingo ROOT App on the Phone and Root the Galaxy S4

Install Odin3 v3.13.1 on Windows 10 PC

Use Odin3 to install “Team Win Recovery Project” (TWRP) on the phone. TWRP was necessary to install XPOSED Framework. The specific version of TWRK that I could install is TWRP 3.1.1.0. I installed it using the file with following file name:

“twrp-3.1.1-0-jfltecan.img.tar”.

The other newer version of TWRP did not work. It kept going back to default recovery menu. Also uncheck “Auto Reboot” in the Odin Options and manually reboot phone to Recovery mode after installing TWRP from Odin.

If you get following message when trying to start TWRP in Recovery mode, Just wait few minutes and TWRP will start.

RECOVERY IS NOT SEANDROID ENFORING

SET WARRANT BIT RECOVERY

During TWRP initial setup Swipe to “allow modification” to System partition

Install XPOSED Installer using apk with following file name. This is an App used to install XPOSED Framework.

"Xposed-Installer-3.0-Alpha-4-2016.10.16.apk"

After installing it, it showed warning that it is not compatible with my phone and android version. Leave the XPOSED Installer installed. Use alternate method to install XPOSED Framework using TWRP.

Install XPOSED Framework using TWRP. I installed the XPOSED Framework version 87.1. That is the only version that worked. I used zip file with following file name

“xposed-v87.1-samsung-5.0.x-sdk21-by-dkcldark-arm.zip”

The other versions of XPOSED Framework was giving following errors.

The installed firmware is not deodexed!

This version of Xposed requires deodexed firmware!

After installing XPOSED Framework, open XPOSED Installer and install Hack Connectivity Service

Install Terminal Emulator.

Sometimes after reboot, the Terminal Emulator shows blank screen. Wait for a minute or so and it should show the usual prompt where you can enter the commands.

Install SuperSU Free v2.79

I installed Ethernet Droid apk, but it did not work.

I installed Busybox but it was not necessary to be used

Usual Steps

Once everything is installed, following are the usual steps to connect to Ethernet.

Connect the Ethernet OTG to Smartphone.

Disable Wifi

Enable Wifi Hack in “Hack Connectivity Service”

Start Terminal Emulator and run following commands. This needs to be done every time we switch from Wifi to Ethernet.

su
netcfg eth0 dhcp
ip rule add from all lookup main pref 99
ndc resolver setnetdns eth0 "" 8.8.8.8 8.8.4.4
exit

If I don't use the above "ip rule" command, I can only ping to router using Superuser and Internet does not work.

Also previously it was not recognizing website names while pinging. the "ndc resolver" command resolved that issue.

Once above commands are executed, I can use LAN Internet on my Galaxy S4.

Update on Nov 19, 2019:

For the Usual Steps, the Terminal Emulator Commands after "su" line can be saved in a file in the local storage of the phone with name such as "lan.sh" then following commands can be used to execute the file.

su

cd sdcard

sh lan.sh

Video Demonstration

The demonstration of my final results is in my following video. It also has an example of Simultaneous Charging while using OTG Adapter.

https://youtu.be/RtLV6qpMm6o