I am trying to set a static IP in android. Here is the code
Object ipAssignment = getEnumValue("android.net.IpConfiguration$IpAssignment", "STATIC");
callMethod(config, "setIpAssignment", new String[] { "android.net.IpConfiguration$IpAssignment" }, new Object[] { ipAssignment });
Object staticIpConfig = newInstance("android.net.StaticIpConfiguration");
I am getting an error in the 3rd line. "newinstance() cannot be applied to android.net.StaticIpConfiguration." Also noticed that I can't import android.net.StaticIpConfiguration.
I tried looking online but couldn't find much about the class. Was it removed? How do I import it? My build target is 25 and min version 15
Was it removed?
It was never part of the Android SDK, AFAIK.
How do I import it?
You don't. That class is part of Android, but it is not part of the SDK, and so it cannot be imported directly. It also may not exist in all versions of Android, may be changed in various versions of Android, may be changed in various firmware builds (e.g., custom ROMs, different device manufacturers, etc.).