简体   繁体   中英

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

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

  1. Import all of the android source code, which will resolve these issues
  2. Import the specific project containing this code, then set up your code as a dependency
  3. Stop using those packages

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM