eclipse android apk invalid - android

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?

Related

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.

Android Studio release build not zipaligning

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!

Eclipse's export wizard not generating proper apk(complete size)

My application's debug apk(one in bin folder) size is 25.8 MB, I'm not using proGaurd as of now, I have multiple libraries such as Facebook, Twitter, Google play services, Vuforia, and few other graphics related jars. So my problem is when I'm generating release version apk using export wizard I'm not getting correct apk file size. Everytime I generate apk for release version the size is different( like 19MB, 21MB, 23MB ,22MB,25MB). When I install this apk on device it is crashing. I have 8GB of RAM, I cleaned project before starting process, closed all running applications except eclipse , I also run CC cleaner and started eclipse from cmd prompt with 'eclipse-clean' command but still I wasn't successful to generate correct apk.
Any suggestions to solve my problems will be appreciated.

Android Studio Signed APK: Error SystemDependentName Must Not Be Null

My apologies, I am quite new to app development! After downloading an open source Android Project, and importing it into Android Studio version 1.0.2, with JRE 1.7.0_75 on a W7 64 bit machine.
I get the following error when attempting to build the signed apk:
Error: Argument 0 for #NotNull parameter of com/intellij/openapi/util/io/FileUtil.toSystemDependentName must not be null"
After much research, I cannot find anything referencing the above. I'm not quite sure where to proceed as I cant seem to find anything out of place or not configured properly in the project or Android Studio. The project builds fine, and I can generate an unsigned apk without issue. The problem only resides in trying to make a signed apk.
Thanks again for any input, I appreciate it!
It seems that this error has to do with the name of the key I made when generating a signed apk. I decided to try it all again (without changing any of the code anywhere) and go for the build a signed apk wizard.
What I did differently: used hyphens instead of spaces in all the fields.
Magically, a signed, production ready apk was generated!

signed apk from git shared source is crashing on bogus claims of missing classes

I am working on an android project. The project is shared through git. Each time I need to create a signed apk it's a hassle. The apk gets created but when I try to use the app, some file is always missing. Then I try disconnecting my local copy from the git sharing, then reconnecting, then rebasing, etc. Then it would create a good apk that works with no crash for supposed missing classes. (Note: the classes aren't really missing. They are classes I personally create inside the project)
My problem is, every time I need to create a signed apk, I have to emotionally gear up for a battle. And I have not figured out a repeatable process that is guaranteed to give me a good apk.
I only have this problem when exporting a signed apk. If I simply connect the device and build the code, that version of the app works. But that is not an exported apk, as it is using the debug key.
Does anyone know how to get exported apk to work with my git setup?
MORE DETAILS:
I am using
ADT eclipse
Egit

Categories

Resources