I'm having trouble uploading my .apk to Google Play Store. I've previously been able to upload multiple different builds up to last week, but today I get the error that I should zipalign my file first.
EDIT: Normally, I was able to generate signed and zipaligned .apk's that the AppStore accepted by just using Android Studios built-in "Generate Signed APK" wizard. This did not work today, and led to the following:
I've tried the following:
Manual zipalign of the app-release.apk generated by Android studio. When I try this, I get the error "VERIFICATION FAILED" at the end. Some googling says that providing full path to a location where you have write-access is important, so I've tried doing it with the specific path, but to no avail:
./zipalign -v -f 4 /Users/<username>/git/<projectname>/app/app-release.apk /Users/<username>/git/<projectname>/app/aligned.apk
I then tried to download the APK Signer 1.8.5 and use that to zipalign the .apk - and behold, success! It creates an aligned apk, and i'm able to verify it using both Android Studio's own zipalign tool by
./zipalign -c -v 4 app-release_ALIGNED.apk
and the APK Signer itself. However, when uploading I now get the error:
Failed to run aapt dump badging:
W/ResourceType(208730): Bad resource table: header size 0x80a3 or total size 0x80b50000 is larger than data size 0x7bcc4
ERROR: dump failed because the resource table is invalid/corrupt.
This, I haven't been able to find solutions for.
I then tried to recreate the circumstances I was previously able to upload APKs from by reverting to a previous commit/build, as well as reverting from AS 2.2 preview 3 to AS2.2 preview 2, but again - no luck.
Finally, I tried explicitly adding
zipAlignEnabled true
to my release config in Gradle, but that didn't help either.
I'm out of suggestions, and hoping someone can help? :-) Thanks
Finally, eureka!
I randomly stumbled upon this line in my root build.gradle:
classpath 'com.android.tools.build:gradle:2.2.0-alpha3'
Android Studio 2.2 preview 3 requires this gradle build tool upgrade, and I had just pressed "sure, go ahead" as always. I got curious, and tried to change it back to what had worked last,
classpath 'com.android.tools.build:gradle:2.2.0-alpha2'
and built the project in Android Studio preview 2 instead - and voila, it worked! It seems there is a bug with the alpha3 build.
I hope this helps someone. I know I'm a happy friday-camper, that's for sure! :-)
Note to self: Don't rely on canary-builds for production apps in the future, no matter how much my friends and collegues push.
Here are the things that I faced a few days ago: Try them one at a time:
After downloading Android Studio 2.2 Preview 2 - which was released during the IO conference, I ran my code successfully until when time came to release a newer version of the apk to the playstore. That was when hell broke loose!
I searched all over but I got nothing. So, someone suggested the following approach: After generating your signed apk, unzip it and delete META-INF folder then re-package it and manually sign it through the terminal. Packaging a file into .apk format is simple: just use a zip extension then rename the extension.
Although that seemed like it could have worked for me, it didn't. It worked for others though.
Finally, I realized that it was caused by a bug in the latest Android Studio Preview 2.
Thankfully, I still had my stable 2.1 version which I opened, loaded my project and Boom! It worked like I expected it to.
So, please try the last option, clean up your project first then try again. I know how frustrating this can be. Good luck!
Related
This may seem like a duplicate question, as there are 4 or 5 other exact questions. But I have tried the solutions to every other question like this with no luck.
Basically, I've been successfully generating signed APKs for weeks now, but out of the blue 3 days ago the signed APK is not being generated. Simply nothing gets generated, even though Android Studio says that it has successfully generated it.
I am using Android Studio 3.0.
I have tried totally uninstalling/reinstalling AS, I've made sure that both APK option checkboxes are checked during the signed APK generation dialog window.
I have many times restarted Android Studio and my computer, as well as cleaning/rebuilding many times. I do not know what to do from here.
I really need to get an update of my app out to Google Play but I cannot generate the new APK.
The apk is probably being generated but not on the path you expect. Look around the project subdirectories or search for apk using your operating system search tools.
I too faced the same issue, what you need to do is after migrating a project to Android studio 3.0, delete the already generated signed apk in path /project/app and generate the signed apk again, you will see a release folder in the same directory.
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.
Last friday I created some builds from my app from within Android Studio by simply clicking Build > Build APK. That created 4 files:
app-debug-unaligned.apk
app-debug.apk
app-release-unaligned.apk
app-release.apk
I then uploaded app-release.apk to the play store, which worked perfectly well (is is public now).
Today I wanted to do the same, but today I only get the files
app-debug-unaligned.apk
app-debug.apk
As you can see in the screenshot below the release APKs are from last friday ("maart" == "March" and "Vandaag" == "Today"), and I have never done any signed APK stuff:
On this SO-topic (from 2013, so pretty old) I read that you need to run Generate Signed Apk, create new key store paths, and more trouble. In the meantime I did remove the .idea/ folder (because that solved "APK path is not specified for module" error), but I wouldn't know why that would change anything.
So my main question is: how can it be that I could create an app-release.apk last friday, but today not anymore? And most importantly; how can I build the app-release.apkagain?
All tips are welcome!
Just to add some print screens of where are the features discussed in the comments. This following screens consider the Android Studio (IntelliJ IDEA) 2.0 Beta 6. It might serve as reference for other people not finding it.
The first one is Build > Generate Signed APK ... and the Build Variants dock opened.
Second one shows where the build variants dock is hidden.
I am attempting to run my app in an emulator and have been receiving the following error:
Installation failed since the APK was either not signed, or signed incorrectly.
If this is a Gradle-based project, then make sure the signing configuration is specified in the Gradle build script.
I am attempting to run the app with a debug setting so signing the app should not be necessary as it will be given a temporary signature upon building.
This happens often when you install the same app generated on a different computer. Even the unsigned apk has a signature, so your phone is confused why you're trying to install something with the same package name that was generated on a different computer.
Go to your settings -> apps, then find the app in the list, and clear its data and uninstall it.
Then try installing again. That'll fix it.
This problem can be resolved by below two ways
Change Built Variant to debug
Define your application`s signingConfigs
First solution works when you built your application in debug mode. But, once you are ready to publish your application on Google Play store you need to go by second way.
Read for more -> Sign Your App
Hope this will help one and all!
I had this same problem occur last night. Running in debug, in my case the app had previously been installed from weeks ago, and I had deleted it, but I was still getting the error and couldn't install it again. I was able to resolve it by going into the AVD manager and wiping user data from there. After that installation and debugging went fine.
There may be already install current app with certificate
uninstall it and try again
I solved it more or less following the answer of Alex K above, but did not know where to look for 'settings' (total beginner!).
So go to the AVD manager (icon of mobile in toolbar) and click on the arrow on the far right, a small menu appears and here you select 'Wipe Data'.
You do need to first close the emulator.
What I tried:
Clean Project and Build again
Invalidate cache (File -> Invalidate Caches/Restart ...)
Reinstalled Debug certificate in case it expired
Cleared Gradle cache
Add signing process to Gradle
Went to settings -> apps in the Emulator and deleted previous versions (as explained in this thread)
Wiping Emulator data through AVD interface
Upgraded gradle version
None of those solved the issue.
In the end I executed the compilation/signing steps manually until I found the culprid: One of the file in my asset folder was 'Icon?' generated by MacOSX
In order to detect it I followed the instructions here to Build an unsigned APK and sign it manually:
https://developer.android.com/studio/publish/app-signing#sign-manually
When I ran step 3 (apksigner) I got an exception with message cannot sign apk because of file ..\folder\folder\Icon?
I understand that what was happening is that Android Studio did not capture the exception and tried to deploy the unsigned application onto the emulator.
Once I removed the file and tried again I no longer had the issue.
(quite a pain to find the root cause...)
So, step 1:
Run the standard check (clear cache..)
IF you have a MacOSX, check if one or multiple of your file is 'Icon?'
Step 2 - run the steps manually
If you still get this error in debug mode, follow these steps:
Clean your project
Run it again
This works for me on Android 2.2 Beta.
Using eclipse to generate Android app.
All of a sudden when I export a project - I get an apk file that's not valid.
e.g. missing AndroidManifest.xml and res folder.
It was working a few days ago and I didn't make any config changes.
When I test it in an emulator - the correct apk file is generated in the bin folder -
albeit without certificate signing etc.
A really hackish workaround is to go to Eclipse->Preferences->Android->Build and change the debug key to the cert you want to sign with. The downside is it's still built in debug mode. Eclipse can easily drive a good man insane trying to troubleshoot it. You might consider upgrading/reinstalling your version of Eclipse and/or reinstalling/upgrading to the latest ADT plugin.
If you don't have time to battle Eclipse, use the command line:
http://developer.android.com/tools/building/building-cmdline.html
How to compile APK from command line?