Apk file is showing corrupted - android

I am including a share feature in my app to share the app via any intent.
But when it is installed on any other device, the following error pops up
"App not installed. The package appears to be corrupted."
How could I share my app?

Use Build>Build APK(s) to build the apk and install the apk directly and then share, it should work.
This is because, from Android Studio 3.0 onwards, the attribute testOnly is added to the merged manifest as android:testOnly="true".
This can be verified from Build>Analyze APK>AndroidManifest.xml.
More information can be found here

To solve this issue go to Build -> Build APK and get the location of apk and run that apk file.It will solve your issue.

Related

"The package appears to be corrupt" while installing APK on Galaxy S7

I made an Android project on Android Studio. When I ran it on test Android device which was plugged to my system using a USB cable, it ran successfully.
However, then I generated the APK and uploaded in Diawi website. When I tried to install this APK, I got following error:
App not installed.
The package appears to be corrupt.
APK file however is not corrupt at all since when I installed it manually after copying it from build folder, it was successfully installed on the Galaxy S7.
How to fix this issue?
In my case, I signed APK with V2 signature and it showed this error message. I tried signing the app only using V1 scheme and it worked.
As official docs say, if you have problem building APK using V2 scheme, you can skip and sign only using V1.
In Android Version May 25th-2019 I faced similar issue :
Build -> Build Apk(s) and then locate apk from build -> output -> apk -> debug
Solve my issue.
You could try avoiding put the names: com.example, com.android, etcc in your package, then Build>Rebuild and/or BuildGenerate signed APK and follow the steps. I hope help you!

Android Build and Installation error: INSTALL_PARSE_FAILED_NOT_APK

Have these erro when i'm trying to build the apk to some devices. Have no idea whats going on.
I get that when i build and install apk on device at the first time.
Someone have some tips for that?
[[EDIT]]
Well, after creating a debug key on keystore, i can build and deploy the apk via ADP to the device. But, dont know why, the error just return...
And now, we have other error:
UPDATE:
I Fix that issue removing all Android SDK and Android Studio and ReInstall it.
The problem can be solved by addding the install flags -r -t in the Run/Debug Configuration Dialog like it's showed in the given image
You can find Run/Debug Configuration Dialog location here according to Jetbrains.
UPDATE: Depending on the Android Studio version the Run/Debug Configuration position in the IDE can be slightly different, but always refer Jetbrains to find whatever you are looking for
When you've installed an APK from another source, Android Studio warns you before overwriting.
For example, if I've developed an application, uploaded it onto the Google Play Store, downloaded it, then try to re-deploy that same application from Android Studio, I'll get this warning.
It's trying to tell you that the way the package is signed is different; it's warning you that another app might be masquerading as the original.
The reason is you are trying to install the application with the same package name.
If you have already downloaded the same application from the play store /app market, then simply uninstall that application and RE-RUN.
This error can also occur if you recently switched branch which had different build variants declared in build.gradle file and you didn't perform gradle sync.
For example you had release and debug and then you switched to branch which has releas, deubg and staging variants; your project will still build but while installing apk this error can pop up.

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.

Xamarin Android release .apk error in visual studio 2015

I'm working with Xamarin Android and I want to export apk file in Visual Studio 2015. I use "Archive" feature in "Build" option on navigation bar of Visual Studio 2015. I exported apk file success but when I install it on device, it happens error
Parse Error : There is a problem parsing the package
Anyone can help me? Thanks!!!
This error can be caused by various reasons, but you can check a few things to make sure you have generated the correct apk file:
Please make sure you have signed the apk file. You can refer to Manually Signing the APK for details about signing an apk file.
Please check the CPU Architectures of your apk file.
If the error persists, please try use adb install apkFileName.apk to install the apk. The error message will be shown if the installation fails. You can find the adb under AndroidSDKFolder\platform-tools\adb.exe.

Android Studio is unable to install my APK

Error below
DELETE_FAILED_INTERNAL_ERROR
Error while Installing APK
Below which I have tried for solving this issues. All of these are not working.
I have tried changing the package name.
I have tried clean project.
I have tried manually delete the app on the device.
In order to run the apk on the device, I need to download the apk by copy and paste the apk to a folder in the device and install from there.
Other weird things are. Only happen one of my device. I can download the apk to another device just fine.
Any suggestion is welcomed. Thanks in advance.
The problem is on my xiaomi device, it auto update to new version, all of sudden the enable of install via USB required to sign in Mi account.
solution

Categories

Resources