离子科尔多瓦错误 APK 或应用程序包,具有活动、活动别名、服务或带有意图过滤器的广播,但没有"安卓:导出"



这是同样的错误,其他人都报告过,但由于这个应用程序使用Ionic,每次我添加"android:export"属性,然后我运行ionic cordova build android --prod --release有新的属性被添加到AndroidManifest…

这些属性需要"android:export":

android: name ="android.intent.category.LAUNCHER"android: name ="nl.xservices.plugins.ShareChooserPendingIntent"android: name ="com.gae.scaffolder.plugin.MyFirebaseMessagingService"android: name ="com.google.android.gms.analytics.AnalyticsReceiver">

我明白了!我添加了cordova-custom-config插件,以便能够通过Config.xml文件更改AndroidManifest.xml。这很简单,只需添加插件,然后我在Config.xml中添加以下代码:

<platform name="android">
<custom-config-file parent="./application" target="AndroidManifest.xml">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode" android:exported="true" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
<intent-filter android:label="@string/launcher_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver android:enabled="true" android:exported="false" android:name="nl.xservices.plugins.ShareChooserPendingIntent">
<intent-filter>
<action android:name="android.intent.action.SEND" />
</intent-filter>
</receiver>
<service android:exported="false" android:name="com.gae.scaffolder.plugin.MyFirebaseMessagingService" android:stopWithTask="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<receiver android:enabled="true" android:exported="false" android:name="com.google.android.gms.analytics.AnalyticsReceiver">
<intent-filter>
<action android:name="com.google.android.gms.analytics.ANALYTICS_DISPATCH" />
</intent-filter>
</receiver>
</custom-config-file>
</platform>

然后离子cordova构建…瞧!

相关内容

  • 没有找到相关文章

最新更新