How can I import com.android.internal.telephony? - android

I downloaded an Android Project and got some errors.
How can I use this imports in Android?
import com.android.internal.telephony.IccSmsInterfaceManager;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneFactory;
import com.android.internal.telephony.SMSDispatcher;
When I import this, I got errors like these:
The import com.android.internal.telephony cannot be resolved
The import com.android.internal.telephony cannot be resolved
The import com.android.internal.telephony cannot be resolved
The import com.android.internal.telephony cannot be resolved
Later in the code there are:
Phone phone = PhoneFactory.getDefaultPhone();
With the error:
Multiple markers at this line
- Phone cannot be resolved to a type
- PhoneFactory cannot be resolved
And so on...
I tried to fix it with the https://stackoverflow.com/a/16377968/3203914
but I did not work for me.
Can please someone tell me how to fix it?
Thanks!

How can I use this imports in Android?
Those are not part of the Android SDK. If you are editing the Android source code, the build process for it should resolve those imports. If you are trying to write an Android app, you cannot directly reference them. In fact, com.android suggests they are part of a separate app, not yours and not the Android framework.

CommonsWare is correct, its not in the SDK so you cannot directly reference them. You will either have to
Import all of the android source code, which will resolve these issues
Import the specific project containing this code, then set up your code as a dependency
Stop using those packages

Related

How to resolve import android.support.v7.internal.widget.ListPopupWindow?

I was trying to use the snippet from 2nd answer of the following post:
How do you turn off share history when using ShareActionProvider?
Which can be dowloaded from here and after adding ActivityChooserView.java along with other files to my project, I cannot resolve:
import android.support.v7.internal.widget.ListPopupWindow;
Import of android.support.v7.appcompat does not give any errors.
Where can I find android.support.v7.internal.widget.ListPopupWindow class?
I googled it and found nothing :)
I am compiling for android v23 and using appcompat.v7 of the same version.
As you can see here the package name is android.support.v7.widget, so the correct import is:
import android.support.v7.widget.ListPopupWindow;
ListPopupWindow was moved from android.support.v7.internal.widget to android.support.v7.widget in v7 appcompat library v21.0.0.
To fix the issue change the import to the updated one.

Import missing for android.bluetooth.BluetoothAvrcp

I am trying to use the class BluetoothAvrcp from the package android.bluetooth but the import fails. It can't seem to file the class.
import android.bluetooth.BluetoothAvrcp;
Is there anything that I need to add before being able to use that one?
SDK 22.
Thank you.
It happens that these classes requires to build the android rom from the source.
Follow the following link to build from the source.
https://source.android.com/source/index.html

cannot open a new android project on ubuntu

i tryed to start a new android project on ubuntu 13.04 but when i'm starting my project it gives me a compillation error.
the error is with the R library ("R cannot be resolved to a variable").
when i tries to import the import android.R it just give me another error.
any one maybe know what is my problem?
You normally shouldn't manually import R. If Organize Imports (ctrl-shift-o) causes it to be added to the list of imports, that often indicates an inconsistency between the package name used in the package statement at the top of your source file and the package name used in your AndroidManifest.xml file. Make sure those two match.

ERROR The import com.googlecode can not be resolved

I am new to android and I encountered the following problem on the following lines:
import static com.googlecode.javacv.cpp.opencv_core.*;
import static com.googlecode.javacv.cpp.opencv_imgproc.*;
import static com.googlecode.javacv.cpp.opencv_highgui.*;
The error is the import com.google can not be resolved.
I have included the javacv files in the project. The javacv sample programs are working fine but when I try to make my own app I am encountering this problem.
It'll be really helpful if someone can point out the mistake I am making and correct it.
I have added a screen shot of my work. Please do help. Thanks!
There is no package named com.googlecode in your project.You need to include opencv's libraries as mentioned in this tutorial.You can then use org.opencv.{required_library_name}

Eclipse setup cannot resolve imports

I am trying to create a MonkeyRunner program in Java using Eclipse but :
import com.android.monkeyrunner.adb.AdbBackend;
import com.android.monkeyrunner.core.IMonkeyDevice;
import com.android.monkeyrunner.core.TouchPressType;
cannot be found.
Can someone point me a tutorial to import those files/jars in Eclipse?
Thanks
I guess, though it's not very clear in your question, that your intention is to use monkey from Java, in that case you can follow the steps described in http://dtmilano.blogspot.com/2011/11/android-using-monkey-from-java.html

Categories

Resources