debug APK to release APK without recompiling - android

I have been given an APK file from my mobile developers and I need to upload this to the store. It says, you need to compile it in release mode. Is there a way in which i can do that to the apk, get it to become in release mode and sign it with a key, without having to get the developers to actually re-compile?
If no, can I extract an apk file, put it in ant and recompile to release mode?

I don't believe you can do this without recompiling and resigning. You need to change the AndroidManifest and re-sign it using the same key as was used to upload it the first time if it was previously uploaded.

Related

Signed release version apk file location in New Android Studio 3.1.4

Currrently i am using android 3.1.4 and when i try to generate signed apk using Build->Generate signed apk the apk file stores in
/app/release/app-release.apk
And i also configured the build process to automatically sign your APK using Open Module Settings. plz refer here .
And according to this document the location is
/build/app/outputs/apk/app-release.apk
So which apk file is correct/perfect for the play store publication?
/build/app/outputs/apk/app-release.apk
Or
/app/release/app-release.apk
both the APKs have their specific concerns.
the apk generated using normal build can be found here,
/build/app/outputs/apk/app-release.apk
in general, if you're in the development phase then we do not have to generate every time keystore details and all the security details. cause, we just have to test the changes after bugs resolved. so, the best usage of the application found using normal build is to test and debug your app.
while, the apk generated using generate signed apk can be found here,
/app/release/app-release.apk
signed apk requires keystore and password details. so, it is used to upload for your final build. when, you're 100% sure that the application is as per your requirement, only then you should generate a signed apk.
so, the answer for your question is, It is recommended that you upload an apk, which is generated using "Generate Signed APK".
tl;dr = Both are correct
let me Explain how
There is three types of APK
An unsigned APK
A signed Apk = Unsigned APK + Signing certificate key
A debug Apk = Unsigned APK + Debug certificate key
The automatic build process generate the same APK as you manually generate, if you configured it to automatically sign your APK.
so
If we don't want to sign our APK again and again then we can configure to get signed apk every time we build and the generated APK will go into
/build/app/outputs/apk/app-release.apk
and if we use Generate Signed APK
then the default path. (path can be changed)
/app/release/app-release.apk
Even you can generate an unsigned APK and later sign it and release. its also the same
here is the official documentation where it showing how you can sign an unsigned apk
and the last line of this documentation clearly saying
An APK signed with your private key is ready for distribution
Generally developer's find Generate Signed APK manually is better because maybe you made a change and forgot to build/run your code and picked older app-release.apk so generating manually means you are 100% sure that this one is latest
but if you just build and pick auto created release file then it's also correct and latest one
/app/release/app-release.apk
would be the one you're looking for. I found myself in a similar situation not so long ago

Should i again generate "Signedapk" after made changes to code

For upload my application on google playstore. I have generated signedapk so my question is after made few changes in code of the app Shall i generate signed apk again ?
Yes.
You done some changes in your code.
if you want your changes generate apk.
There is no other way to do.
Yes it's mandatory to resign the APK whenever you want to regenerate the app, otherwise the application will not be updated if you are using Google Play
https://developer.android.com/studio/publish/app-signing.html
Definitely. before uploading application to the Play Store, you should always generate signed APK.
It would be better if you do it with ProGuard, it will provide security to your application.
There are several other things to taken care of while generating signed apk.
Proguard
Enable Minify
Shrink Resources
String Localization
Turn off Logging and Debugging
Delete unused files
Change Version Name and Version Code
Test your application throughout after doing all these things, there are chances that some things might not work after enabling Proguard and shrink resources. So its better to solve them and build apk again.
For more information, you can visit this link.
https://developer.android.com/studio/publish/app-signing.html

Changing Signatures in APK file Android studio

I recently made my first app in Android Studio and made it into an APK. Google play said I had the wrong signature for the APK but I don't know how to change the APK with different signatures nor revert the program back in order to manually change it inside Android Studio. Any help on this?
Here is step by step what I did to get to this point. I finished writing my program and went to "build" then "generate signed apks" where I went through the process of making the keys, key store etc. At this point everything is fine. I just need to somehow go back into the apk and either change the signatures of it or unpack the apk in studio and redo the process of generating signed apks.
You need to sign the apk with the same public-key certificate which you use in the previous uploaded apk. When you build the release apk via Build -> Generate Signed Apk.., you will be presented with the following dialog:
Then you must use the same certificate file (something like android.jks) for the Key store path.
The documentation says:
Every app must use the same certificate throughout its lifespan in
order for users to be able to install new versions as updates to the
app. For more about the benefits of using the same certificate for all
your apps throughout their lifespans, see Signing Considerations
below.
So, if you lose the certificate file, there is no way you can upload the apk with the same package name again. It will lose forever, gone. You also can't delete the published apk to reuse the same package name again.

Qt Android: Why is a QtApp-debug.apk created for a Release build?

I'm building my Qt/C++ Android application in Release build, however the following APK files are produced:
Release/android-build/bin/QtApp-debug.apk
Release/android-build/bin/QtApp-debug-unaligned.apk
I found this question which implies that the APK files are built in debug mode even for Release builds. The answers there imply that Release builds are possible only if you have a Certificate.
I followed the instructions there, and indeed after creating a Certificate, I get these files instead:
Release/android-build/bin/QtApp-release.apk
Release/android-build/bin/QtApp-release-unsigned.apk
Why do I need a Certificate to create a Release APK, and if there is no Certificate, is there a difference between Release build and Debug build, or do they both contain unoptimized code?
Edit: In light of the posted answer, I'd like to clarify that I'm asking why does not having a certificate necessitate for Qt Creator to compile C++ code with optimizations switched off and debug info added?
This seems to be a bug on the build process of Qt Creator. The C++ files are compiled as they should, according to the selected build configuration (with optimizations and no debug info on release mode). So no matter your APK is named QtApp-debug.apk, the binaries inside are compiled as you choose.
The problem comes when calling androiddeployqt. If you look at the source, it creates a release package if it receives --release or also when it receives --sign. Qt Creator never passes the --release, so it compiles files as it should, but androiddeployqt only generates a release APK when you use a certificate, because Qt Creator passes the --sign
What are the differences of androiddeployqt creating a debug package:
The package name
It includes a gdbserver binary (aprox 250 KB on arm-v7)
It call ant with 'debug' instead of 'release'. This is what makes your apk signed with a debug key
Not having a certificate is not turning off optimizations and adding debug info, it's just creating a debug package, with debug signature which is necessary if you don't add your own. So after all, maybe it's not a bug.
It may be an old question, but I have witnessed the same problem with Qt 5.12.3, a Release build produced debug APK in Release directory.
This happened because I didn't check on 'Signed' checkbox (and if you check it, you will be asked for password) when starting QtCreator. After providing password I got the usual android-build-release-signed.apk file.
The app needs a certificate to be able to publish to Google Play.
This certificate identifies the app and author, so you are able to update the app.
Important:
Don't lose the key you used to publish your app, otherwise you can't update it anymore.
You can sign your app both for release and debug mode, the Android SDK allows to sign it for debug, but you need your own key to sign for release. The release mode is the one that goes to Google Play.
There's good documentation about the publishing process for Android apps.
You can have a look to more detailed information here: http://developer.android.com/tools/publishing/preparing.html
and here: http://developer.android.com/tools/publishing/app-signing.html
Related to the difference between Release/Debug, I'm not sure, but my guess is that it'll be only related to Qt libraries, not to the Android native code generated in your build process, you can have a look at the size of the compiled versions for a better picture.

Unable to upload new APK file to Android Play store even though debug is off

I am trying to upload an APK to Google Play store. I have added android:debuggable="false" in the application tag of AndroidManifest.xml. But, still it says you need to disable debugging before it can be published in Google Play.
Update:
I am using debug.keystore for signing the APK. So, is it the reason for the issue ?
Should I create a different release.keystore ?
Yes you are right.
To Put your application on Google Play Store You have to generate release.keystore.
Please check the steps of how to generate keystore ::
Right click the project.
Go to Android Tools.
select Export Signed APK Package.
Enter Project Name.
Select create new key store option.
Set Location eg: Keystore Location.
At the end of this procedure you will have you build.apk and put that APK on Play Store that will work.
Make sure you're signing your application with the release key (not the debug key).
Yes, you need to use a release key, you can not upload to the play store if your app is signed with the debug key. See http://developer.android.com/tools/publishing/app-signing.html#releasemode for more info.
Remove all calls to the catlog in your code.
Look for BuildConfig.java in your source dir and see what it says for DEBUG.
If you're using Gradle/Android Studio be sure to select the release variant.
If you using Eclipse, disable auto-build, do a clean, then use the Export signed APK option in Android Tools.

Categories

Resources