Using Xamarin, I'm rebuilding an app (on Win10). After the build completes, I right click on the Archive link in the Solution list. A new version is created. Then I click on Distribute, then Ad Hoc. Then click Save As and the APK is saved. BUT sometimes it doesn't ask me for the password. Then I copy it to the Android Download folder. Then I go to the Android device and click on the file. Mostly, it installs, but now it says "App not installed as package appears invalid."
How to fix this or how to further diagnose it?
Thanks.
RON
apk won't be installed if isn't signed with any key, which is done in runtime during debug run, and when producing public APK you need to point on some keystore and enter its password
if you need to put some password when producing APK and this APK won't install only when your IDE didn't asked for this password - you probably produced not-signed-with-any-key APK. thats some problem in IDE, I can't help with that, but there are possibilities for "manual" signing APK and inspecting keys, which were used for signing APK (some referal)
I'd like to publicate my app to GooglePlay but first i would like to do a last testing with the signed apk to ensure that all of the used API keys are working correctly with the release version (GMaps, Facebook, etc)
So i just made a signed version of my app with our release key and when i try to install the app to the device i got an error:
I have tried to copy the apk to the device and install it with an apk installer app.
Strange thing is when i do the same process with debug signing key, all is well, I can install and run the app.
Here are the steps of the procedure:
I select the release key, type password.
I do select release build type instead of debugging
Just in case i also defined in the gradle file the signing keys but I must admit i dont know is it necessary.
I tried like 7 seven times now so i assume this problem is not just a
mistyped password, also I can make this work with the standard debug android signing key.
Please help if you can.
You may be using the android 5.0 or above device.
May be your development version is not uninstalled properly.
Try this,
Just go to the Settings --> Apps --> Click on your App. ---> In App info page at the action bar menu there will be an option called " Uninstall for All users " click that. Your app will be completely uninstalled and now you can try installing the new version with no issue. Hope this will help you
NOTE : This is for lollipop and above.
Refer the screenshot attached.
For Current Updated Android Studio 2.3 users this answer is for you as hardly people use eclipse nowadays for Android development as Android studio has huge advancements.
So, Follow this way to create your Signed apk file.
Build > Generate Signed apk.
Create Keystore path.
Put Password, alias, key password.
Build type select accordingly(eg to release in playstore use release).
Signature Version select both V1 and V2 checkboxes.
Finsih.
Go to from explorer where you selected for the apk to store and you will see your .apk file name as app-release.apk use it.
selecting Signature Version v1 and v2 both solved the problem for me....try it
The same thing happened to me, as long as I generated my apk from Build> Build APK. I could install and un-install the apk as many times as they were without any problem, but instead if I generated the Build> Generate Signed APK, when I passed the apk to the phone and try to install it, it only allowed me one occasion, the same one that came out the following message:
until then everything was fine if I selected "INSTALL IN ANY WAY", but what happened if I uninstalled the app and wanted to reinstall it (a possible scenario), the following happened:
so I solved the problem by disabling play protect, which I achieved (within Google Play)> Menu> Play Protect> Search for security threats (disable).
"App not installed" shows when an app with same package already installed in same device. just delete your first application which you were using for testing purpose before making it to signed apk. This will work. cheers!
Select both Signature Version v1 and v2 will resolve the issue
v1 scheme
A JAR file can be signed by using the command line jarsigner tool or
directly through the java.security API. Every file entry, including
non-signature related files in the META-INF directory, will be signed
if the JAR file is signed by the jarsigner tool. For every file entry
signed in the signed JAR file, an individual manifest entry is created
for it as long as it does not already exist in the manifest
V2 scheme
v1 signatures do not protect some parts of the APK, such as ZIP
metadata. The APK verifier needs to process lots of untrusted (not yet
verified) data structures and then discard data not covered by the
signatures. This offers a sizeable attack surface. Moreover, the APK
verifier must uncompress all compressed entries, consuming more time
and memory. To address these issues, Android 7.0 introduced APK
Signature Scheme v2
By default, Android Studio 2.2 and the Android Plugin for Gradle 2.2 sign your app using both APK Signature Scheme v2 and the traditional signing scheme, which uses JAR signing.
It is recommended to use APK Signature Scheme v2 but is not mandatory.
please see the details
In Android Studio 3.0 and Above
As described here
Note: The Run button builds an APK with testOnly="true", which means the APK can only be installed via adb (which Android Studio uses). If you want a debuggable APK that people can install without adb, select your debug variant and click Build Bundle(s) / APK(s) > Build APK(s).
Add android:testOnly="false" inside Application tag in AndroidManifest.xml
Reference: https://commonsware.com/blog/2017/10/31/android-studio-3p0-flag-test-only.html
Above shubham soni answer works for me,actually it happens to android version >=5.0.In above you able to install just use this while creating your apk...
Here I resolved this issue
The reason behind this issue is, there is already an application with the same package name in the phone, but you cannot find it in phone menu(U already made the un-installation but actually its still in your phone).
To see the application go to phones SETTINGS -> APPS.
There you can see the application, but inside that the UNINSTALL button may be disabled. click on the menu overflow button to see Uninstall for all users.
After performed uninstalled for all users I have successfully installed my signed apk.
You can also use adb to uninstall the app from phone.
adb uninstall package name
In addition to this,
if your mobile supports multiple users then check if respective app is not installed for other users. If it is installed for others then first uninstall previous app and try again
I faced the same issue today, I remembered that I signed my apk with the "new" Google Play signing:
Make sure if you signed your application with Google Play signing.
If you did:
Upload your apk to Google Console (like you
usually would when updating your application):
After it has successfully uploaded, open the Artifact library in the menu.
You will see the apk you have just uploaded.
Press the download button and select Download derived APK.
You will now be able to install the apk.
You can delete the draft after have downloaded the apk without having to update your application to the Google Play Store
minifyEnabled false
is the only that worked for me after 3 days of research on all forum!
Android Studio 4.1.1
If you want to create the debug apk, and just before creating the apk you tried running on your phone/simulator (doing create signed apk right away will cause the APP NOT INSTALLED),YOU SHOULD CLEAN THE PROJECT before creating signed bundle/apk
It's quite old question, but my solution was to change versionCode (increase) in build.gradle
Go To Build.Gradle(module:app)
use this - minifyEnabled false
That may because you run APK file from external SD card storage.
Just copy APK file into internal storagem problem will be solved
This can happen due to your choice of the signature version. On some phones, installation errors occur if the signature version was selected as V2. So if that happens, try selecting V1, it will surely work.
Removing android:testOnly="true" attribute from the AndroidManifest.xml worked.
link
I am using Android 10 in MiA2. The mistake I was making is that I tried to install the app via ES Explorer. I tried Settings -> Apps & Notifications -> Advanced -> Special App Access -> Install Unknown Apps -> ES File Manage -> Allow from this source. Even then the app won't install.
Then I tired to install the app using the default File Manager and it installed easily.
The checked answer is for rooted devices, or at least it doesn't work for me.
I found a way that you can simply solve the problem by uninstall your apk from adb by using adb uninstall app.package.name (make sure that Debug app is installed on your phone)
then try to install signed apk. Hope this helps you guys.
I was facing the same issue with my android application.
I just updated a library and then created a signed APK. Now it's working.
if Your Android Studio Version Greater than 3.0
Looks like we can not directly use the apk after running on the device from the build -->output->apk folder.
After upgrading to android studio 3.0 you need to go to Build -> Build Apk(s) then copy the apk from build -> output -> apk -> debug
File > Project Structure > Build Variants > Select release > Make sure 'Signing Config' is not empty > if it is select from the drop window the $signingConfigs.release
I did this with Android Studio 3.1.4 and it allowed me to create a release apk after following all the steps above of creating the release apk and release key and adding the info to the app gradle. Cheers!
You don't have to uninstall the Google Play version if App Signing by Google Play is enabled for your app, follow the steps:
1. Make a signed version of your app with your release key
2. Go to Google Play Developer console
3. Create a closed track release (alpha or beta release) with the new signed version of your app
4. You can now download the apk signed by App Signing by Google Play, choose derived APK
Install the downloaded derived APK
The reason is App Signing by Google Play signs release apps with different keys, if you have an app installed from Play Store, and you want to test the new release version app (generated from Android Studio) in your phone, "App not installed" happens since the old version and the new version were signed by two different keys: one with App Signing by Google Play and one with your key.
Kindly uninstall the debug app in the device or just increase the version code to overcome this issues
In my case I was trying to test installing a signed APK and the current installed version on my device was unsigned (building a debug version directly from Android studio)
I tried a lot of things and the following combination worked
Clean, Rebuild
Generating a new key. I used a new key alias that had not been used before. Also, for all the passwords, I used only alphabets and numbers without any spaces or special characters
To uninstall any apk, version etc from the device, I connected my device via usb and ran the command
gradlew uninstallAll
The signed release and debug apk worked
(Note: The debug and release configurations had)
minifyEnabled false
shrinkResources false
versionCode and versionName must be greater than preview version in app level build.gradle file.
I have an apk that runs perfectly fine on emulator and on real devices, however this is an unsigned APK. When releasing to the android store you need a signed apk, I have tried in eclipse doing:
Project->Android Tools->Export Signed Application Pacakge
Then I go through the whole wizard create my keystore and everything else and get a signed APK when it is done, however this APK crashes on startup on all devices I have tested. Normally I would look in the console and see what is breaking / not working but when you go through the eclipse wizard the console does not change.
Is there a different way to do this? what could be happening in the signing process that causes it to crash on startup? Thanks for any info.
Edit
I found the answer to my issue so if anyone else has this problem this is what worked for me. I was using ANT to build my APK, if you go to Project->android Tools->Export Signed package etc it does NOT use ant, any program did not work, to fix this drag the build.xml icon to the top right ANT corner, this brings up a list of ANT functions, then run BUILD apk rather then DEBUG APK (the default) after this you get an unsigned apk, you can then sign it and align it and it works great#!
This happened to me a lot in Eclipse when i had many different libraries and dependencies in my project.
Try to disable Project/Build Automatically before you are exporting your apk.
NB: dont forget to turn Build automatically back on after the export.
I have created a signed .apk file and I've followed all of the steps (Created Keystore,Password and validity yrs,etc...) and I have an .apk file.
When I install this to any mobile device, it shows the installation failed, so I checked the apk file.
It contains only
META-INF Folder
classes.dex.
I'm unable to find the other files. This is the first time I'm facing this issue.
Does anyone know what may cause this?
Installing a production release over a debug release and vice versa will cause a failed installation.
Uninstall the current version first.
Keystore signed versions can be installed on top of each other.
Debug signed versions can be installed on top of each other.
Debug and Keystore versions cannot be installed on top of each other.
i solved the issue.....some privilege issue...if i do the same thing as a super user in the same system everything works fine(Generated APK).
Thanks friends
* EDIT 1 *
Of course, just after I posted i tried to uninstall the app, and then reinstall it from APK. Then it worked. Maybe its the fact that I usually install it from Eclipse that is the bad thing here? Testing
/EDIT
So I am having the problem that my fine APK-files wont install om my device.
I found another who had the same problem, and solved it by self-signing:
unsigned APK can not be installed
However, I always tried with a signed APK. In Eclipse, I choose "Export" and then I have to first choose and "log in to" my keystore, then choose a key and again supply my password, and then choose the location for the file, and press "Finish".
This is the last "page" in the wizard:
After I copy that APK-file to my device, and then "run it" from the file explorer, the Install-screen shows upp and looks OK. First I get the "Replace application"-screen, asking me if I want to replace the existing version. I press "OK". Then it asks me if I want to allow the application to ... yada yada. I press "Install". After a brief message saying "Installing" I get the message:
Application not installed
with a green "check" to the left of it.
No other error messages.
I have checked the box "Unknown sources". I might add that there are no problems when I launch the same app from Eclipse!
Any tips and ideas would be appreciated.
If the two .apks have different signatures (Eclipse uses a debug certificate), you will not be able to install/update with the new .apk without removing the previous one.
You can find more information about this here.
The problem seems to be that I first installed the app via Eclipse (launching/debugging from Eclipse).
When the app was installed that way, and I then tried to reinstall from APK, it didn't work.
However, if I completely uninstalled the app first, then reinstalled from APK-file the installation was successful. It was also possible to reinstall (with an updated APK) after that!
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 resolved my problem.
Try to not install your application via Eclipse. If you want to avoid situation when after update you have message "Application is not installed". Install application. Install only using export as apk options.
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)
You can run into this problem if you sign your APK on a machine running JDK 7. Downgrading to JDK 6 fixes the problem.