Cannot resolve symbol IPAddressUtil - android

I have a problem in my android studio(macosx) :
in InetAddress.java some import have problem
import sun.net.util.IPAddressUtil;
import android.system.GaiException;
import android.system.StructAddrinfo;
import libcore.io.Libcore;
editor says
cannot resolve symbol IPAddressUtil

I think those classes are not in Android SDK (IpAddressUtil, Libcore). Also, it is discouraged to use classes from sun.* package in your programs.

Related

I am trying to convert a website to an app and getting this error

This is my first app, I am trying to convert a website to app in android studio. I am following this tutorial - https://youtu.be/oy-0ss-n33g . But I am getting:
Cannot resolve symbol WebView
How can I solve this error?
You forgot to import WebView just add import android.webkit.WebView at the import section or alt + enter to auto-import the class
Import this classes
import android.webkit.WebView;
import android.webkit.WebSettings;
And make sure the ID of the webview in your xml layout is the same as the one you are referring in java.

Error: cannot find symbol variable Constants

How can import util.Constants in
Android Studio 3.0.1
Error:cannot find symbol variable Constants
Alt+enter said me android.provider.SyncStateContract.Constants? But I need to import like
Import mypackage name.until.Constants
delete the Constant usage in the program.
Go to your imports section and enter
import android.provider.SyncStateContract.Constants.ConstantName
This works out.

Android Wheel Data picker

I want to use android wheel to choose from some items. I just downloaded some library code from google. I am using it in my app, but it is giving some error.
import kankan.wheel.widget.OnWheelChangedListener;
import kankan.wheel.widget.OnWheelScrollListener;
import kankan.wheel.widget.WheelView;
import kankan.wheel.widget.adapters.AbstractWheelTextAdapter;
import kankan.wheel.widget.adapters.ArrayWheelAdapter;
Giving following error:
The import kankan.wheel.widget cannot be resolved
Can anyone tell me why this error is coming.
Thanks.
I have also used that library in my code and it is working fine.
possibility of error
You can't configure lib properly
In build path add lib
Clean eclipse.
Restart eclipse
import kankan.wheel.widget.OnWheelChangedListener;
import kankan.wheel.widget.OnWheelScrollListener;
import kankan.wheel.widget.WheelView;
import kankan.wheel.widget.adapters.NumericWheelAdapter;
WheelView wheel = getWheel(id);

How to import BitmapTextureAtlas in Andengine?

i added this line.but it gives error.how to import it?
import org.andengine.opengl.texture.atlas.TextureAtlas;
TextureAtlas is an abstract class, try importing
import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlas;
or
import org.andengine.opengl.texture.atlas.bitmap.BuildableBitmapTextureAtlas;
depending on which one you are using
If you using Eclipse and it is configured properly, you should be able to just delete that line and Eclipse will add the correct import statements - at least it does on my system.

Add Server classes to android.jar

Right now I am able to get access to the hidden and internal android APIs, but now I want access to things like AlarmManagerService which is in server. I used adb pull system/framework/services.jar changed services.jar to services.zip which unpacked a directory of all the server classes (including AlarmManagerService which I was looking for). My question now is how can I add those server classes to my android.jar file which I can then use in Eclipse?
I hope that makes sense the way I worded it. Let me know if there is any confusion I can clear up.
EDIT: Essentially, when all is said and done, I want to be able to do something like below without any errors:
import com.android.server.AlarmManagerService;
public class TestActivity extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
AlarmManagerService ams = new AlarmManagerService(this.getApplicationContext());
ams.setTime(1313);
}
}
ANOTHER EDIT:
I figured this out after looking at all the source code.
Classes like AlarmManagerService just have package visibility which is why it cannot be imported. Some classes are public, but many other com.android.server classes have package constructors so they can't be instantiated.
Here are the com.android.server.* I was able to import and successfully create an object of:
import com.android.server.AttributeCache;
import com.android.server.BootReceiver;
import com.android.server.BrickReceiver;
import com.android.server.ClipboardService;
import com.android.server.ConnectivityService;
import com.android.server.DevicePolicyManagerService;
import com.android.server.DiskStatsService;
import com.android.server.DropBoxManagerService;
import com.android.server.EntropyService;
import com.android.server.InputMethodManagerService;
import com.android.server.LocationManagerService;
import com.android.server.MasterClearReceiver;
import com.android.server.NativeDaemonConnectorException;
import com.android.server.NetStatService;
import com.android.server.NotificationPlayer;
import com.android.server.ProcessMap;
import com.android.server.ProcessStats;
import com.android.server.SystemBackupAgent;
import com.android.server.SystemServer;
import com.android.server.ThrottleService;
import com.android.server.TwilightCalculator;
import com.android.server.Watchdog;
import com.android.server.connectivity.Tethering;
import com.android.server.status.AnimatedImageView;
import com.android.server.status.CloseDragHandle;
import com.android.server.status.DateView;
import com.android.server.status.ExpandedView;
import com.android.server.status.IconMerger;
import com.android.server.status.LatestItemView;
import com.android.server.status.NotificationData;
import com.android.server.status.NotificationLinearLayout;
import com.android.server.status.StatusBarService;
import com.android.server.status.StatusBarView;
import com.android.server.status.StorageNotification;
import com.android.server.status.TickerView;
import com.android.server.status.TrackingPatternView;
import com.android.server.status.TrackingView;
import com.android.server.status.UsbStorageActivity;
android.jar contains only the public API's class files and I think you made changes in 'com.android' package or its internal packages. So to reflect the changes in eclipse you have to add the path explicitly to your service.jar to your project. But remeber this will not reflected at run time, since the emulator or the device you are using have not been updated your changes. And you can't update them by simply modifying the jar file, since the device or emulator uses the image 'system.img' which internally have .dex file as library not the .jar file for internal APIs. To make changes for device/emulator you have to build the whole code and for that you can refer the http://source.android.com/source/index.html.

Categories

Resources