首页 文章 精选 留言 我的

精选列表

搜索[兼容性],共7455篇文章
优秀的个人博客,低调大师

Android设备兼容性 2

版权声明:本文为sydMobile原创文章,转载请务必注明出处! https://blog.csdn.net/sydMobile/article/details/78144278 文章最早发布于我的微信公众号中,欢迎大家扫描下面二维码关注微信公众获取更多干货资源。 本文为sydMobile原创文章,可以随意转载,但请务必注明出处! 翻译自Android官方文档加入了自己的理解! Controlling Your App’s Availability to Devices 控制你的程序的可用性在不同的设备上 Android supports a variety of features your app can leverage through platform APIs. Some features are hardware-based (such as a compass sensor), some are software-based (such as app widgets), and some are dependent on the platform version. Not every device supports every feature, so you may need to control your app’s availability to devices based on your app’s required features. Android支持许多的功能,你的APP可以通过API充分的利用这些功能。一些功能是硬件作为支持(比如指南针传感器),一些是软件作为支持(比如APP小空间),还有一些依赖于平台的版本(也就是Android平台的版本)不是每个设备都支持Android的所以功能。所以你需要根据你的app所需要的特点来控制你的APP的实现。 To achieve the largest user-base possible for your app, you should strive to support as many device configurations as possible using a single APK. In most situations, you can do so by disabling optional features at runtime and providing app resources with alternatives for different configurations (such as different layouts for different screen sizes). If necessary, however, you can restrict your app’s availability to devices through Google Play Store based on the following device characteristics: 为了让你的APP实现最大的用户量,你应该努力的去支持大量的设备通过用一个APK,在大多数情况下,你可以舍弃一些不必要的功能提供一些在不同设备上必须的资源(比如为不同的屏幕尺寸添加不同的布局文件,这就是屏幕适配的一种方式)如果有必要的话,你也可以通过Google Play来限制一些不可以使用的设备。 Device features 设备特点 In order for you to manage your app’s availability based on device features, Android defines feature IDs for any hardware or software feature that may not be available on all devices. For instance, the feature ID for the compass sensor is FEATURE_SENSOR_COMPASS and the feature ID for app widgets is FEATURE_APP_WIDGETS. 为了让您根据设备功能来管理应用的可用性,Android定义了所有设备可能无法使用的任何硬件或软件功能的功能ID。 例如,罗盘传感器的功能ID为FEATURE_SENSOR_COMPASS,应用程序小部件的功能ID为FEATURE_APP_WIDGETS。 If necessary, you can prevent users from installing your app when their devices don’t provide a given feature by declaring it with a element in your app’s manifest file. 如果需要,您可以通过在应用程序的清单文件中使用元素声明该设备,从而避免用户安装应用程序。 For example, if your app does not make sense on a device that lacks a compass sensor, you can declare the compass sensor as required with the following manifest tag: <manifest ... > <uses-feature android:name="android.hardware.sensor.compass" android:required="true" /> ... </manifest> 例如,如果您的应用在缺少罗盘传感器的设备上无效,则可以根据需要使用以下清单标签声明罗盘传感器: Google Play Store compares the features your app requires to the features available on each user’s device to determine whether your app is compatible with each device. If the device does not provide all the features your app requires, the user cannot install your app. Google Play商店将您的应用所需的功能与每个用户设备上的功能进行比较,以确定您的应用是否与每个设备兼容。 如果设备没有提供您的应用所需的所有功能,则用户无法安装您的应用。 However, if your app’s primary functionality does not require a device feature, you should set the required attribute to “false” and check for the device feature at runtime. If the app feature is not available on the current device, gracefully degrade the corresponding app feature. For example, you can query whether a feature is available by calling hasSystemFeature() like this: PackageManager pm = getPackageManager(); if (!pm.hasSystemFeature(PackageManager.FEATURE_SENSOR_COMPASS)) { // This device does not have a compass, turn off the compass feature disableCompassFeature(); } 然而,如果您的应用程序的主要功能不需要设备功能,则应将所需属性设置为“false”,并在运行时检查设备功能。 如果应用功能在当前设备上不可用,则会适当地降低相应的应用功能。 例如,您可以通过调用hasSystemFeature()来查询功能是否可用: For information about all the filters you can use to control the availability of your app to users through Google Play Store, see the Filters on Google Play document. 有关所有过滤器的信息,可以通过Google Play商店来控制用户的应用程序的可用性,请参阅Google Play上的过滤器文档。 Note: Some system permissions implicitly require the availability of a device feature. For example, if your app requests permission to access to BLUETOOTH, this implicitly requires the FEATURE_BLUETOOTH device feature. You can disable filtering based on this feature and make your app available to devices without Bluetooth by setting the required attribute to “false” in the tag. For more information about implicitly required device features, read Permissions that Imply Feature Requirements. 注意:某些系统权限隐含地要求设备功能的可用性。 例如,如果您的应用程序请求访问BLUETOOTH的权限,则会隐式地需要FEATURE_BLUETOOTH设备功能。 您可以根据此功能禁用过滤,并通过在标签中将所需属性设置为“false”,使您的应用程序可用于无蓝牙设备。 有关隐式需要的设备功能的更多信息,请阅读具有要求功能要求的权限。 未完待续…. 扫一扫关注微信公众号,获取更多干货和资源。

优秀的个人博客,低调大师

Android的兼容性问题剖析

1.PC是X86构架,主要生产厂是Inter和AMD,android智能手机基本上都是ARM构架,主要生产厂家有高通、三星、NVIDIA等,也不是很多,所以架构方面应该不是导致碎片化的主要原因才是啊?或许我理解的问题? 架构方面是一个重要原因。 x86架构从当年8086开始,到如今的x64的64位平台,能做到汇编指令完全兼容。 再看看ARM架构有多混乱: ARM处理器内核列表 x86架构的字节序是固定的,而ARM架构的字节序都是可变的,字节序就是大小端的意思,比如一个32位的数据:0x12345678,在x86架构下,内存里永远都是0x78 0x56 0x34 0x12,而在ARM架构里,可能是前者,也可能是0x12 0x34 0x56 0x78. 字节序本身没有什么优劣之分,但对于开发人员来说,可变的字节序意味着移植机器代码是有困难的。

优秀的个人博客,低调大师

hive0.13.1 orc兼容性问题fix

线上使用cdh4.6.0和hive0.13.1,在hive0.11之后开始支持orcfile,hive0.13.1使用的是pb2.5.0,cdh4.6.0是用的2.4.0a,线上测试orcfile,建表正常,但是插入数据时报错报错: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 java.lang.VerifyError: class org.apache.hadoop.hive.ql.io.orc.OrcProto$RowIndexoverrides final methodgetUnknownFields.()Lcom/google/protobuf/UnknownFieldSet; atjava.lang.ClassLoader.defineClass1(NativeMethod) atjava.lang.ClassLoader.defineClass(UnknownSource) atjava.security.SecureClassLoader.defineClass(UnknownSource) atjava.net.URLClassLoader.defineClass(UnknownSource) atjava.net.URLClassLoader.access$ 100 (UnknownSource) atjava.net.URLClassLoader$ 1 .run(UnknownSource) atjava.net.URLClassLoader$ 1 .run(UnknownSource) atjava.security.AccessController.doPrivileged(NativeMethod) atjava.net.URLClassLoader.findClass(UnknownSource) atjava.lang.ClassLoader.loadClass(UnknownSource) atsun.misc.Launcher$AppClassLoader.loadClass(UnknownSource) atjava.lang.ClassLoader.loadClass(UnknownSource) atorg.apache.hadoop.hive.ql.io.orc.WriterImpl.<init>(WriterImpl.java: 129 ) atorg.apache.hadoop.hive.ql.io.orc.OrcFile.createWriter(OrcFile.java: 369 ) atorg.apache.hadoop.hive.ql.io.orc.OrcOutputFormat$OrcRecordWriter.close(OrcOutputFormat.java: 103 ) atorg.apache.hadoop.hive.ql.exec.Utilities.createEmptyFile(Utilities.java: 3065 ) atorg.apache.hadoop.hive.ql.exec.Utilities.createDummyFileForEmptyPartition(Utilities.java: 3089 ) atorg.apache.hadoop.hive.ql.exec.Utilities.getInputPaths(Utilities.java: 3013 ) atorg.apache.hadoop.hive.ql.exec.mr.ExecDriver.execute(ExecDriver.java: 369 ) atorg.apache.hadoop.hive.ql.exec.mr.MapRedTask.execute(MapRedTask.java: 136 ) atorg.apache.hadoop.hive.ql.exec.Task.executeTask(Task.java: 153 ) atorg.apache.hadoop.hive.ql.exec.TaskRunner.runSequential(TaskRunner.java: 85 ) atorg.apache.hadoop.hive.ql.exec.TaskRunner.run(TaskRunner.java: 72 ) 从错误可以看出是由于pb兼容问题导致,尝试使用pb2.4.0a编译hive0.13.1: 1.pom.xml文件: 更改 1 <protobuf.version> 2.5 . 0 </protobuf.version> 为 1 <protobuf.version> 2.4 .0a</protobuf.version> 2.运行mvn进行编译: 1 mvnclean package -DskipTests-Phadoop- 2 -Pdist 发现报如下错误: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 [ERROR]/home/caiguangguang/hive_0.13_debug/ql/src/gen/protobuf/gen-java/ org/apache/hadoop/hive/ql/io/orc/OrcProto.java:[ 9828 , 38 ]cannotfindsymbolsymbol : class Parserlocation: package com.google.protobuf[ERROR] /home/caiguangguang/hive_0.13_debug/ql/src/gen/protobuf/gen-java/org/apache/hadoop /hive/ql/io/orc/OrcProto.java:[ 9839 , 31 ]cannotfindsymbolsymbol: class Parserlocation: package com.google.protobuf .... [ERROR]/home/caiguangguang/hive_0.13_debug/ql/src/gen/protobuf/gen-java/ org/apache/hadoop/hive/ql/io/orc/OrcProto.java:[ 169 , 9 ]getUnknownFields() inorg.apache.hadoop.hive.ql.io.orc.OrcProto.IntegerStatisticscannotoverride getUnknownFields()incom.google.protobuf.GeneratedMessage;overriddenmethod is final [ERROR]/home/caiguangguang/hive_0.13_debug/ql/src/gen/protobuf/ gen-java/org/apache/hadoop/hive/ql/io/orc/OrcProto.java:[ 189 , 20 ] cannotfindsymbolsymbol:methodparseUnknownField (com.google.protobuf.CodedInputStream,com.google.protobuf.UnknownFieldSet. Builder,com.google.protobuf.ExtensionRegistryLite, int ) 3.这里 1 hive_0.13_debug/ql/src/gen/protobuf/gen-java/org/apache/hadoop/hive/ql/io/orc/OrcProto.java 是由protoc2.5.0生成的,但是jar包却是2.4.0a的,因此会报错 4.考虑使用2.4.0a的protoc手动生成java代码 1 2 protoc--version libprotoc 2.4 .0a 这里主要涉及两个proto文件: 1 2 3 protocql /src/protobuf/org/apache/hadoop/hive/ql/io/orc/orc_proto .proto--java_out=ql /src/gen/protobuf/gen-java/ protoc. /hcatalog/storage-handlers/hbase/src/protobuf/org/apache/hcatalog/hbase/snapshot/RevisionManagerEndpoint .proto --java_out=hcatalog /storage-handlers/hbase/src/gen-java/ 5.重新编译成功,将hive-exec jar包解压后,可以看到pom.properties中pb的版本已经是2.4.0a了: 1 2 3 4 5 6 META-INF /maven/com .google.protobuf /protobuf-java/pom .properties #GeneratedbyMaven #ThuMar1011:50:31CST2011 version=2.4.0a groupId=com.google.protobuf artifactId=protobuf-java 更换hive-exec jar包之后,测试向orc file的表插入数据也正常。 本文转自菜菜光 51CTO博客,原文链接:http://blog.51cto.com/caiguangguang/1599128,如需转载请自行联系原作者

资源下载

更多资源
Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

腾讯云软件源

腾讯云软件源

为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。

Spring

Spring

Spring框架(Spring Framework)是由Rod Johnson于2002年提出的开源Java企业级应用框架,旨在通过使用JavaBean替代传统EJB实现方式降低企业级编程开发的复杂性。该框架基于简单性、可测试性和松耦合性设计理念,提供核心容器、应用上下文、数据访问集成等模块,支持整合Hibernate、Struts等第三方框架,其适用范围不仅限于服务器端开发,绝大多数Java应用均可从中受益。

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

用户登录
用户注册