今天用delphi 12.1升级旧项目,编译正常,但安装时出下面的提示:
08:48:26 E/SplitApkInstaller: Failed to finalize session : INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI: /data/app/vmdl1849586780.tmp/base.apk (at Binary XML file line #67): com.embarcadero.firemonkey.CCFMXNativeActivity: Targeting S+ (version 31 and above) requires that an explicit value for android:exported be defined when intent filters are present
[BT:1.5.0] Error: Installation of the app failed.
com.android.tools.build.bundletool.model.exceptions.CommandExecutionException: Installation of the app failed.
at com.android.tools.build.bundletool.model.exceptions.InternalExceptionBuilder.build(InternalExceptionBuilder.java:57)
at com.android.tools.build.bundletool.device.DdmlibDevice.installApks(DdmlibDevice.java:145)
解决方法,在AndriodManifest.template.xml文件中增加一句:android:exported="true":
<activity android:name="com.embarcadero.firemonkey.CCFMXNativeActivity"
android:label="%activityLabel%"
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
android:launchMode="singleTask"
android:exported="true">
<!-- Tell NativeActivity the name of our .so -->
<meta-data android:name="android.app.lib_name"
android:value="%libNameValue%" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>