How to get the updated Apk file from the android studio.? - android

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

Related

Can't install my app on Devices using the APK file

I recently made an android app. It worked just fine on both my development devices when installed from Android Studio but when I sent the GDrive links or the APK files to my friends for testing, "App not Installed" error showed up.
What's worse, I can't even install the APK directly even on my devices without installing it from android studio.
Why is this happening?
Please help.
You should build a debug APK. For this follow this
From Android studio above menu select Build -> Build Bundles(s) / APK(s) -> Build APK(s)
Then wait some time. After build success, you will find your APk here
\app\build\outputs\apk\debug\app-debug.apk
Then share this APK and IT will work fine.
You need to create keystore and then use option Build->Generate signed apk. Not signed apk is not installable.

Android Studio: How to separate Run APK & Build APK

When I run an APK from Android studio it generates a partial apk in the build folder. When I click on Build APK, it generates the full apk in the same folder. They overwrite each other. I need to separate the output so that if I just hit on Run, the apk will have its own "run" folder, and when I build the apk, it would not be overwritten by Run APK. If this is possible, can someone guide me through the setup? Probably a config in gradle, or in Studio itself? Thank you very much!
When you run the app from android studio and create a build apk its the same thing so it overwrites the apk. It builds the app-debug.apk file. I think you are trying to create a app-release apk. You need to create an apk using generate signed apk for this. It will seperate the debug and release apk in two folders as debug and release.

Unable to upgrade to a Dynatrace enabled apk

I have used the auto-instrumentor command on my Android apk file.
auto-instrumentor.cmd apk <apk file> prop <APK-Instr.properties>
It generated three new files:
unsigned
signed
final
Now I am able to use my app when I do a fresh install.
But if I try to upgrade an earlier build to this Dynatrace enabled version, it always gives me a message
App Not Installed.
If you are not using the original certificates to sign the apk you will not be able to install the instrumented app over the already existing once. The only option you have is to uninstall the original app and install the instrumented app.
If you have the original certificates you need to take the following steps:
take the unsigned apk and instrument the apk
sign the apk
zip align the apk
For more information please take a look at the Android Auto-Instrumentation documentation

Getting error Installation failed after generating Signed APK

I Generated signed APK because I wanted to release my app but after generating signed APK, the app wont run on the emulator."app-release.apk is not signed. Please configure the signing information for the selected flavor using the project structure dialog."
To resolve this error, I did what it told me to do. I went to project structure>signing and added signing info (called config). Then i added this config info to build Types and Flavors. Gradle synced successfully and I was able to run my app in emulator.However, when emulator starts, I see a dialog box in my android studio saying *************"Installation failed because device already has an application with the same package but a different signature".****************** Also, I noticed that any changes that I did to my app after running the "Generate Signed APK" wizard are not reflected in the app. I cleaned the project and restarted android studio but same results.
**I am attaching a screenshot of the error that i am getting
what you have is you have different builds for production and debug i guess or more if you want to install you production apk you have to uninstall the app from your emulator as one device can't install the two apps with same package names,uninstall the apk installed in the emulator and then generate a signed apk with whatever configuration you are generating then this apk will be installed in your emulator
You have installed the app previous to the export. Exporting your apk signs it differently than the debug build. Do what the error says and uninstall and reinstall.

Release version of *.apk in Android Studio

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.

Categories

Resources