【问题标题】:INSTALL_PARSE_FAILED_MANIFEST_MALFORMEDINSTALL_PARSE_FAILED_MANIFEST_MALFORMED
【发布时间】:2014-12-30 13:32:38
【问题描述】:

我尝试了一切,重命名包,更改权限等,但我仍然在控制台上看到错误 INSTALL_PARSE_FAILED_MANIFEST_MALFORMED。

我尝试从 logcat 记录,这就是它所说的“在 installPackageLI 期间解析失败”和“android.content.pm.PackageParser$PackageParserException:/data/app/vmdl170122893.tmp/base.apk(在二进制 XML 文件中)第 33 行):没有有效的 android:name”并且 atlast 说“调试器不再处于活动状态”

我正在尝试在 em21 即 Lollipop SDK 上运行它。

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="Ca.Rushabh.Mobileproject"
android:versionCode="1"
android:versionName="1.0" >

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

<uses-feature
    android:glEsVersion="0x00020000"
    android:required="true" />

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<permission
    android:name="com.example.mymapsv2.permission.MAPS_RECEIVE"
    android:protectionLevel="signature" />

<uses-permission android:name="com.example.mymapsv2.permission.MAPS_RECEIVE" />

<application
    android:allowBackup="true"
    android:icon="@drawable/blue_droid"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="Ca.Rushabh.Mobileproject.MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name="Ca.Rushabh.Mobileproject.About"
        android:label="@string/title_activity_about"
        android:theme="@android:style/Theme.Dialog" >
    </activity>
    <activity
        android:name="Ca.Rushabh.Mobileproject.ToDoList"
        android:label="abcd" />
    <activity
        android:name="Ca.Rushabh.Mobileproject.ToDoDetailActivity"
        android:windowSoftInputMode="stateVisible|adjustResize" />

    <provider
        android:name="Ca.Rushabh.Mobileproject.MyToDoContentProvider"
        android:exported="false"
        android:authorities="com.example.mobileproject.todos.contentprovider" />

    <activity
        android:name="Ca.Rushabh.Mobileproject.ViewAnimationActivity"
        android:label="@string/title_animation" >
    </activity>
    <activity
        android:name="Ca.Rushabh.Mobileproject.ViewAnimation2"
        android:label="@string/title_animation" >
    </activity>
    <activity
        android:name="Ca.Rushabh.Mobileproject.ContactUs"
        android:label="@string/title_activity_contact_us"
        android:theme="@android:style/Theme.Dialog" >
    </activity>
    <activity
        android:name="Ca.Rushabh.Mobileproject.GoogleMapV2"
        android:label="@string/title_activity_google_map_v2" >
    </activity>
    <meta-data
        android:name="com.google.android.gms.version" />
    <meta-data
        android:name="com.google.android.maps.v2.API_KEY"
        android:value="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" />
</application>

</manifest>

【问题讨论】:

  • 您可能希望使用正确的大小写(即小写)作为包名
  • 包名应始终为小写,请参阅:stackoverflow.com/questions/12534302/…
  • 我编辑删除了你的谷歌地图 api 密钥,在发布此类数据之前要小心
  • 我已经有了小写字母,我看到很多讨论都将相同的东西重命名为大写字母 (stackoverflow.com/questions/16015033/…),但仍然不起作用
  • @RolfSmit 去吧,你确实搜索了参考

标签: android


【解决方案1】:

如果有人在 Android 12 (Android S) 预览版上收到此错误。将所有依赖项更新为最新的,并且 请添加 -

android:exported="true"

到任何在应用的 AndroidManifest.xml 文件中声明了 &lt;intent-filter&gt;s 的 &lt;activity&gt;&lt;activity-alias&gt;&lt;service&gt;&lt;receiver&gt; 组件。

请参阅此linkbehavioral changes for Android 12 API 31

【讨论】:

  • @or_dvir 您是在使用 Android 12 手机还是模拟器?
  • 不适合我,在模拟器上使用它......还有外部库的清单文件呢?他们可能没有使用导出,这会影响我的应用吗?
  • 使用模拟器。 @tronku 原来是我除了设置exported=true 之外的问题。我更新了所有依赖项并修复了它。但我想如果依赖项仍然不符合这个新规则,那将行不通。另请注意,我没有收到其他人收到的特定错误消息(准确说明问题出在哪里)
  • @or_dvir 我尝试更新外部库的缓存清单并检查合并清单是否存在导出问题,但什么也没找到.. 仍然无法在模拟器上安装应用程序
【解决方案2】:

RC. 的问题不止一个,我发现了。

  • 将所有包名更改为小写
  • &lt;meta-data&gt; 属性更新为有效值。

元数据的正确代码:

<meta-data
    android:name="com.google.android.gms.version"
    android:value="@integer/google_play_services_version" />

来源:

【讨论】:

  • “将所有包名更改为小写”对我有用。谢谢你:)
  • 哦!从事 Kotlin Multiplatform 项目的人花了很多时间寻找解决方案。服务在较低的 api 中不起作用。只需将包名称更改为小写即可。谢谢!!
【解决方案3】:

您的包名中有一个大写字母。尝试重构你的包,使所有的字母都是小写的。为此,在您项目的面板中,确保您处于 Android 视图模式,然后单击视图指示器右侧一点点的齿轮,然后确保未选中紧凑的空中间包。接下来,右键单击包含大写字母的包,然后选择重构 -> 重命名。将其更改为小写,仔细检查您的 AndroidManifest.xml 现在是否为小写,如果不是,请手动编辑它。

【讨论】:

    【解决方案4】:

    没有一个建议的解决方案对我有用,所以我发布了这个额外的答案,希望它能帮助其他人。

    对我有用的是为我的所有活动设置 exported 值(如 @karanatwal.github.io 所建议的那样)并更新我的所有依赖项,这些依赖项显然没有设置此值。

    我最初在尝试解决此问题时忽略了依赖项部分,因为在我的研究过程中,我看到(在线)非常具体的错误消息说这确实是问题(设置 exported 值)以及准确指示哪个依赖项没有遵守它。由于某种原因,我没有收到此消息。

    请注意,如果最新版本的依赖项仍然不符合此规则,这可能不起作用。

    【讨论】:

      【解决方案5】:

      如果您尝试将 .9.png 文件添加到您的应用程序,您需要在您的主要活动元数据部分中将您的 xml 文件源定义为 android 资源,这解决了我的问题:

           <meta-data
                     android:name="com.google.android.actions
             //add this line
                     android:resource="@drawable/sample_button 
             //(here sample_button is the name of your xml file in the drawable folder)"
              />
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-08-28
        • 2017-07-10
        • 1970-01-01
        • 2021-12-23
        相关资源
        最近更新 更多