失败[INSTALL_PARSE_FAILED_MANIFEST_MALFORMED]

时间:2016-07-08 14:40:43

标签: android android-manifest

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="sam.gymnotes" >

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/NoActionBar" >
    <meta-data
        android:name="com.google.android.gms.version"
        />

    <activity
        android:name=".activity_ExcersiseView"
        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=".dialog_new_excersise"
        android:label="dialog_new_excersise"
        android:theme="@style/Theme_Dialog" >
    </activity>
    <activity
        android:name=".activity_IconChooser"
        android:label="@string/title_activity_icon_chooser" >
    </activity>
    <activity
        android:name=".activity_WorkoutView"
        android:label="@string/title_activity_activity__workout_view" >
    </activity>
    <activity
        android:name=".dialog_are_you_sure"
        android:label="@string/title_activity_dialog_are_you_sure"
        android:theme="@style/Theme_Dialog" >
    </activity>
    <activity
        android:name=".activity_SetView"
        android:label="@string/title_activity_activity__set_view" >
    </activity>
    <activity
        android:name=".dialog_edit_workout"
        android:label="@string/title_activity_dialog_date_picker"
        android:theme="@style/Theme_Dialog" >
    </activity>
    <activity
        android:name=".dialog_new_set"
        android:label="@string/title_activity_dialog_new_set"
        android:theme="@style/Theme_Dialog" >
    </activity>
    <activity
        android:name=".dialog_edit_note"
        android:label="@string/title_activity_dialog_edit_note"
        android:theme="@style/Theme_Dialog" >
    </activity>
    <activity
        android:name=".dialog_3option"
        android:label="@string/title_activity_dialog_convert"
        android:theme="@style/Theme_Dialog" >
    </activity>
    <activity
        android:name=".activity_Info"
        android:label="@string/title_activity_info" >
    </activity>
</application>

</manifest>

上面是我的清单文件,我在这里已经通过了很多答案,因为格式错误的清单,我无法弄清楚问题是什么。安装APK&#39;时导致“错误”的原因是什么?我试图运行时得到的只是

pkg:/data/local/tmp/sam.gymnotes 失败[INSTALL_PARSE_FAILED_MANIFEST_MALFORMED]

的gradle;

apply plugin: 'com.android.application'

android {
compileSdkVersion 24
buildToolsVersion '24.0.0'

defaultConfig {
    applicationId "sam.gymnotes"
    minSdkVersion 14
    targetSdkVersion 24
    versionCode 4
    versionName "1.1"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:design:24.0.0'
compile 'com.google.android.gms:play-services:9.2.0'
}

2 个答案:

答案 0 :(得分:0)

修改

尝试this answer

-> File
 -> project structure
  -> app 
   -> dependencies 
    -> click on + 
     -> library dependency
      -> select play-services (October 2015: com.google.android.gms:play-services:7.8.0)

-> Rebuild 

答案 1 :(得分:0)

1)将</manifest>放在文件的末尾。

2)使用以下代码获取gms版本

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