android.hardware.telephony breaks installation on the emulator
We're currently revising our application manifest to explicitly use 开发者_运维百科the uses-feature
attribute to declare all its dependencies on hardware and software APIs.
Since we expect the user to have mobile Internet, we set android.hardware.telephony
to true
, but now the app fails to install on the emulator. The error message is:
Failure [INSTALL_FAILED_MISSING_FEATURE]
There is no additional information, not even in the device logs, but I could figure out by trial and error that the telephony feature was causing it.
Since the emulator has support for telephony functionality (you can even simulate dispatching a call), why does this break? And even if it correctly reports that it doesn't support telephony, shouldn't it be obvious that uses-feature
was meant to target real devices, not the emulator?
I'm actually quite confused about this attribute now in general, since its documentation seems to imply that it only affects filtering rules for Android Market. I can't see where it mentions that uses-feature
has a direct impact of the installability of an app, which seems to go way beyond the merely declarational/informational nature the docs attribute to it.
Maybe it's not a good idea to use it after all? Our build server doesn't execute anymore, since installation to the emulator now always fails...
Basically what you need to use a more recent Emulater with more features supported,or alternatively you can do the following :
1.Comment out or remove the following lines from your Manifest XML file
<!-- COMMENT ME -->
<uses-feature android:name="android.hardware.telephony" />
OR
2.Add the following :
<!-- UNCOMMENT ME and add android:required="false" -->
<uses-feature android:name="android.hardware.telephony" android:required="false"/>
You should be good to go if you do it correctly.
I have an app that uses telephony and works fine with the 2.2 emulator and I presume you have already set the required attribute to false in your manifest:
<uses-feature android:name="android.hardware.telephony" android:required="false"/>
If that's the case, my guess is that there is another feature or permission declared in your manifest that isn't present in the emulator and causing the error. Hunt it down through trial and error.
精彩评论