我的应用是专为手机设计的,但当我尝试将应用上传到市场时,它表明我的应用也可以通过平板电脑(xlarge)看到。如果从平板电脑访问,我故意不希望我的应用在市场上展示。
我尝试使用minSdkVersion和targetVersion支持以及元素。
我也尝试过使用
<manifest ... >
<compatible-screens>
<!-- all small size screens -->
<screen android:screenSize="small" android:screenDensity="ldpi" />
<screen android:screenSize="small" android:screenDensity="mdpi" />
<screen android:screenSize="small" android:screenDensity="hdpi" />
<screen android:screenSize="small" android:screenDensity="xhdpi" />
<!-- all normal size screens -->
<screen android:screenSize="normal" android:screenDensity="ldpi" />
<screen android:screenSize="normal" android:screenDensity="mdpi" />
<screen android:screenSize="normal" android:screenDensity="hdpi" />
<screen android:screenSize="normal" android:screenDensity="xhdpi" />
</compatible-screens>
...
<application ... >
...
<application>
</manifest>
但是我收到了一个错误:
此行找到多个注释:
- 错误:没有为包中的属性“screenDensity”找到资源标识符 “机器人”
- 错误:没有为包中的属性'screenSize'找到资源标识符 'android'
我错过了什么?
答案 0 :(得分:4)
您应该使用market filters来准确指定应用程序真正需要的内容。如果设备需要是手机,请添加<uses-feature android:name="android.hardware.telephony"/>
通过指定兼容的屏幕尺寸来过滤平板电脑是没有意义的。有关硬件功能的列表,请参阅<uses-feature>。不要仅仅为了过滤而添加元素,清单应该指定应用程序需要什么才能工作。
答案 1 :(得分:1)
如何使用<supports-screens>
代码?
<manifest ... >
<supports-screens android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="false"
android:largestWidthLimitDp="600" />
<application>
</application>
</manifest>
有关详细信息,请参阅此内容。
http://developer.android.com/guide/topics/manifest/supports-screens-element.html
答案 2 :(得分:0)
我不确定这是否是正确的方法。但是,我偶然发现了一些并在我的应用中使用它,以确保平板电脑用户无法在他们的设备上访问此应用程序。
//verify the android version running on the phone/device
int currentDeviceVersion = android.os.Build.VERSION.SDK_INT;
//since tablets would be running HoneyComb or higher
if (currentDeviceVersion >= android.os.Build.VERSION_CODES.HONEYCOMB){
// display message that app is not supported for android honeycomb and above
// End (finish) app
}
答案 3 :(得分:0)
通过查看播放控制台的设备目录,您需要指定更多screenDensity值。 (见下文,截至今天)我认为在设备目录中总会出现看到新值的风险。因此,您应该经常监控应用不支持的设备数量。
<!-- Exclude Tablets -->
<compatible-screens>
<!-- all small size screens -->
<screen android:screenSize="small" android:screenDensity="ldpi" />
<screen android:screenSize="small" android:screenDensity="mdpi" />
<screen android:screenSize="small" android:screenDensity="hdpi" />
<screen android:screenSize="small" android:screenDensity="xhdpi" />
<screen android:screenSize="small" android:screenDensity="xxhdpi" />
<screen android:screenSize="small" android:screenDensity="xxxhdpi" />
<screen android:screenSize="small" android:screenDensity="213" />
<screen android:screenSize="small" android:screenDensity="280" />
<screen android:screenSize="small" android:screenDensity="360" />
<screen android:screenSize="small" android:screenDensity="400" />
<screen android:screenSize="small" android:screenDensity="420" />
<screen android:screenSize="small" android:screenDensity="480" />
<screen android:screenSize="small" android:screenDensity="560" />
<!-- all normal size screens -->
<screen android:screenSize="normal" android:screenDensity="ldpi" />
<screen android:screenSize="normal" android:screenDensity="mdpi" />
<screen android:screenSize="normal" android:screenDensity="hdpi" />
<screen android:screenSize="normal" android:screenDensity="xhdpi" />
<screen android:screenSize="normal" android:screenDensity="xxhdpi" />
<screen android:screenSize="normal" android:screenDensity="xxxhdpi" />
<screen android:screenSize="normal" android:screenDensity="213" />
<screen android:screenSize="normal" android:screenDensity="280" />
<screen android:screenSize="normal" android:screenDensity="360" />
<screen android:screenSize="normal" android:screenDensity="400" />
<screen android:screenSize="normal" android:screenDensity="420" />
<screen android:screenSize="normal" android:screenDensity="480" />
<screen android:screenSize="normal" android:screenDensity="560" />
</compatible-screens>