我在安装应用程序时遇到一个奇怪的问题。
当我编译我的项目时没有错误,但是当我尝试启动它时,它显示了,
安装错误:
INSTALL_PARSE_FAILED_MANIFEST_MALFORMED
错误。
我尝试了很多与安装错误相关的事情:INSTALL_PARSE_FAILED_MANIFEST_MALFORMED错误并且也遵循该规则,但出了问题。
<manifest
android:hardwareAccelerated="true"
android:versionCode="1"
android:versionName="0.0.1"
package="Work.Work"
xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens
android:anyDensity="true"
android:largeScreens="true"
android:normalScreens="true"
android:resizeable="true"
android:smallScreens="true"
android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:hardwareAccelerated="true"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:supportsRtl="true">
<activity
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale"
android:label="@string/activity_name"
android:launchMode="singleTop"
android:name="MainActivity"
android:screenOrientation="portrait"
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>
<activity
android:exported="true"
android:name="com.plugin.gcm.PushHandlerActivity" />
<receiver
android:name="com.plugin.gcm.CordovaGCMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="Work.Work" />
</intent-filter>
</receiver>
<service android:name="com.plugin.gcm.GCMIntentService" />
<activity
android:exported="true"
android:name="com.adobe.phonegap.push.PushHandlerActivity" />
<receiver android:name="com.adobe.phonegap.push.BackgroundActionButtonHandler" />
<receiver
android:exported="true"
android:name="com.google.android.gms.gcm.GcmReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="${applicationId}" />
</intent-filter>
</receiver>
<service
android:exported="false"
android:name="com.adobe.phonegap.push.GCMIntentService">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</service>
<service
android:exported="false"
android:name="com.adobe.phonegap.push.PushInstanceIDListenerService">
<intent-filter>
<action android:name="com.google.android.gms.iid.InstanceID" />
</intent-filter>
</service>
<service
android:exported="false"
android:name="com.adobe.phonegap.push.RegistrationIntentService" />
</application>
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="23" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission
android:name="Work.Work.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<!--<uses-permission android:name="Work.Work.permission.C2D_MESSAGE" />-->
<!--<uses-permission android:maxSdkVersion="18" android:name="android.permission.WRITE_EXTERNAL_STORAGE" />-->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission
android:name="${applicationId}.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<!--<uses-permission android:name="${applicationId}.permission.C2D_MESSAGE" />-->
我遇到了这个错误,因为我的包名称中有大写字母,如下所示。
Com.Droider.packagename;
在我将其更改为类似以下内容之后:
com.droider.packagename;
根据您的情况尝试将其更改为:
work.work;
编辑1:
也可能是这个原因。
android:name="MainActivity"
将其更改为。
android:name=".MainActivity"
可能会导致Android 12。为此
在您的活动中添加
exported = true
示例:
<activity
android:exported="true" />
只需检查所有
android:name="..."
在你的清单中,看看你是否忘记在应该有它的名称的开头加一个点,主要是你的类的名称。
<activity
android:exported="true" />
package="Work"
APK 清单
package
名称中必须至少包含一个 .
分隔符。例如:
package="work.work"
PackageParser
源代码,了解安装失败的各种原因 INSTALL_PARSE_FAILED_MANIFEST_MALFORMED
。
就我而言,我将“:”放在 android:process 的值上
<service
android:name=".Views.Views.services.MyService"
android:process=":remote" />
它对我有用
就我而言 如果您已将 Activity 更改为 Fragment 然后从 androidmanifest.xml 文件中删除该活动名称
<activity
android:name=".fragment_change_password"
android:screenOrientation="portrait" />
从清单文件中删除此类行
您的包名称中有一个大写字母。尝试重构您的包,使所有字母均为小写。为此,在项目面板中,确保处于 Android 视图模式,然后单击视图指示器右侧的齿轮,然后确保未选中紧凑的空中间包。接下来,右键单击包含大写字母的包,然后选择“重构”->“重命名”。将其更改为小写,仔细检查您的 AndroidManifest.xml 现在是否为小写,如果不是,请手动编辑它。
在清单文件中,每个 xml 资源文件都可以使用元数据标签。 如果该元数据没有 android:resource location ,就会出现此问题。
示例:
<meta-data android:name="com.google.android.actions"
android:resource="@drawable/cellphone"/>
在我的例子中,我将 Application 类放置在主包文件夹之外。
只需将应用程序类移动到根活动文件夹即可。
导出的标志应该出现在具有意图过滤器、接收者、服务、提供者的活动中......
就我而言,我错过了接收者和提供者
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:enabled="true"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>