Installation error: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED?
Solution 1
There could be another reason for this error. The attribute
android:taskAffinity="string"
Should always start with a dot, like:
android:taskAffinity=".string"
Solution 2
Activity name should be prefixed with "." in your manifest file.
Solution 3
I was having this error because i had capital letters in my package name like this
Com.Example.packagename
after i had changed it to something like
com.example.packagename
it was solved
Solution 4
The INSTALL_PARSE_FAILED_MANIFEST_MALFORMED error code is returned by PackageParser.java when it detects any of a large number of errors in the manifest.xml file.
To isolate the error, look in logcat (when you do the 'adb install foo.apk' command). In the problem I encountered, logcat contained:
W/ActivityManager( 360): No content provider found for permission revoke: file:///data/local/tmp/foo.apk
D/Finsky (32707): [1] PackageVerificationReceiver.onReceive: Verification requested, id = 6
D/Finsky (32707): [1] WorkerTask.onPreExecute: Verification Requested for id = 6, data=file:///data/local/tmp/foo.apk flags=112 fromVerificationActivity=false
W/PackageParser(32707): /data/local/tmp/foo.apk (at Binary XML file line #214): <provider> does not include authorities attribute
D/Finsky (32707): [716] PackageVerificationService.getPackageInfo: Cannot read archive for file:///data/local/tmp/foo.apk in request id=6
D/Finsky (32707): [1] PackageVerificationReceiver.onReceive: Verification requested, id = 6
W/ActivityManager( 360): No content provider found for permission revoke: file:///data/local/tmp/foo.apk
I/PackageManager( 360): Copying native libraries to /data/app-lib/vmdl1205566381
W/PackageParser( 360): /data/app/vmdl1205566381.tmp (at Binary XML file line #214): <provider> does not include authorities attribute
In the fourth line above, you can see that PackageParser complains that line #214 of the manifest.xml file "<provider> does not include authorities attribute". See the listing below of all the cases in PackageParser that returns that error code. (PackageParser is the only class that produces the PackageManager.INSTALL_PARSE_FAILED_MANIFEST_MALFORMED error code)
In my case the message "<provider> does not include authorities attribute" is produced by line 2490 of PackagerParser.java in the parseProvider function called by parseApplication.
From the 4.1.1 version of frameworks/base/core/java/android/content/pm/PackageParser.java, PackageManager.INSTALL_PARSE_FAILED_MANIFEST_MALFORMED is referenced on these lines in these methods. If the source code line number is followed by a quoted string that is the message printed in logcat. if the line number is followed by a Java expression that is the code that caused that error code to be returned that that function should be investigated to see what caused the error message to be returned. In a couple cases I couldn't isolate the error cause to one specific method call.
in parsePackage:
536: (only used in 'core apps' with no 'pkg')
973: "<manifest> has more than one <application>"
1275: "Bad element under <manifest>: " --if RIGID_PARSER
in parsePermissionGroup:
1464: !parsePackageItemInfo(owner, perm.info, outError,
"<permission-group>", sa,
com.android.internal.R.styleable.AndroidManifestPermissionGroup_name,
com.android.internal.R.styleable.AndroidManifestPermissionGroup_label,
com.android.internal.R.styleable.AndroidManifestPermissionGroup_icon,
com.android.internal.R.styleable.AndroidManifestPermissionGroup_logo)
1482: !parseAllMetaData(res, parser, attrs, "<permission-group>", perm,
outError)
in parsePermission:
1506: !parsePackageItemInfo(owner, perm.info, outError,
"<permission>", sa,
com.android.internal.R.styleable.AndroidManifestPermission_name,
com.android.internal.R.styleable.AndroidManifestPermission_label,
com.android.internal.R.styleable.AndroidManifestPermission_icon,
com.android.internal.R.styleable.AndroidManifestPermission_logo)
1530: "<permission> does not specify protectionLevel"
1541: "<permission> protectionLevel specifies a flag but is not based on signature type"
1548: !parseAllMetaData(res, parser, attrs, "<permission>", perm, outError)
in parsePersmissionTree:
1572: !parsePackageItemInfo(owner, perm.info, outError,
"<permission-tree>", sa,
com.android.internal.R.styleable.AndroidManifestPermissionTree_name,
com.android.internal.R.styleable.AndroidManifestPermissionTree_label,
com.android.internal.R.styleable.AndroidManifestPermissionTree_icon,
com.android.internal.R.styleable.AndroidManifestPermissionTree_logo)
1585: "<permission-tree> name has less than three segments: "+perm.info.name
1595: !parseAllMetaData(res, parser, attrs, "<permission-tree>", perm, outError)
in parseInstrumentation:
1625: new Instrumentation(mParseInstrumentationArgs, new InstrumentationInfo())
1648: "<instrumentation> does not specify targetPackage"
1654: !parseAllMetaData(res, parser, attrs, "<instrumentation>", a, outError)
in parseApplication:
1678: buildClassName(pkgName, name, outError) == null
1851: (Set by various other functions)
1869: parseActivity(owner, res, parser, attrs, flags, outError, false, hardwareAccelerated) == null
1878: parseActivity(owner, res, parser, attrs, flags, outError, true, false) == null
1887: parseService(owner, res, parser, attrs, flags, outError) == null
1896: parseProvider(owner, res, parser, attrs, flags, outError) == null
2484: "Heavy-weight applications can not have providers in main process"
2890: "<provider> does not incude authorities attribute"
1905: parseActivityAlias(owner, res, parser, attrs, flags, outError) == null
1917: parseMetaData(res, parser, attrs, owner.mAppMetaData, outError) == null
1969: "Bad element under <application>: "+tagName
It's regrettable that you have to poke around in logcat and the source to figure out what causes a problem.
Solution 5
May all these answers won't work for someone (did not work for me) in Android 12 or Android S [You can check to make targetSdkVersion "S" to targetSdkVersion 30 it will work fine]. For this, to work we need to update all of our dependencies to the latest one and have to add -
android:exported="true"
to to any activity, activity-alias, service, or receiver components that have intent-filters declared in the app’s AndroidManifest.xml file. Because there are few behaviors changed in Android 12.
Related videos on Youtube
S.P
Updated on July 08, 2022Comments
-
S.P almost 2 years
I am developing a small application that lists all the applications present/ installed on the android device. But I'm getting the below error while i'm trying to run the code.
Installation error: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED
Please can any one help me to sort out this error.
-
Ribo almost 10 yearsThere are many errors in the manifest.xml file that can cause this error code, see PackageParser.java error list answer below.
-
shieldgenerator7 over 9 yearsYou didn't accept an answer?
-
Sritam Jagadev over 9 yearsFollow this link You will get your answer stackoverflow.com/questions/16015033/…
-
Vishnuvathsan over 9 yearsCheck this link for a clear answer
-
Waheed Akhtar about 8 yearsIf you have different packages and classes in your project.Change package name from upper letters to lower letters.Package name should start with lower letters
-
user3508883 over 7 yearscheck your application id in build.gradle if you are using gradle.
-
Vishal Ambre almost 4 yearsINSTALL_PARSE_FAILED_MANIFEST_MALFORMED can be caused by many different reasons, can you share your manifest
-
arekolek about 3 yearsThe reason is reported in Logcat stackoverflow.com/a/24750245/1916449
-
Hedron Dantas over 2 yearsIt happened to me after upgrading to targetsdk 31
-
Eric Engel over 2 yearsThis happened when I generated a new project. No matter what I did, I couldn't get around it. I generated a few more projects just to verify I wasn't a change I was making. In the end, the answer "android:exported="true"" by Bajrang Hudda found below was the fix. This is one reason I like to run generated boilerplate code before beginning my work. Unfortunately, it's a habit easy to skip.
-
-
Admin about 12 years@IgorG. Sorry I lost my point :-( But the new SDK removed that field (here).
-
Amt87 almost 12 yearsin Manifest you declared package attribute with package, so when you create activity you put "." to be preceded by package name, you can also type the full name of the activity like : "com.example.test.Activity_Name", or ".Activity_Name"
-
kolossus over 11 yearsPlease add some more detail to your answer
-
Maksim Dmitriev over 11 yearsThank you. I called a process such a way:
android:process="com.my_pack.services.MyServiceProcess"
(com.my_pack.services is the package where my service is) and the installation error will not show up after that. -
alicanbatur over 10 yearsthis solved my problem. My activity class was under a package which called Activities, and i add it to manifest before this error appeared. when i changed the Activities package name to activities, it solved. Thanks
-
Gene almost 10 yearsI think you can have capital letters in the package name, however, the 1st letter in the package name cannot be a capital letter. So "myActivity" = OK but "MyActivity"= Not OK
-
Vinay W over 8 yearsthanks for helping us understand how to solve the general problem in addition to giving a specific solution.
-
shshnk over 8 yearsEven I had the same problem. They should have mentioned the we need to include package name for when not using ':'
-
shshnk over 8 yearsBy adding the ':' you changed the semantics of the code. In the second case the application will create a new process for the service which is available to that application only. developer.android.com/guide/topics/manifest/…. Instead the error can be fixed by mentioning the complete package name instead of just the word 'screen'.
-
Meghal Shah over 8 yearsThere are multiple reason, for this exception. This is most logical answer.
-
cottonBallPaws over 8 yearsI wish I could upvote this again. Second time this answer has helped me
-
CzarMatt over 8 yearsThank you - in my case I had a
IntentFilter.MalformedMimeTypeException
that I missed. -
Krishnabhadra over 8 yearsThis is the correct answer by far. How useful is logcat?
-
Beto Caldas about 8 yearsProblem solved for me but, where can I find this information in documentation? there is nothing about a DOT here: developer.android.com/guide/topics/manifest/…
-
Elyakim Levi over 6 yearsExactly my case. I need it to be a different color depending on user's preferences. Sadly, android:resource doesn't accept attributes...
-
Sovary about 4 yearsIn Xamarin android fixed on Activity Name attribute. That's work for me
-
Waldmann almost 4 yearsyou saved my day
-
khcpietro about 3 yearstechnically, taskAffinity doesn't have to start with dot, just containing is okay.
-
Taslim Oseni about 2 yearsCan you explain why?
-
Sam Justman about 2 yearsHere you can find the explanation: developer.android.com/guide/topics/manifest/…