how to solve import cannot be resolved error? - java

I am getting that error :
The import android.graphics.TableMaskFilter cannot be resolved
But I have seen TableMaskFilter class in android.graphics package of android-sdk folder and I am unable to see it inside the android4.0.3 library in Eclipse.

You can't. TableMaskFilter is annotated with #hide, which means it's definition is stripped from android.jar.

Related

Groovy geb.waiting class is not found

I am using eclipse oxygen 4.7. I have added geb.core-1.1.1.jar, geb-spock-0.10.0.jar, and spock-core-1.1-groovy-2.4.jar to the path.
I am getting the following error.
geb.waiting.Wait cannot be resolved. It is indirectly referenced from required .class files
When I import
geb.waiting
I see waiting as a package but when I add it I get,
Groovy:unable to resolve class geb.waiting
I have changed the geb-core library to 1.1 and 1.0 but I still have the same problem.
Please what could be causing this?
Try to use geb-0.93.0 jar. I had the same Problem and I found the class in that package

Importing class in the same package

I went through some of topics, but didn't find a proper anser. I'm trying to import class to other class, but I get "The import "classname" cannot be resolved" error. Both classes are in the same package. What can cause the problem? I also tried to clean my project.
If both classes are in same package, you don't have to import it.

Android Studio "cannot resolve symbol HttpRequest" when import HttpRequest.HttpRequest

I have created a new Java class and wanted to import it in MainActivity. I tried:
import HttpRequest.HttpRequest
And I got:
cannot resolve symbol HttpRequest
What am I doing wrong?
Project structure:
HttpRequest.HttpRequest doesn't exist.
You are importing the wrong class.
It should be:
import com.example.megido.myapplication.HttpRequest;
Also check this link for more info about Android Studio Tips and Tricks.
For quick fixes to coding errors, the IntelliJ powered IDE implements the Alt + Enter key binding to fix errors (missing imports, variable assignments, missing references, etc).
If you want import another Class in Present class then you have to give its full path ie. import com.example.megido.myapplication.HttpRequest
If you trying to import HttpRequest for network request then you have to add the corresponding library to you project.
I hope it helps..

Sphero TwoPhonesOneBall sample compiler error

I imported the samples of Sphero-Android SDK to my workspace. TwoPhonesOneBall project gives compiler errors. In ConnectionActivity.java class, the following imports cannot be resolved.
//...some imports
import orbotix.multiplayer.LocalMultiplayerClient;
import orbotix.multiplayer.MultiplayerControlStrategy;
import orbotix.multiplayer.MultiplayerGame;
import orbotix.multiplayer.RemotePlayer;
//...imports
How can I fix it? Since these classes don't exist, I didn't come up with a solution. I searched the net but I couldn't find similar problem. By the way,the same problem also occurs in MultiplayerLobby application.

Adding Android Library: Only a type can be imported. com.project.test.networktasklibrary resolves to a package

I'm attempting to implement part of my source code as a library and I've added the library to the project under properties > android > Reference however when I attempt to use the library by calling:
import. com.project.test.networktasklibrary;
I'm getting an error stating:
Only a type can be imported. com.project.test.networktasklibrary resolves to a package
Any suggestions are greatly appreciated.
Try using:
import com.project.test.networktasklibrary.*;
Instead
Or:
import com.project.test.networktasklibrary.ExactClassName;

Categories