Firemonkey:我们可以在AndroidManifest.template.xml中更新targetSdkVersion吗? [英] Firemonkey: can we update targetSdkVersion in AndroidManifest.template.xml?

查看:230
本文介绍了Firemonkey:我们可以在AndroidManifest.template.xml中更新targetSdkVersion吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我读到柏林与棉花糖兼容,但是我在AndroidManifest.template.xml中看到默认情况下:

I read that berlin is compatible with marshmallow, but i see that by default in the AndroidManifest.template.xml we have :

<uses-sdk android:minSdkVersion="%minSdkVersion%" android:targetSdkVersion="%targetSdkVersion%" />

我不知道delphi在哪里将变量用于更新%targetSdkVersion%,但这是全部时间14,我看不到任何配置方法

i don't know where delphi took the variable to update %targetSdkVersion% but it's seam to be all the time 14 and i don't see any way to configure it

我想将%targetSdkVersion%替换为23(棉花糖api级别,以支持应用程序权限) ,但这是否安全?否则会引入许多其他错误?

i would like to replace %targetSdkVersion% by 23 (marshmallow api level, to support the app permissions), but is it safe to do so or it's will introduce many other bug ?

推荐答案

FireMonkey的开发目的是在一定范围内工作Android功能。从 RAD Studio平台状态页面用Delphi 10.1 Berlin构建的FireMonkey应用具有受支持的最低Android版本4.0.3,对应于Android API级别15。

FireMonkey was developed to work against a certain range of Android functionality. As you can see from the RAD Studio Platform Status page FireMonkey apps built with Delphi 10.1 Berlin have a lowest supported Android version of 4.0.3, which corresponds to Android API Level 15.

minSdkVersion 字段应设置为最早的Android版本您的应用程序可以正常使用,因此实际上应该将其设置为15,但实际上应设置为14(Android 4.0-4.0.2)。

The minSdkVersion field is supposed to be set to the earliest Android version your apps will work with so in truth this should probably be set to 15 but actually is set to 14 (Android 4.0-4.0.2).

由Delphi XE7生成的Android清单文件,该文件支持Android 2.3.3(API级别10),它指定的最低SDK版本为9(Android 2.3-2.3.2),这是引入 NativeActivity 类型是每个Delphi的基础FireMonkey Android应用程序。同样,这似乎是最低支持版本的证明。

If you look back at an Android manifest file generated by Delphi XE7, which supported Android 2.3.3 (API Level 10) it specifies a min SDK version of 9 (Android 2.3-2.3.2), which is the version of Android that introduced the NativeActivity type underlying every Delphi FireMonkey Android app. Again, this seems a little bit out of kilter with what is documented as lowest supported version.

无论如何, minSdkVersion 可以由Google Play商店用来从运行较低版本Android的用户的列表中过滤出您的应用。在设备上安装应用程序时,也会进行检查; Android不允许您安装在较低版本的Android上。

Anyway, minSdkVersion can be used by Google Play store to filter your app out of the listings for someone running a lower version of Android. It is also checked when you install an app on a device; Android won't let you install on a lower version of Android.

targetSdkVersion 表示您的应用已测试过哪个Android版本与并明智地合作。如果您的应用需要使用Android版本晚于 minSdkVersion 的功能,则通常可以高于 minSdkVersion

targetSdkVersion, on the other hand, indicates what version of Android your app has been tested with and works sensibly with. It can often be higher than minSdkVersion if your your app needs to use features introduced in Android versions later than minSdkVersion.

如果您要使用API​​级别23中的功能,请确保更新该清单部分。只需从Android清单模板文件中删除%targetSdkVersion%模板,然后将其替换为所需版本即可。

If you want to use a feature from API Level 23 then sure, you'll need to update that manifest part. Just remove the %targetSdkVersion% template from the Android manifest template file and replace it with the required version.

问题您可能会遇到以下问题:

Problems that you might run into:


  1. 您将要么需要检查Android版本,并且如果低于您的 targetSdkVersion ,请不要使用设置为 minSdkVersion 升级到合适的更高版本,以确保该应用程序只能在具有您要使用的功能的设备上运行。

  1. You'll either need to check the Android version and, if lower than your targetSdkVersion, not use those features that aren't available or set minSdkVersion to a suitably higher version to ensure the app can only run on devices that have the features you wish to use.

FireMonkey代码不了解其中的不同行为API级别可能会对
产生不利影响。对于您而言,由于API级别23中启用了
不同的运行时权限行为,您可能会遇到问题。

FireMonkey code not aware of differing behaviour in API Levels may function adversely. In your case you may get issues because of the different runtime permissions behaviour enabled in API Level 23.

实际上,尽管建议进行大量测试,但我目前无法想到其他任何问题。当不同的API级别可能会影响主题或其他UI元素时,您可能需要在使用可视活动等常规Android应用程序中进行更多考虑。在此Android上定位目标SDK版本时,您会看到各种变化。文档页面

Actually I can't currently think of any more issues, though a good amount of testing is recommended. You might have more to think about in a regular Android app using visual activities and so on, when different API levels may affect the theming or other UI elements. You can see the various things that change when you target target SDK versions on this Android documentation page.

顺便说一下,在工具中使用SDK Manager。 选项...对话框与如何更新生成的清单文件中的值的问题完全无关。更改它的唯一明显方法是按照文档手动编辑Android清单模板文件

By the way, the use of the SDK Manager in the Tools. Options... dialog is entirely irrelevant to the question of how to update the value in the generated manifest file. The only evident way to change it is to manually edit the Android manifest template file as per the documentation, and mentioned in a comment.

SDK Manager的唯一相关之处在于,Delphi 10.1 Berlin的默认Android SDK安装为API Level 22安装了平台库。如果您想使用API​​级别23中的功能,则可能会认为更新这些平台库可能是必要的,但是当然,如​​果您使用Delphi进行编码,那么(大概)实际上只是针对导入定义进行了编译。 API级别较高的功能,所以android.jar文件中是否包含这些功能都没有关系。**

The only relevance of the SDK Manager is that the default Android SDK installation for Delphi 10.1 Berlin installs the Platform libraries for API Level 22. If you want to use a feature from API Level 23 you might think that updating those platform libraries might be necessary, but of course if you're doing the coding in Delphi then you're (presumably) actually just compiling against import definitions of the features in that higher API level, and so whether or not those features are contained in the android.jar file is of no consequence.**

**我很高兴在这种情况下被证明是错误的,但是我从来没有观察到清单和SDK Manager所针对的内容之间的联系。

** I'm happy to be proved wrong on this count, but I have never observed a connection between the manifest and what the SDK Manager is set up against.

这篇关于Firemonkey:我们可以在AndroidManifest.template.xml中更新targetSdkVersion吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆