Android "There is a problem parsing the package" [duplicate] - android

I got this error while installing the android application (Parse Error : There is a problem parsing the package.). I did the following steps.
First time I installed the application and it works fine.
I made changes to the existing application and change the version no in Manifest file.
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.openintents.samples.BasicOpenARDemo" android:versionCode="2" android:versionName="1.0.1">
Then I export the application and finish the code signing process.
For this, Right Click your Project node > select Export. There you will see a wizard. Follow the steps and finish the code signing also.
I got the ARDemo.apk file, Then I changed it’s name to ARDemo1.apk
Then I shipped this apk file to mobiles SD Card and started the installation I got the above error.
I googled, they say that problem with unpacking manifest file.
Can anyone tell me what could be wrong with me?

You said that the first time you installed the application it worked fine.
The only difference in the steps you outlined between the two versions are:
The version number (I'm assume
that this did not participate in
breaking anything)
The code
The name of the .apk file
Try renaming the ARDemo1.apk file back to ARDemo.apk (make sure to back up the older version) and see if that helps. My guess is that it has something to do with the name of the apk.
If it still does not work, then you can eliminate the name of the apk file as the source of the problem and start investigating 2) by rebuilding your old version and see if you have same problem again. If the problem does not exists with the rebuilt version of your old code then you know it must be something to do with your code.
I hope that gets you somewhere.
Cheers,
Joseph

Installation can give the specified error at least in following cases:
Name of the package is changed after signing: Use the exact name as the signed package is (instead, adjust the name in Manifest)
Package is compiled against on higher API level: Correct the API level in Manifest file
Package is executed from SD-card: Run (install) the apk -file from phones memory OR use adb command to install it

I've only seen the parsing error when the android version on the device was lower than the version the app was compiled for. For example if the app is compiled for android OS v2.2 and your device only has android OS v2.1 you'd get a parse error when you try to install the app.

Instead of shooting in the dark, get the reason for this error by installing it via adb:
adb -s emulator-5555 install ~/path-to-your-apk/com.app.apk
Replace emulator-5555 with your device name. You can obtain a list using:
adb devices
Upon failing, it will give a reason. Common reasons and their fixes:
INSTALL_PARSE_FAILED_NO_CERTIFICATES: Reference
INSTALL_FAILED_UPDATE_INCOMPATIBLE: Reference

The reason is apk is not signed.
Once the apk is signed, the issue will be resolved.
http://ionicframework.com/docs/guide/publishing.html
Please use the link on instructions to sign the apk.

If you're compiling and exporting your apk file under SDK version 2.1, it will not work on any android version below your SDK export "2.1". Android software is forward compatible not backward compatible. For example if you're programming using the android NDK (ann add-on to the android SDK) package that allows development in the C/C++ family, this is only compatible with android 2.3, android version 2.2 and below support java builds only. Therefore you will reaceive the "There is a problem parsing the package" error.

Check whether your device supports the version you specified in minSdkVersion in AndroidManifest.xml . If not specify the lower version and try again

I'm not repeating what is instructed here to input the Key store, password, etc.
Try
Build -> Generate Signed APK -> [ Input ] ---Next---> select BOTH
V1 (Jar Signature)
V2 (Full APK Signature)
I don't know why, but at least it worked in my situation.

Another possibility is that you have saved the apk file into application PRIVATE folder and then try to install (by starting an intent from your code). in this case, when you start intent, you get error parsing package. In this case, the raised error is about permission issues. The point is saving the file into private folders is not a good practice, however if you really want to do that, you should write file in MODE_WORL_READABLE when you download it. Please consider that MODE_WORLD_READABLE is deprecated and this solution is not the best as it has some security issues. The best is to save your file in an external storage.

If you are facing this issue in device using android 12. You can fix it by adding android:exported="true" in AndroidManifest.xml as mentioned below
<activity
android:name=".MainActivity"
android:exported="true"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:label="#string/app_name"

I got the same error (Parse Error, There is a problem parsing the package) while trying to install an .apk package from email. I was able to get around the problem by installing the 3rd party package installer ApKatcher:
http://www.addictivetips.com/mobile/install-android-apps-from-gmail/
ApKatcher isn't the only solution. A colleague of mine got around the problem by installing Astro File Manager.
You can find both applications in the Android Marketplace.

Similar issue, using this "borrowed" and slightly modified code:
Intent intent = new Intent(Intent.ACTION_VIEW);
File newApk = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) + "myapp.apk");
intent.setDataAndType(Uri.fromFile(newApk), "application/vnd.android.package-archive");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
result = true;
Needed to change the file creation to this (comma instead of plus in the File constructor, was missing '/' after the download directory):
File newApk = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS), "myapp.apk");

I had a bad tag pair in my manifest file.
<meta-data>
</meta-data>
Basically got in when I copied a bad meta-data sample code from payu pdf file. Crap.

One reason could be, that your activity'name is not defined in the manifest
<activity
android:name=""
...>
</activity>
above code was creating the same issue with me

Another problem causing this error can be installing APK from restricted SD card mount point /mnt/media_rw/MicroSD.
Use unrestricted mount point /Removable/MicroSD.

And just to help possible new readers, another reason may be errors in the manifest file. I had mistyped android:service as android.service and ran into the same error...

As mentioned by #Veneet Reddy install it via ADB.
Go to ADT Bundle/sdk/platform-tools past your .apk file and run command prompt as administrator.
Then run adb devices command which will list the connected devices or emulators that are running.
Then run adb -s yourDeviceID install yourApk.apk
Note:
uninstall the app if you have already installed before installing again.

I have had this problem Parse Error : There is a problem parsing the package.
I was testing on Android-8. I have same apk with same signature .Everything was same without the version number and version name. App was installing when I install it manually but this error occurred when I was downloading and installing updates programmatically. Then I have found my cause of problem.
There was an option to check canRequestPackageInstalls ()
When this method returns true then app get installed successfully. It was returning false always in my case.
So first I check this and then let the user to download and install updates.
In onCreate()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
if (!packageManager.canRequestPackageInstalls()) {
startActivityForResult(
Intent(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES).setData(
Uri.parse(String.format("package:%s", packageName))
), requestCodeqInstallPackage
)
} else {
canInstallPackage = true
}
}
In onActivityResult()
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
if (requestCode == requestCodeqInstallPackage && resultCode == Activity.RESULT_OK) {
if (packageManager.canRequestPackageInstalls()) {
canInstallPackage = true
}
} else {
canInstallPackage = false
Toast.makeText(mContext, "Auto update feature will not work", Toast.LENGTH_LONG)
.show()
}
}
Then when need to install update then-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
if(canInstallPackage){
doInstallAppProcess()
}else{
// generate error message
}
}
Hope it will help someone.

For anyone else having this issue the only time i ever got this error was when the API version in your Android Build configuration does not match what's on the physical device.
Go into Eclipse and right click on your project and go to properties. Select Android--WHICH BRINGS YOU TO ANDROID BUILD TARGET. Adjust you target to match the device and see if that resolves the issue.

I had this problem, even when I specified the correct minSDK and targetSDK version. My problem was, I was using "android:theme="#android:style/Theme.NoTitleBar.Fullscreen" in launcher activity, on Jellybean device. When I removed this attribute, it worked.

As a couple of the other answers have mentioned, there can be problems when installing from the SD card. In my case I was distributing my app via email attachment, and it usually worked fine. Just open the email and download the attachment (it apparently goes to the SD card) and click on it again and it gets installed.
But then one day it didn't work, and it turned out it was because I had the phone connected to my development PC via USB, and that placed the SD card in a different mode or something. So the solution was simply to disconnect the phone from the PC and then send the e-mail again and download the attachment again. Or else place the USB connection in "charging only" mode so the SD card is not "connected" to the PC.

You might also want to check the logs on the device to see if it's something simple like a permissions problem. You can check the logs using adb from a host/debug computer:
adb logcat
Or if you have access to the console (or when using Android-x86 get console by typing Alt+F1) then you can check the logs by using the logcat command:
logcat

I had the same problem using the apk file exported from android‌ Tools > Export. I used the apk file in bin folder instead and it worked!
P.S. apk file in bin folder is created after first time you run the application in eclipse.

In my case I signed with only V2 signature (from Android 7 onward) but tried to install on 5 and 6. Adding V1 during ARK generation/signing fixed the issue.
See Difference between signature versions - V1 (Jar Signature) and V2 (Full APK Signature) while generating a signed APK in Android Studio?.

In my case build 1 was installed correctly in my mobile using the signed APK (also from Google Play Store). But when I update the application with build 2 for first time, I had an issue installing it with the signed APK as I got "There was a problem parsing the package".
I tried several methods as specified above. But did not work.
After some time, I rerun the commands
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-key.keystore app-release-unsigned.apk myappkeyalias
zipalign -v 4 app-release-unsigned.apk MyApp.apk
and surprisingly, it worked.
It seems sometimes the APK built might be corrupt. So, Re-running jarsigner and zipalign commands resolved my issue.

use it inside build.gradle (Module:app)
minSdkVersion 14
targetSdkVersion 28
This error also comes when Android version is less than minSdkVersion

In my case i written
<activity android:".Stopwatch"/>
instead of
<activity android:name=".Stopwatch"/>
in android manifest.
Check your manifest and gradle file again.

Try this it works for me-
Changing the compileSdkVersion and targetSdkVersion to 31 or later will not let build the app on some devices, do the following thing-
In tags to be included with android:exported="true" or android:exported="false".

Install android studio version 2020.3.1 Canary 2
update AndroidManifest.xml
compileSdkVersion 30
targetSdkVersion 30
It will fix your issue for Android 12

I am experiencing the same “Parse error: There is a problem parsing the package “ error message with my signed APKs as others but I suspect it could be caused by different reasons.
To test this I did the following:
Setup
Windows 8.1
Eclipse
ADT Build: v22.6.2-1085508
I generated a typical new Helloworld app accepting all defaults.
I ran the app on an emulator and live device successfully.
I then sideloaded and installed the apk to my live device and ran it successfully.
It had generated an apk in the bin folder with a size of 782 KB.
I then exported the Helloworld app to the same bin folder signing the app from my key store which has been used successfully in the past to promote to Google Play.
It created an APK with a size of 385 KB (replacing the original apk).
I sideloaded the apk to my device and when I went to install it I got the error “Parse error: There is a problem parsing the package” (this is the same package that sideloaded and installed when done as a non exported form).

Related

Installation failed with message INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES. not able to install any application in a particular device [duplicate]

I tried to reinstall an apk
$adb install -r new.apk
And it shows the error:
Failure [INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES]
One solution is to uninstall and install the new.apk, that works fine.
But I'm wondering whether I could re-build an apk and re-install without the uninstallation. Eg. change some config in the AndroidManifest.xml, or not sign the APK, etc.
It would be great appreciated if you could tell me the whole meaning of the "INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES".
It means the new copy of your application (on your development machine) was signed with a different signing key than the old copy of your application (installed on the device/emulator). For example, if this is a device, you might have put the old copy on from a different development machine (e.g., some other developer's machine). Or, the old one is signed with your production key and the new one is signed with your debug key.
I ran into this while testing on a new Xoom. I had previously installed my app from the Marketplace. Later while trying to test a new version of the app I ran into this error.
I fixed it by removing the app that was installed via Marketplace (just hold and drag to the trash). Thereafter I was able to deploy my development version without any issue.
This happened to me when another developer on the team built our app on the hardware device I was trying to deploy to. Uninstalling the app from hardware fixed my problem.
This is the command to uninstall the app from device using adb:
adb uninstall <package name>
I got this error even after uninstalling the original APK, which was mystifying. Finally I realized that I had set up multiple users on my Nexus 7 for testing and that the app was still installed for one of the other users. Once I uninstalled it for all users the error went away.
I changed the package name while coding an update so that I could debug it on my device via Eclipse, without deleting the old version that was installed. Without reverting the package name I was using when trying to reinstall, I got this same error. Using the same package name the reinstall was successful.
Just delete the old build from the device and reinstall the same. Because device.keystore is already exist in the device so just uninstall the build and reinstall the APK thats all..
Thanks
I faced an another use case where I got the similar error.
When At first I got the error, I panicked, and removed /data/data/{package.name}
After that I tried, and my problem was still present.
Then I tried uninstall, it failed.
I then removed the apk file present in /system/app (required root access), and tried uninstall and it was successfull.
After that I tried re-installing the apk, it worked.
If you encounter a failed deployment to an Andorid device or emulator with the error "Failure [INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES]" in the Output Window, simply delete the existing app on the device or emulator and redeploy. Debug builds will use a debug certificate while Release builds will use your configured certificate. This error is simply letting you know that the certificate of the app installed on the device is different than the one you are attempting to install. In non-development (app store) scenarios, this can be indicator of a corrupted or otherwise modified app not safe to install on the device.
I had the same problem until I realised I had the simulator running and adb was trying to install on that
For what it is worth, I ran into this problem after adding a new plugin to my Cordova project. I had been having cordova do builds and install directly on the device via USB.
I fixed it by uninstalling the app from the device and on the next deploy there were no problems.
Nothing from above worked for me. The problem for me was that I had wrong source in my Java Build Path for android-support-v7-appcompat. When you go to Project> Build Path> Configure Build Path>. Under the Source tab make sure you have android-support-v7-appcompat/gen , android-support-v7-appcompat/libs and android-support-v7-appcompat/src and nothing else. Click OK and it should work.
I've had the same error today, but the problem wasn’t exactly the same. I’m using ADB with Android installed in VirtualBox. I tried to install different versions of my app (signed / not signed, debug / release mode) and got two errors alternatively : INSTALL_FAILED_UID_CHANGED and INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES.
Now, when looking at /data/data/{package.name}, I found a bunch of files that were still there after uninstalling the app. I tried to rm -rf them without success : I got I/O errors.
The solution to this was :
Shut down the VM
Mount the VDI image with vdfuse (read/write)
Repair the Partition1 image file with e2fsck
Umount and restart the VM
Since the verification is based on package's name, you can change the package name inside your config.xml or manifest file for another name you want.
When publishing your app don't forget to change back the name!
I had this problem trying to execute gradle task connectedDebugAndoidTest (or connectedAndroidTest) on Genymotion. Running it on normal emulator solved the problem.
I think , your app installed by other account.( multiple account mode feature ) You can uninstall app in Setting>Apps>"app name"> Uninstall

App not installed? [duplicate]

I have a program working in the Android Emulator. Every now and again I have been creating a signed .apk and exporting it to my HTC Desire to test. It has all been fine.
On my latest exported .apk I get the error message 'App not installed' when I try to install the .apk. It runs fine on the emulators.
As I have mainly been testing on the emulators and only every now and again exporting to a real phone I am not sure when this happened. What is the likely cause of it not installing on a physical phone but running fine in the emulators?
I have tried rebooting the phone & removing the existing .apk, does not fix the fault.
Primarily for older phones
I only encountered the App not installed error when trying to install an apk on my phone which runs on 4.4.2 aka KitKat, but my friend did not encounter this error on his phone which runs on 6+. I tried the other solutions such as removing the old/debug version of the app because the apk was a release version, clearing the debug app's data, and even clearing all of my cached data. Then, finally I realized all I had to do was select both signature versions when building my signed apk.
Before I only had V2 (Full APK Signature) selected, but after selecting V1 Jar Signature as well, I was able to successfully install my signed APK on my 4.4.2 device.
For me, On Android 9 (API 28), disabling Google Play Protect from play store app worked the trick, and i was able to get rid of the App not Installed error.
To disable Google Play Protect. Open "Play Store" application => tap
on Menu button => select "Play Protect" option => Disable the options
"Scan device for security threats".
I had a similar issue and it was because I was trying to install an apk on a phone with a previous version of the same apk, and both apks hadn't been signed with the same certificate. I mean when I used the same certificate I was able to overwrite the previous installation, but when I changed the certificate between versions, the installation was not possible. Are you using the same certificate?
Clearly there are many causes of this problem. For me the situation was this: I had deployed to my nexus 7 (actual device) from within the Android Studio (v1.3.2). All worked fine. I then created a signed apk and uploaded to my Google Drive. After disconnecting my nexus from the usb, I went to the settings/apps and uninstalled my app (App1). I then opened google drive and clicked on my App1.apk and chose to install it (need to ensure you have allowed installation of apks in settings). Then I got the dreaded message "App not Installed"
Solution for me: go back into settings/apps and scroll though all apps and at the bottom was a pale version of my App1 (note the original App1 was at the top in Alphabetical order which was deleted as above). When clicking on the pale version it said "Not installed for this user". (I had set up my nexus to have more than one user). But in the top right corner there is a three dot button. I pressed this and it said "Uninstall for all users". Which I did and it fixed the problem. I was now able to click on App1.apk and it installed fine without the error.
I faced the issue when I update my android from 2.3.2 to 3.0.1 . If this is the case the IDE will automatically considers the following points.
1.You cannot install an app with android:testOnly="true" by conventional means, such as from an Android file manager or from a download off of a Web site
2.Android Studio sets android:testOnly="true" on APKs that are run from
if you run your app directly connecting the device to your system, apk will install and run no problem.
if you sent this apk by copy from build out put and debug folder it will never install in the device.
Solution :go Build ---> Build APK(s) ---> copy the apk file share to your team
then your problem will solve.
In my case I had the declared my launcher activity as android:exported="false"
<activity android:name=".MainActivity"
android:exported="false">
I recently targeted android 12 and had to put android:exported attribute in my manifest components, but did not know what to put as the value. changing the value to android:exported="true" worked.
I faced with the same problem. The problem was the main activity in my AndroidManifest.xml file was written twice. I deleted the duplicate.
For those who are using Android Studio 3.
Suryanarayana Reddy's Answer is correct thought it doesn't state steps to solve it, hence.
in your AndroidManifest.xml under the application tag add testOnly="false" and android:debuggable="true" like so:
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme"
android:testOnly="false"
android:debuggable="true"
>
Edit then in AndroidStudio's menubar Build > Build APK(s)
This can happen if you have your MainActivity declared twice in your AndroidManifest.xml.
Another possible reason: you changed the launch activity. Hint: never do it with already published applications! Reasons discussed in Android Developers blog.
I had the same problem. I did not realise that an app must be signed even for testing.
After self signing it, it installed fine.
My problem was: I used the Debug Apk, that was generated while I did the Run command from Android Studio
Solution was: Instead of using this file, clean project and click Build > Build APK(s) from Android Studio. Then you can use the generated APK from the usual folder (app/build/outputs/apk/debug/)
The file that was generated like this installed without a problem.
I had the same problem and here is how solved it : Go to the Manifest file and make sure you have the "Debuggable" and the "Test Only" attributes set to false. It worked for me :)
I had the same issue, i.e. App showed up as being installed, but would not launched when the icon was tapped. After some head-banging, I found that I had stupidly placed ' android:exported="false" ' for my main launcher activity within the AndroidManifest file.... Once I removed it, the App launched fine..
I know this is an old post, but for new users may be useful. I had the same problem: my application worked fine while debbuging. When I signed the APK I got the same message: "Application not installed".
I fixed that uninstalled my JDK (I was using jdk-6u14-windows-x64) and installed a new one (jdk-6u29-windows-x64). After export and sign the APK again, everything was ok!
Resuming, my problem was in JAVA version. Thank's Oracle!!
My problem was that I have multiple user accounts on the device. I deleted the app on 1 account, but it still was installed on the other account. Thus the namespace collided and did not install. Uninstalling the app from all user fixed it for me.
I faced a similar issue today and at first i thought it was my sd card which corrupted it. I tried it on many devices running android 4.4 and up but it kept bringing the same issue.After some googling and research i realized that i didn't select the v1 jar signature which is for devices older than android 7.0 nougat so i applied both of these signatures by selecting the two check boxes and generated a signed apk and it worked.
Link to solution Android – App not installed error when installing a signed APK – How to Fix
Sideloading debug apps for testing on a physical phone worked reliably until I upgraded the phone from Android Pie to Android 10. After that, the "App not installed" error came up every time I tried to sideload the app.
Based on a warning in my AndroidManifest.xml, I changed from...
<application
android:name=".App"
android:allowBackup="true" ... />
to...
<application
android:name=".App"
android:allowBackup="false" ... />
After that, I was able to sideload my app -- once. Then, I encountered the same "App not installed" error again. By changing allowBackup back to true, it worked again (at least once).
It is obvious from the number of answers and the variation in the answers that there are many reasons for this problem. I'm sharing this in case it helps others.
If you have a previous version for that application try to erase it first, now my problem was solved by that method.
If application's not installing, delete the file .android_secure/smdl2tmpl.asec from the SD card.
If the folder .android_secure is empty in the file manager, delete it from the PC.
ARGHHHHH! I was trying to install as Unsigned Release APK when the proper setting was DEBUG SDK.
There goes an hour.
In the end I found out that no apps were being installed successfully, not just mine. I set the Install App default from SD card to Automatic. That fixed it.
create keystore file through command line
keytool -genkey -alias key_file_name.keystore -keyalg RSA -validity 1000000000000000 -keystore key_file_name.keystore
export apk through Eclipse, right click on Android project Android Tools > Export Signed Application Package, then give keystore location & password.
this will crate signed apk at the same time apk will be zipaligned. And installable.
If you go through command line for all, some times you may face "Application not installed" error.
(Application not installed error can happen not only, when using command line. It can be some other reasons as well)
Using Android Studio, I had previously installed the unsigned debug version of the APK (Build > Build APK) and had to uninstall it before installing the signed release version (Build Variants > Build Variant: release, Build > Generate Signed APK).
I have also solved this issue,
The problem was that i declared my main activity twice,
On as the first activity to load and i specified also an intent-filter for it
And once again below it i declared it again .
Just make sure you don't declare your activities twice .
My problem was similar to that of #Lunatikzx. Because of wrong permission tag which was written as attribute to application:
<application
android:permission="android.permission.WRITE_EXTERNAL_STORAGE"
android:label="#string/app_name"
android:icon="#drawable/ic_launcher"
android:testOnly="false"
android:debuggable="true">
What fixed it for me was changing permission tag to separate tag like this:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Apparently this can also be caused by renaming the APK prior to installing it. I wanted to reduce the amount of typing users had to do to get the app from our web site by shortening the file name. After that, they were unable to install it.
Once I reverted to the original file name used when creating and signing the package I was able to update the installed app.
In my case it was because I was using the alpha version of support library 28. Looks like Google marks these pre release versions as testOnly. If you really want to release like this (for instance, you want to push an internal beta like I did), you can add this line to your gradle.properties file:
android.injected.testOnly=false
Check with the Android version.
If you are installing non-market apps, and incompatible version you will get this error.
Ex: Application targetted to 2.3.4
Your device is 2.2
Then you will get this error.
The "Application not installed" error can also occur if the app has been installed to or moved to the SD card, and then the USB cable has been connected, causing the SD card to unmount.
Turning off USB storage or moving the app back to internal storage would fix the issue in this case.
I also encountered this issue.
Kindly try this solution. Make sure that the package name of your project is different from your previous project that was already installed in your mobile phone. I think they get conflict in their names. It works in me.

Install error when trying to update android application programmatically [duplicate]

I have a program working in the Android Emulator. Every now and again I have been creating a signed .apk and exporting it to my HTC Desire to test. It has all been fine.
On my latest exported .apk I get the error message 'App not installed' when I try to install the .apk. It runs fine on the emulators.
As I have mainly been testing on the emulators and only every now and again exporting to a real phone I am not sure when this happened. What is the likely cause of it not installing on a physical phone but running fine in the emulators?
I have tried rebooting the phone & removing the existing .apk, does not fix the fault.
Primarily for older phones
I only encountered the App not installed error when trying to install an apk on my phone which runs on 4.4.2 aka KitKat, but my friend did not encounter this error on his phone which runs on 6+. I tried the other solutions such as removing the old/debug version of the app because the apk was a release version, clearing the debug app's data, and even clearing all of my cached data. Then, finally I realized all I had to do was select both signature versions when building my signed apk.
Before I only had V2 (Full APK Signature) selected, but after selecting V1 Jar Signature as well, I was able to successfully install my signed APK on my 4.4.2 device.
For me, On Android 9 (API 28), disabling Google Play Protect from play store app worked the trick, and i was able to get rid of the App not Installed error.
To disable Google Play Protect. Open "Play Store" application => tap
on Menu button => select "Play Protect" option => Disable the options
"Scan device for security threats".
I had a similar issue and it was because I was trying to install an apk on a phone with a previous version of the same apk, and both apks hadn't been signed with the same certificate. I mean when I used the same certificate I was able to overwrite the previous installation, but when I changed the certificate between versions, the installation was not possible. Are you using the same certificate?
Clearly there are many causes of this problem. For me the situation was this: I had deployed to my nexus 7 (actual device) from within the Android Studio (v1.3.2). All worked fine. I then created a signed apk and uploaded to my Google Drive. After disconnecting my nexus from the usb, I went to the settings/apps and uninstalled my app (App1). I then opened google drive and clicked on my App1.apk and chose to install it (need to ensure you have allowed installation of apks in settings). Then I got the dreaded message "App not Installed"
Solution for me: go back into settings/apps and scroll though all apps and at the bottom was a pale version of my App1 (note the original App1 was at the top in Alphabetical order which was deleted as above). When clicking on the pale version it said "Not installed for this user". (I had set up my nexus to have more than one user). But in the top right corner there is a three dot button. I pressed this and it said "Uninstall for all users". Which I did and it fixed the problem. I was now able to click on App1.apk and it installed fine without the error.
I faced the issue when I update my android from 2.3.2 to 3.0.1 . If this is the case the IDE will automatically considers the following points.
1.You cannot install an app with android:testOnly="true" by conventional means, such as from an Android file manager or from a download off of a Web site
2.Android Studio sets android:testOnly="true" on APKs that are run from
if you run your app directly connecting the device to your system, apk will install and run no problem.
if you sent this apk by copy from build out put and debug folder it will never install in the device.
Solution :go Build ---> Build APK(s) ---> copy the apk file share to your team
then your problem will solve.
In my case I had the declared my launcher activity as android:exported="false"
<activity android:name=".MainActivity"
android:exported="false">
I recently targeted android 12 and had to put android:exported attribute in my manifest components, but did not know what to put as the value. changing the value to android:exported="true" worked.
I faced with the same problem. The problem was the main activity in my AndroidManifest.xml file was written twice. I deleted the duplicate.
For those who are using Android Studio 3.
Suryanarayana Reddy's Answer is correct thought it doesn't state steps to solve it, hence.
in your AndroidManifest.xml under the application tag add testOnly="false" and android:debuggable="true" like so:
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme"
android:testOnly="false"
android:debuggable="true"
>
Edit then in AndroidStudio's menubar Build > Build APK(s)
This can happen if you have your MainActivity declared twice in your AndroidManifest.xml.
Another possible reason: you changed the launch activity. Hint: never do it with already published applications! Reasons discussed in Android Developers blog.
I had the same problem. I did not realise that an app must be signed even for testing.
After self signing it, it installed fine.
My problem was: I used the Debug Apk, that was generated while I did the Run command from Android Studio
Solution was: Instead of using this file, clean project and click Build > Build APK(s) from Android Studio. Then you can use the generated APK from the usual folder (app/build/outputs/apk/debug/)
The file that was generated like this installed without a problem.
I had the same problem and here is how solved it : Go to the Manifest file and make sure you have the "Debuggable" and the "Test Only" attributes set to false. It worked for me :)
I had the same issue, i.e. App showed up as being installed, but would not launched when the icon was tapped. After some head-banging, I found that I had stupidly placed ' android:exported="false" ' for my main launcher activity within the AndroidManifest file.... Once I removed it, the App launched fine..
I know this is an old post, but for new users may be useful. I had the same problem: my application worked fine while debbuging. When I signed the APK I got the same message: "Application not installed".
I fixed that uninstalled my JDK (I was using jdk-6u14-windows-x64) and installed a new one (jdk-6u29-windows-x64). After export and sign the APK again, everything was ok!
Resuming, my problem was in JAVA version. Thank's Oracle!!
My problem was that I have multiple user accounts on the device. I deleted the app on 1 account, but it still was installed on the other account. Thus the namespace collided and did not install. Uninstalling the app from all user fixed it for me.
I faced a similar issue today and at first i thought it was my sd card which corrupted it. I tried it on many devices running android 4.4 and up but it kept bringing the same issue.After some googling and research i realized that i didn't select the v1 jar signature which is for devices older than android 7.0 nougat so i applied both of these signatures by selecting the two check boxes and generated a signed apk and it worked.
Link to solution Android – App not installed error when installing a signed APK – How to Fix
Sideloading debug apps for testing on a physical phone worked reliably until I upgraded the phone from Android Pie to Android 10. After that, the "App not installed" error came up every time I tried to sideload the app.
Based on a warning in my AndroidManifest.xml, I changed from...
<application
android:name=".App"
android:allowBackup="true" ... />
to...
<application
android:name=".App"
android:allowBackup="false" ... />
After that, I was able to sideload my app -- once. Then, I encountered the same "App not installed" error again. By changing allowBackup back to true, it worked again (at least once).
It is obvious from the number of answers and the variation in the answers that there are many reasons for this problem. I'm sharing this in case it helps others.
If you have a previous version for that application try to erase it first, now my problem was solved by that method.
If application's not installing, delete the file .android_secure/smdl2tmpl.asec from the SD card.
If the folder .android_secure is empty in the file manager, delete it from the PC.
ARGHHHHH! I was trying to install as Unsigned Release APK when the proper setting was DEBUG SDK.
There goes an hour.
In the end I found out that no apps were being installed successfully, not just mine. I set the Install App default from SD card to Automatic. That fixed it.
create keystore file through command line
keytool -genkey -alias key_file_name.keystore -keyalg RSA -validity 1000000000000000 -keystore key_file_name.keystore
export apk through Eclipse, right click on Android project Android Tools > Export Signed Application Package, then give keystore location & password.
this will crate signed apk at the same time apk will be zipaligned. And installable.
If you go through command line for all, some times you may face "Application not installed" error.
(Application not installed error can happen not only, when using command line. It can be some other reasons as well)
Using Android Studio, I had previously installed the unsigned debug version of the APK (Build > Build APK) and had to uninstall it before installing the signed release version (Build Variants > Build Variant: release, Build > Generate Signed APK).
I have also solved this issue,
The problem was that i declared my main activity twice,
On as the first activity to load and i specified also an intent-filter for it
And once again below it i declared it again .
Just make sure you don't declare your activities twice .
My problem was similar to that of #Lunatikzx. Because of wrong permission tag which was written as attribute to application:
<application
android:permission="android.permission.WRITE_EXTERNAL_STORAGE"
android:label="#string/app_name"
android:icon="#drawable/ic_launcher"
android:testOnly="false"
android:debuggable="true">
What fixed it for me was changing permission tag to separate tag like this:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Apparently this can also be caused by renaming the APK prior to installing it. I wanted to reduce the amount of typing users had to do to get the app from our web site by shortening the file name. After that, they were unable to install it.
Once I reverted to the original file name used when creating and signing the package I was able to update the installed app.
In my case it was because I was using the alpha version of support library 28. Looks like Google marks these pre release versions as testOnly. If you really want to release like this (for instance, you want to push an internal beta like I did), you can add this line to your gradle.properties file:
android.injected.testOnly=false
Check with the Android version.
If you are installing non-market apps, and incompatible version you will get this error.
Ex: Application targetted to 2.3.4
Your device is 2.2
Then you will get this error.
The "Application not installed" error can also occur if the app has been installed to or moved to the SD card, and then the USB cable has been connected, causing the SD card to unmount.
Turning off USB storage or moving the app back to internal storage would fix the issue in this case.
I also encountered this issue.
Kindly try this solution. Make sure that the package name of your project is different from your previous project that was already installed in your mobile phone. I think they get conflict in their names. It works in me.

'App not Installed' Error on Android

I have a program working in the Android Emulator. Every now and again I have been creating a signed .apk and exporting it to my HTC Desire to test. It has all been fine.
On my latest exported .apk I get the error message 'App not installed' when I try to install the .apk. It runs fine on the emulators.
As I have mainly been testing on the emulators and only every now and again exporting to a real phone I am not sure when this happened. What is the likely cause of it not installing on a physical phone but running fine in the emulators?
I have tried rebooting the phone & removing the existing .apk, does not fix the fault.
Primarily for older phones
I only encountered the App not installed error when trying to install an apk on my phone which runs on 4.4.2 aka KitKat, but my friend did not encounter this error on his phone which runs on 6+. I tried the other solutions such as removing the old/debug version of the app because the apk was a release version, clearing the debug app's data, and even clearing all of my cached data. Then, finally I realized all I had to do was select both signature versions when building my signed apk.
Before I only had V2 (Full APK Signature) selected, but after selecting V1 Jar Signature as well, I was able to successfully install my signed APK on my 4.4.2 device.
For me, On Android 9 (API 28), disabling Google Play Protect from play store app worked the trick, and i was able to get rid of the App not Installed error.
To disable Google Play Protect. Open "Play Store" application => tap
on Menu button => select "Play Protect" option => Disable the options
"Scan device for security threats".
I had a similar issue and it was because I was trying to install an apk on a phone with a previous version of the same apk, and both apks hadn't been signed with the same certificate. I mean when I used the same certificate I was able to overwrite the previous installation, but when I changed the certificate between versions, the installation was not possible. Are you using the same certificate?
Clearly there are many causes of this problem. For me the situation was this: I had deployed to my nexus 7 (actual device) from within the Android Studio (v1.3.2). All worked fine. I then created a signed apk and uploaded to my Google Drive. After disconnecting my nexus from the usb, I went to the settings/apps and uninstalled my app (App1). I then opened google drive and clicked on my App1.apk and chose to install it (need to ensure you have allowed installation of apks in settings). Then I got the dreaded message "App not Installed"
Solution for me: go back into settings/apps and scroll though all apps and at the bottom was a pale version of my App1 (note the original App1 was at the top in Alphabetical order which was deleted as above). When clicking on the pale version it said "Not installed for this user". (I had set up my nexus to have more than one user). But in the top right corner there is a three dot button. I pressed this and it said "Uninstall for all users". Which I did and it fixed the problem. I was now able to click on App1.apk and it installed fine without the error.
I faced the issue when I update my android from 2.3.2 to 3.0.1 . If this is the case the IDE will automatically considers the following points.
1.You cannot install an app with android:testOnly="true" by conventional means, such as from an Android file manager or from a download off of a Web site
2.Android Studio sets android:testOnly="true" on APKs that are run from
if you run your app directly connecting the device to your system, apk will install and run no problem.
if you sent this apk by copy from build out put and debug folder it will never install in the device.
Solution :go Build ---> Build APK(s) ---> copy the apk file share to your team
then your problem will solve.
In my case I had the declared my launcher activity as android:exported="false"
<activity android:name=".MainActivity"
android:exported="false">
I recently targeted android 12 and had to put android:exported attribute in my manifest components, but did not know what to put as the value. changing the value to android:exported="true" worked.
I faced with the same problem. The problem was the main activity in my AndroidManifest.xml file was written twice. I deleted the duplicate.
For those who are using Android Studio 3.
Suryanarayana Reddy's Answer is correct thought it doesn't state steps to solve it, hence.
in your AndroidManifest.xml under the application tag add testOnly="false" and android:debuggable="true" like so:
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme"
android:testOnly="false"
android:debuggable="true"
>
Edit then in AndroidStudio's menubar Build > Build APK(s)
This can happen if you have your MainActivity declared twice in your AndroidManifest.xml.
Another possible reason: you changed the launch activity. Hint: never do it with already published applications! Reasons discussed in Android Developers blog.
I had the same problem. I did not realise that an app must be signed even for testing.
After self signing it, it installed fine.
My problem was: I used the Debug Apk, that was generated while I did the Run command from Android Studio
Solution was: Instead of using this file, clean project and click Build > Build APK(s) from Android Studio. Then you can use the generated APK from the usual folder (app/build/outputs/apk/debug/)
The file that was generated like this installed without a problem.
I had the same problem and here is how solved it : Go to the Manifest file and make sure you have the "Debuggable" and the "Test Only" attributes set to false. It worked for me :)
I had the same issue, i.e. App showed up as being installed, but would not launched when the icon was tapped. After some head-banging, I found that I had stupidly placed ' android:exported="false" ' for my main launcher activity within the AndroidManifest file.... Once I removed it, the App launched fine..
I know this is an old post, but for new users may be useful. I had the same problem: my application worked fine while debbuging. When I signed the APK I got the same message: "Application not installed".
I fixed that uninstalled my JDK (I was using jdk-6u14-windows-x64) and installed a new one (jdk-6u29-windows-x64). After export and sign the APK again, everything was ok!
Resuming, my problem was in JAVA version. Thank's Oracle!!
My problem was that I have multiple user accounts on the device. I deleted the app on 1 account, but it still was installed on the other account. Thus the namespace collided and did not install. Uninstalling the app from all user fixed it for me.
I faced a similar issue today and at first i thought it was my sd card which corrupted it. I tried it on many devices running android 4.4 and up but it kept bringing the same issue.After some googling and research i realized that i didn't select the v1 jar signature which is for devices older than android 7.0 nougat so i applied both of these signatures by selecting the two check boxes and generated a signed apk and it worked.
Link to solution Android – App not installed error when installing a signed APK – How to Fix
Sideloading debug apps for testing on a physical phone worked reliably until I upgraded the phone from Android Pie to Android 10. After that, the "App not installed" error came up every time I tried to sideload the app.
Based on a warning in my AndroidManifest.xml, I changed from...
<application
android:name=".App"
android:allowBackup="true" ... />
to...
<application
android:name=".App"
android:allowBackup="false" ... />
After that, I was able to sideload my app -- once. Then, I encountered the same "App not installed" error again. By changing allowBackup back to true, it worked again (at least once).
It is obvious from the number of answers and the variation in the answers that there are many reasons for this problem. I'm sharing this in case it helps others.
If you have a previous version for that application try to erase it first, now my problem was solved by that method.
If application's not installing, delete the file .android_secure/smdl2tmpl.asec from the SD card.
If the folder .android_secure is empty in the file manager, delete it from the PC.
ARGHHHHH! I was trying to install as Unsigned Release APK when the proper setting was DEBUG SDK.
There goes an hour.
In the end I found out that no apps were being installed successfully, not just mine. I set the Install App default from SD card to Automatic. That fixed it.
create keystore file through command line
keytool -genkey -alias key_file_name.keystore -keyalg RSA -validity 1000000000000000 -keystore key_file_name.keystore
export apk through Eclipse, right click on Android project Android Tools > Export Signed Application Package, then give keystore location & password.
this will crate signed apk at the same time apk will be zipaligned. And installable.
If you go through command line for all, some times you may face "Application not installed" error.
(Application not installed error can happen not only, when using command line. It can be some other reasons as well)
Using Android Studio, I had previously installed the unsigned debug version of the APK (Build > Build APK) and had to uninstall it before installing the signed release version (Build Variants > Build Variant: release, Build > Generate Signed APK).
I have also solved this issue,
The problem was that i declared my main activity twice,
On as the first activity to load and i specified also an intent-filter for it
And once again below it i declared it again .
Just make sure you don't declare your activities twice .
My problem was similar to that of #Lunatikzx. Because of wrong permission tag which was written as attribute to application:
<application
android:permission="android.permission.WRITE_EXTERNAL_STORAGE"
android:label="#string/app_name"
android:icon="#drawable/ic_launcher"
android:testOnly="false"
android:debuggable="true">
What fixed it for me was changing permission tag to separate tag like this:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Apparently this can also be caused by renaming the APK prior to installing it. I wanted to reduce the amount of typing users had to do to get the app from our web site by shortening the file name. After that, they were unable to install it.
Once I reverted to the original file name used when creating and signing the package I was able to update the installed app.
In my case it was because I was using the alpha version of support library 28. Looks like Google marks these pre release versions as testOnly. If you really want to release like this (for instance, you want to push an internal beta like I did), you can add this line to your gradle.properties file:
android.injected.testOnly=false
Check with the Android version.
If you are installing non-market apps, and incompatible version you will get this error.
Ex: Application targetted to 2.3.4
Your device is 2.2
Then you will get this error.
The "Application not installed" error can also occur if the app has been installed to or moved to the SD card, and then the USB cable has been connected, causing the SD card to unmount.
Turning off USB storage or moving the app back to internal storage would fix the issue in this case.
I also encountered this issue.
Kindly try this solution. Make sure that the package name of your project is different from your previous project that was already installed in your mobile phone. I think they get conflict in their names. It works in me.

"Parse Error : There is a problem parsing the package" while installing Android application

I got this error while installing the android application (Parse Error : There is a problem parsing the package.). I did the following steps.
First time I installed the application and it works fine.
I made changes to the existing application and change the version no in Manifest file.
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.openintents.samples.BasicOpenARDemo" android:versionCode="2" android:versionName="1.0.1">
Then I export the application and finish the code signing process.
For this, Right Click your Project node > select Export. There you will see a wizard. Follow the steps and finish the code signing also.
I got the ARDemo.apk file, Then I changed it’s name to ARDemo1.apk
Then I shipped this apk file to mobiles SD Card and started the installation I got the above error.
I googled, they say that problem with unpacking manifest file.
Can anyone tell me what could be wrong with me?
You said that the first time you installed the application it worked fine.
The only difference in the steps you outlined between the two versions are:
The version number (I'm assume
that this did not participate in
breaking anything)
The code
The name of the .apk file
Try renaming the ARDemo1.apk file back to ARDemo.apk (make sure to back up the older version) and see if that helps. My guess is that it has something to do with the name of the apk.
If it still does not work, then you can eliminate the name of the apk file as the source of the problem and start investigating 2) by rebuilding your old version and see if you have same problem again. If the problem does not exists with the rebuilt version of your old code then you know it must be something to do with your code.
I hope that gets you somewhere.
Cheers,
Joseph
Installation can give the specified error at least in following cases:
Name of the package is changed after signing: Use the exact name as the signed package is (instead, adjust the name in Manifest)
Package is compiled against on higher API level: Correct the API level in Manifest file
Package is executed from SD-card: Run (install) the apk -file from phones memory OR use adb command to install it
I've only seen the parsing error when the android version on the device was lower than the version the app was compiled for. For example if the app is compiled for android OS v2.2 and your device only has android OS v2.1 you'd get a parse error when you try to install the app.
Instead of shooting in the dark, get the reason for this error by installing it via adb:
adb -s emulator-5555 install ~/path-to-your-apk/com.app.apk
Replace emulator-5555 with your device name. You can obtain a list using:
adb devices
Upon failing, it will give a reason. Common reasons and their fixes:
INSTALL_PARSE_FAILED_NO_CERTIFICATES: Reference
INSTALL_FAILED_UPDATE_INCOMPATIBLE: Reference
The reason is apk is not signed.
Once the apk is signed, the issue will be resolved.
http://ionicframework.com/docs/guide/publishing.html
Please use the link on instructions to sign the apk.
If you're compiling and exporting your apk file under SDK version 2.1, it will not work on any android version below your SDK export "2.1". Android software is forward compatible not backward compatible. For example if you're programming using the android NDK (ann add-on to the android SDK) package that allows development in the C/C++ family, this is only compatible with android 2.3, android version 2.2 and below support java builds only. Therefore you will reaceive the "There is a problem parsing the package" error.
Check whether your device supports the version you specified in minSdkVersion in AndroidManifest.xml . If not specify the lower version and try again
I'm not repeating what is instructed here to input the Key store, password, etc.
Try
Build -> Generate Signed APK -> [ Input ] ---Next---> select BOTH
V1 (Jar Signature)
V2 (Full APK Signature)
I don't know why, but at least it worked in my situation.
Another possibility is that you have saved the apk file into application PRIVATE folder and then try to install (by starting an intent from your code). in this case, when you start intent, you get error parsing package. In this case, the raised error is about permission issues. The point is saving the file into private folders is not a good practice, however if you really want to do that, you should write file in MODE_WORL_READABLE when you download it. Please consider that MODE_WORLD_READABLE is deprecated and this solution is not the best as it has some security issues. The best is to save your file in an external storage.
If you are facing this issue in device using android 12. You can fix it by adding android:exported="true" in AndroidManifest.xml as mentioned below
<activity
android:name=".MainActivity"
android:exported="true"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:label="#string/app_name"
I got the same error (Parse Error, There is a problem parsing the package) while trying to install an .apk package from email. I was able to get around the problem by installing the 3rd party package installer ApKatcher:
http://www.addictivetips.com/mobile/install-android-apps-from-gmail/
ApKatcher isn't the only solution. A colleague of mine got around the problem by installing Astro File Manager.
You can find both applications in the Android Marketplace.
Similar issue, using this "borrowed" and slightly modified code:
Intent intent = new Intent(Intent.ACTION_VIEW);
File newApk = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) + "myapp.apk");
intent.setDataAndType(Uri.fromFile(newApk), "application/vnd.android.package-archive");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
result = true;
Needed to change the file creation to this (comma instead of plus in the File constructor, was missing '/' after the download directory):
File newApk = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS), "myapp.apk");
I had a bad tag pair in my manifest file.
<meta-data>
</meta-data>
Basically got in when I copied a bad meta-data sample code from payu pdf file. Crap.
One reason could be, that your activity'name is not defined in the manifest
<activity
android:name=""
...>
</activity>
above code was creating the same issue with me
Another problem causing this error can be installing APK from restricted SD card mount point /mnt/media_rw/MicroSD.
Use unrestricted mount point /Removable/MicroSD.
And just to help possible new readers, another reason may be errors in the manifest file. I had mistyped android:service as android.service and ran into the same error...
As mentioned by #Veneet Reddy install it via ADB.
Go to ADT Bundle/sdk/platform-tools past your .apk file and run command prompt as administrator.
Then run adb devices command which will list the connected devices or emulators that are running.
Then run adb -s yourDeviceID install yourApk.apk
Note:
uninstall the app if you have already installed before installing again.
I have had this problem Parse Error : There is a problem parsing the package.
I was testing on Android-8. I have same apk with same signature .Everything was same without the version number and version name. App was installing when I install it manually but this error occurred when I was downloading and installing updates programmatically. Then I have found my cause of problem.
There was an option to check canRequestPackageInstalls ()
When this method returns true then app get installed successfully. It was returning false always in my case.
So first I check this and then let the user to download and install updates.
In onCreate()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
if (!packageManager.canRequestPackageInstalls()) {
startActivityForResult(
Intent(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES).setData(
Uri.parse(String.format("package:%s", packageName))
), requestCodeqInstallPackage
)
} else {
canInstallPackage = true
}
}
In onActivityResult()
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
if (requestCode == requestCodeqInstallPackage && resultCode == Activity.RESULT_OK) {
if (packageManager.canRequestPackageInstalls()) {
canInstallPackage = true
}
} else {
canInstallPackage = false
Toast.makeText(mContext, "Auto update feature will not work", Toast.LENGTH_LONG)
.show()
}
}
Then when need to install update then-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
if(canInstallPackage){
doInstallAppProcess()
}else{
// generate error message
}
}
Hope it will help someone.
For anyone else having this issue the only time i ever got this error was when the API version in your Android Build configuration does not match what's on the physical device.
Go into Eclipse and right click on your project and go to properties. Select Android--WHICH BRINGS YOU TO ANDROID BUILD TARGET. Adjust you target to match the device and see if that resolves the issue.
I had this problem, even when I specified the correct minSDK and targetSDK version. My problem was, I was using "android:theme="#android:style/Theme.NoTitleBar.Fullscreen" in launcher activity, on Jellybean device. When I removed this attribute, it worked.
As a couple of the other answers have mentioned, there can be problems when installing from the SD card. In my case I was distributing my app via email attachment, and it usually worked fine. Just open the email and download the attachment (it apparently goes to the SD card) and click on it again and it gets installed.
But then one day it didn't work, and it turned out it was because I had the phone connected to my development PC via USB, and that placed the SD card in a different mode or something. So the solution was simply to disconnect the phone from the PC and then send the e-mail again and download the attachment again. Or else place the USB connection in "charging only" mode so the SD card is not "connected" to the PC.
You might also want to check the logs on the device to see if it's something simple like a permissions problem. You can check the logs using adb from a host/debug computer:
adb logcat
Or if you have access to the console (or when using Android-x86 get console by typing Alt+F1) then you can check the logs by using the logcat command:
logcat
I had the same problem using the apk file exported from android‌ Tools > Export. I used the apk file in bin folder instead and it worked!
P.S. apk file in bin folder is created after first time you run the application in eclipse.
In my case I signed with only V2 signature (from Android 7 onward) but tried to install on 5 and 6. Adding V1 during ARK generation/signing fixed the issue.
See Difference between signature versions - V1 (Jar Signature) and V2 (Full APK Signature) while generating a signed APK in Android Studio?.
In my case build 1 was installed correctly in my mobile using the signed APK (also from Google Play Store). But when I update the application with build 2 for first time, I had an issue installing it with the signed APK as I got "There was a problem parsing the package".
I tried several methods as specified above. But did not work.
After some time, I rerun the commands
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-key.keystore app-release-unsigned.apk myappkeyalias
zipalign -v 4 app-release-unsigned.apk MyApp.apk
and surprisingly, it worked.
It seems sometimes the APK built might be corrupt. So, Re-running jarsigner and zipalign commands resolved my issue.
use it inside build.gradle (Module:app)
minSdkVersion 14
targetSdkVersion 28
This error also comes when Android version is less than minSdkVersion
In my case i written
<activity android:".Stopwatch"/>
instead of
<activity android:name=".Stopwatch"/>
in android manifest.
Check your manifest and gradle file again.
Try this it works for me-
Changing the compileSdkVersion and targetSdkVersion to 31 or later will not let build the app on some devices, do the following thing-
In tags to be included with android:exported="true" or android:exported="false".
Install android studio version 2020.3.1 Canary 2
update AndroidManifest.xml
compileSdkVersion 30
targetSdkVersion 30
It will fix your issue for Android 12
I am experiencing the same “Parse error: There is a problem parsing the package “ error message with my signed APKs as others but I suspect it could be caused by different reasons.
To test this I did the following:
Setup
Windows 8.1
Eclipse
ADT Build: v22.6.2-1085508
I generated a typical new Helloworld app accepting all defaults.
I ran the app on an emulator and live device successfully.
I then sideloaded and installed the apk to my live device and ran it successfully.
It had generated an apk in the bin folder with a size of 782 KB.
I then exported the Helloworld app to the same bin folder signing the app from my key store which has been used successfully in the past to promote to Google Play.
It created an APK with a size of 385 KB (replacing the original apk).
I sideloaded the apk to my device and when I went to install it I got the error “Parse error: There is a problem parsing the package” (this is the same package that sideloaded and installed when done as a non exported form).

Categories

Resources