29

I tried everything, renaming the package, changing the permissions etc, still i see the error INSTALL_PARSE_FAILED_MANIFEST_MALFORMED on my console.

I tried logging from logcat and this is what it says is "Failed parse during installPackageLI" and "android.content.pm.PackageParser$PackageParserException: /data/app/vmdl170122893.tmp/base.apk (at Binary XML file line #33): does not have valid android:name" and atlast says "Debugger is no longer active"

I am trying this to run on em21 ie 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>
auselen
  • 27,577
  • 7
  • 73
  • 114
Rushabh Shah
  • 405
  • 1
  • 6
  • 16
  • You might want to use proper case (ie lowercase) for package name –  Nov 03 '14 at 19:54
  • Package names should always be in lowercase, see: http://stackoverflow.com/questions/12534302/why-java-package-name-should-be-in-lowercase – Rolf ツ Nov 03 '14 at 19:55
  • I edited to remove you google map api key, beware before posting such data –  Nov 03 '14 at 19:56
  • i already had lowercase, i saw many discussions with same thing renaming to uppercase (http://stackoverflow.com/questions/16015033/installation-error-install-parse-failed-manifest-malformed) and still doesnt work – Rushabh Shah Nov 03 '14 at 19:57
  • @RolfSmit go for it, you did search for a reference –  Nov 03 '14 at 19:57
  • @RushabhShah replace all package name to lower case then post your logback if it's still failing (and point us to the line of the manifest shown in the error message: `Binary XML file line #33`) –  Nov 03 '14 at 19:59
  • @RushabhShah it seems the only way to fix this problem is by removing the uppercase package names. What does not work after changing it to lowercase? – Rolf ツ Nov 03 '14 at 20:01
  • Failed parse during installPackageLI – Rushabh Shah Nov 03 '14 at 20:07
  • android.content.pm.PackageParser$PackageParserException: /data/app/vmdl1812012324.tmp/base.apk (at Binary XML file line #77): requires an android:value or android:resource attribute – Rushabh Shah Nov 03 '14 at 20:07
  • Explicit concurrent mark sweep GC freed 4485(323KB) AllocSpace objects, 0(0B) LOS objects, 19% free, 6MB/8MB, paused 1.271ms total 21.670ms - Shutting Down VM – Rushabh Shah Nov 03 '14 at 20:08
  • This is all after i change the name to lowercase !! – Rushabh Shah Nov 03 '14 at 20:08
  • What don't you understand in " requires an android:value or android:resource attribute" (ie. both meta-data in your manifest need a android:value or android:resource attribute, that's pretty clear IMHO, ieie `com.google.android.gms.version` need a value) –  Nov 03 '14 at 20:12

8 Answers8

56

If anyone getting this error on Android 12 (Android S) preview version. Update all of your dependencies to latest one and Please add -

android:exported="true"

to to any <activity>, <activity-alias>,<service>, or <receiver> components that have <intent-filter>s declared in the app’s AndroidManifest.xml file.

Refer to this link and behavioral changes for Android 12 API 31.

karanatwal.github.io
  • 3,613
  • 3
  • 25
  • 57
  • @or_dvir Are you trying on Android 12 phone or emulator? – karanatwal.github.io Jun 14 '21 at 14:04
  • 1
    not working for me, using it on emulator... also what about the manifest files of the external libs? they might not be using exported, will it affect my app? – tronku Jun 15 '21 at 05:44
  • 1
    using an emulator. @tronku turns out that was the issue with me IN ADDITION to setting `exported=true`. i updated all my dependencies and that fixed it. but i guess that would not work if the dependencies still did not comply with this new rule. also note that i did not get the specific error message that other people get (telling exactly where the problem is) – or_dvir Jun 15 '21 at 07:20
  • @or_dvir I tried updating the cached manifests of external libs and checked the merged manifest for the exported issue, but found nothing.. still not able to install the app on emulator – tronku Jun 15 '21 at 08:25
  • for me, i had to update leakcanary to version 2.9.1 (`debugImplementation "com.squareup.leakcanary:leakcanary-android:2.9.1"`) because the older version i was using probably didn't have an `exported` attribute – Eric Oct 23 '22 at 21:18
16

There is more than one problem as RC. and I found out.

  • Change all your package names to lowercase
  • Update the <meta-data> attribute to have a valid value.

Correct code for the meta data:

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

Sources:

Community
  • 1
  • 1
Rolf ツ
  • 8,611
  • 6
  • 47
  • 72
  • 1
    "Change all your package names to lowercase" works for me. Thank you :) – Bahadır EKİCİ Oct 01 '18 at 11:15
  • Oh! man working on Kotlin Multiplatform project spent many hours finding the solution. Service was not working in lower apis. Just changed the package name to lower case and worked. Thank you!! – Sarim Ahmed Mar 01 '21 at 12:58
4

I was getting this issue

failed to install c:\users\nisha jain\documents\grayopus 
project\rxsmile\build\app\outputs\flutter-apk\app.apk: failure 
[install_parse_failed_manifest_malformed: failed parse during 
installpackageli: /data/app/vmdl914617141.tmp/base.apk (at binary xml file 
line #27): com.grayopus.rxsmile.mainactivity: targeting s+ (version 31 and 
above) requires that an explicit value for android:exported be defined when 
intent filters are present] error launching application on sm e625f.

But it was solved by adding this line in AndroidManifest.xml

android:exported="true"
Ramesh R
  • 7,009
  • 4
  • 25
  • 38
Nisha Jain
  • 637
  • 6
  • 14
1

Your package name has a capital letter in it. Try refactoring your package so that all the letters are lowercase. To do this, in the panel for your project, make sure you're in Android view mode, then click the gear that is a little to the right of the view indicator, then make sure compact empty middle packages is unchecked. Next, right click on your package with a capital letter in it and select refactor -> rename. Change it to have a lower case, double check your AndroidManifest.xml is now a lower case, if not, manually edit it.

Mohamed Mesalm
  • 704
  • 8
  • 17
1

none of the proposed solutions worked for me, so im posting this additional answer in the hope it will help others.

what worked for me was setting exported value for all my activities (as suggested by @karanatwal.github.io) AND updating all my dependencies, which apparently did not have this value set.

i originally dismissed the dependencies part from my attempts to fix this, as during my research ive seen (online) very specific error messages saying that this is indeed the problem (setting exported value) as well as indicating exactly which dependency was not complying with it. for some reason, i did not get this message.

note that this may not work if the latest version of a dependency still does not comply with this rule.

or_dvir
  • 479
  • 1
  • 7
  • 22
1

INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI: /data/app/vmdl192287100.tmp/base.apk (at Binary XML file line #264): com.razorpay.RzpTokenReceiver: Targeting S+ (version 31 and above) requires that an explicit value for android:exported be defined when intent filters are present'

I tried some different methods but it only worked when I changed compilesdk and targetsdk from 31 to 30 as follows:

compileSdkVersion 30
minSdkVersion 26
targetSdkVersion 30
Donald Duck
  • 8,409
  • 22
  • 75
  • 99
sham
  • 17
  • 2
0

if you are trying to add .9.png files to your app , you need to define your xml file source in your main activity meta-data part as an android resource , this solved my problem:

     <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)"
        />
0

In this error, majorly the fault is either for exported flag or for not using proper name in manifest.

For example, if service is defined in your manifest, and you are declaring the process, then you have to define entire path i.e.

<service
        android:name=".ui.service.YOUR_SERVICE_NAME"
        android:enabled="true"
        android:process="com.example.ui.service.YOUR_SERVICE_NAME"
        android:exported="true">
        <intent-filter>
            <action android:name="ACTION_ACCEPT" />
            <action android:name="ACTION_REJECT" />
        </intent-filter>
    </service>

As shown above, It will give this error if used as follow:

android:process="YOUR_SERVICE_NAME"

instead try using as follow

android:process="com.example.ui.service.YOUR_SERVICE_NAME"

thanks