I have uploaded my app to Goggle Play few months back after signing it with a release keystore, I have stored that Keystore for future updation. Now I have updated the apk with some changes, while trying to upload the new apk signed with same keystore along with same alias and password, the apk is not allowed to upload to Goggle Play.
Playstore shows me following error :
The only change is, earlier the appication was developed and build using eclipse and now in android studio Can this be the reason for showing the above error???
From the error message I would say you have mixed up the keystores, or android studio is just using the wrong one to do the release build. The best way to be completely sure is to clearly setup your build.gradle, and build it yourself on the command line using
./gradlew clean assembleRelease
What is probably happening is that Android Studio is using your debug keystore (ie. the default) to sign the release build because it can't find the original keystore you used in eclipse, or you have the wrong password somewhere...
Have a look at this configuration, note the location of the keystores, the naming convention and how it corresponds to the build.gradle. Note the signingconfigs and how they are setup for the release build. To build from the command line, simply cd into the directory with your "gradlew" file, and run
./gradlew clean assembleRelease
to build the release apk, or
./gradlew clean assembleDebug
to build the debug apk. If it fails, try
./gradlew clean assembleRelease --stacktrace
Screenshot of build.gradle and filesystem setup
But please remember not to put your keys in your source control! That means editing your .gitignore file.
There is a stack of information on how to do this here:
http://developer.android.com/tools/publishing/app-signing.html
Related
I'm not 100% certain this is possible, but I have set up a gradle task that tags my git repo with info about the build, which runs when I generate my signed apk just before releasing. I generate the apk using the Android Studio Build -> Generate signed bundle/apk menu option (mainly because it has all my keystore info in it and it's easy to do).
However, when I sometimes test the release build of my app, rather than the debug build, and I run it on my phone plugged in, just by clicking the green 'play' triangle button, it also tags the current git head with the same info.
Is there any gradle task that runs purely when I do the Generate signed bundle/apk menu option? I don't know of anyway of finding it out.
I feel like the only task there might be is some sort of signing task. Unless when i test on my device, it's also signing the apk, in which case...how? I'm 99% certain i don't have my keystore password anywhere so it couldn't use it...could it?
EDIT It appears I do use a plain text file called keystore.properties which has all my keystore details in it (I made it over 2yrs ago so forgot all about it!), so this must be being used for the release build. So in fact is there no diff between me testing my release build (and the apk it generates) and running Build -> Generate apk?
Thanks
I am developing an android application. All the things is going well when I run the application into genymotion virtual device.And Since the apk is stored in F:...\app\build\outputs\apk location. So I just want to collect it from this location and download it to install in a android phone.As I simultaneously updating the application with code but this apk doesn't provide me the updated apk file according to the updated code .They just give me the old apk file even if i run my application again and again from the android studio. Can anyone suggest me why this is happening ??? I just want to run this apk into phone or download this apk file for another purpose.
This three steps will do Go build->Build apk
Go to Build > Build APK to generate a normal APK.
Go to Build > Generate Signed APK to generate signed APK.
Signed APK are those which we generate to release our application. Here it is, why is it necessary to generate signed APKs: Why should I Sign my Application APK before release
If you build a debug APK, it will still work on all devices but you cannot release it.
From terminal run the following command to make sure that you get the updated apk.
1. gradle clean (from windows )
-or-
./gradlew clean (from linux) -
Above command deletes the build folder.
2. gradle build (from windows)
-or-
./gradlew build(from linux)
Above command builds all the flavor for your application.
Edit: Original answer
Signed apk is needed to install in any other non debug device. This will be same as the debug app that runs in your test device/emulator.
Build -> Generate signed apk
I have just finished and signed the apk through android studio,
then I have did an apk protect through apkprotect.com
when I am trying to upload the apk to play store I got this error " You uploaded an APK that is not zip aligned. You will need to run a zip align tool on your APK and upload it again. "
if I upload the original apk I got no errors,
I have tried to add zipalign true in the build.gradle but nothing happened
I have tried also disable and enable proguard .
You can run zipalign manually in command line:
zipalign [-f] [-v] <alignment> infile.apk outfile.apk
Note that zipalign is located inside ${sdk.dir}\tools
For more details visit zipalign
[Update]
Also, If you need to sign it you can run:
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore YOURKEYSTORE unsigned.apk alias_name
(jarsigner is located inside java JDK_HOME/bin)
I got the same "You uploaded an APK that is not zip aligned... blah, blah" error when by mistake I tried to upload a DEBUG version of my .apk file to Google Play. It's a bit misleading error because the real problem is that you cannot distribute a debug version which additionally is not signed with your Google Android Developer key. (You can only upload an .apk compiled as release version, and it must be signed, which happens in the same step, at least if you're using Eclipse).
Make sure you distribute an .apk file which is your Signed Release version, as described here:
http://developer.android.com/tools/publishing/app-signing.html#releasecompile
This question and its answers are old; so we expect things to change. As of today, the zipalign tool is in the ANDROID_HOME directory under build-tools/[version]/ so my path is currently:
/android-sdk/build-tools/22.0.0/zipalign
Using the zipalign tool is not necessarily the answer here though, what you actually need to do is sign your apk.
Steps if using Xamarin for VS2017:
Build project
Right click and Archive project
Use Ad Hoc distribution channel
Sign your APK with your Signing Identity and Save As to produce an APK that is ZIP aligned.
Your APK can be uploaded to Google Play.
I was using Cordova, uploaded a signed APK but still got this error.
The ziptool is what helped me, it's located at ~AndroidSDK\build-tools\24.0.0\zipalign.exe
So for example :
"~\AndroidSDK\build-tools\24.0.0\zipalign.exe" -f -v 4 android-release-signed.apk android-release-signed-zipaligned.apk
I was using Cordova and the command line getting this error. I opened the project in Android Studio and used Android Studio to build the signed apk and the error went away.
When using the Cordova node.js CLI without going through Android Studio, it is necessary to update the PATH environmental variable to include the android build tools:
%ANDROID_HOME%\build-tools\29.0.2
Obviously the version number will change over time. Remember to close any CLI windows and re-open them to recognize the newly added path.
I want to submite an application to Google Market. I found there is only one apk file generated in a project, its path is Project1Project/Project1/build/apk/Project1-debug-unaligned.apk
It looks like it's a debug version. Where do I find (if any) a release version of an application or how do I generate it?
Since Android Studio is based on IntelliJ, that's how to do it in IntelliJ:
Build -> Generate Signed APK
and provide it with your key and its password.
You can build an unsigned release version. See the answer here. I don't see an easy way to do it from the GUI, but you can use the shell command:
./gradlew assembleRelease
Make sure to cd to your project's directory before running the command. This will produce the file
Project1Project/Project1/build/apk/Project1-release-unaligned.apk
If you run ./gradlew assemble, both the release and debug version will be built.
More documentation here.
From Android Studio 1.3.1, the ready-to-publish apk location is :
app -> app-release.apk
This should be published to Google Play
Intermediate apks are at :
app -> build -> outputs -> apk -> app-release-unaligned.apk
This is Intermediate result of Signing process, should not be published to Google Play
Android gradle produces apk in two binaries: Unaligned and Aligned. Unaligned refers to how the data, files are structured within the APK file. A utility called zipalign modifies the APK to align data in a way that is optimized for users. Unaligned simply skips the zipalign stage.
Whereas an Aligned APK is an optimized version. The files are more structured and compressed, which helps the app run faster. They are also optimized for RAM usage so they can consume less RAM on the devices.
you will also see size difference in the APK generated.
How to build and package the android project with Ant.
I want to build and package a android project automatic with Ant,not the Eclipse.
Someone give me some examples or some Ant build files.
Assuming you are inside the root folder of your project, execute from a terminal/shell/console/command prompt:
android update project -p .
This will generate the necessary files, including build.xml. Modify it for your requirements, or leave it as it is for standard build behaviour.
To create a debug build, execute:
ant debug
Or swap out debug for release for a release build. Note that you will need to provide details to the release key in order to complete the signing process (keystore location, keystore password, key alias and key password). If you don't, you will end up with an unsigned apk that you'll have to manually sign using the appropriate key.
I prefer to do a clean with most builds as well, so the command I issue with every release build looks like:
ant clean release
References:
Managing Projects from the Command Line
Building and Running