Install APK generated by Android Studio

3

I'm doing an App from Android Studio and I gave it to try to download the application and install it on my cell phone even if it is not yet finished. So I went to Build > Generate Signed APK , I generated the JAR file and then I created my APK. Up there without problems.

But when I'm going to install my App on my cell phone, it says it can not.

My cell phone has an API 19 and in the Gradle the min SDK version is 15.

It's already solved, when I do Build > Generate Signed APK. I get an app-release.apk file. But when I simply do Build & Build; Build APK. I got an app-debug.apk file. And that if I can install it. If someone could explain the difference -

    
asked by Fernando Godoy 11.03.2017 в 04:46
source

5 answers

7

Go to File > Build APK, once the apk is generated, a message like this will appear

das click on "show in explorer", copy the apk to your phone and you can install it without problems.

    
answered by 11.03.2017 / 19:38
source
3
  

So I went to Build > Generate Signed APK, I generated the JAR file   and then I create my APK.

Although .jar and .apk are compressed files of a package, the file suitable for installation is the one with extension .apk

  

But when I'm going to install my App on my cell phone, it tells me that I do not know   can.

You do not specify in what form you try to install it, if it is not by means of the ADB and you install it by means of a download of the .apk you must ensure that your device allows installations of "unknown sources" ("unknown sources").

  

My cell phone has an API 19 and in the Gradle the min SDK version is 15.

" This is not a problem, on the contrary, your API is greater than the minimum defined version, which is 15.

  

It's already solved, when I do Build > Generate Signed APK. it is generated   an app-release.apk file. But when I simply do Build> Build   APK. I got an app-debug.apk file. And that if I can install it.

Both an application generated with a production Keystore and one generated with debug can be installed on a device, if this allows installation of "unknown origin" and something important is to ensure that you do not have a version of the application since it will not allow to overwrite it because it has the same versionCode .

.APK RELEASE

If you generate the .apk by:

Build > Generate Signed APK

The generated .apk would be signed with a keystore that is supposed to be for production, which was previously created for this purpose. This .apk would be considered the right one to upload to the Google Play Store.

.APK DEBUG

If you generate the .apk by:

Build APK

A signed .apk would be generated with the debug keystore, which is usually found in the route:

:\users\<usuario>\.android\debug.keystore

Even if you do not generate your .apk with the previous options, with the simple fact of generating your project and uploading it to the device, a .apk is created which you can use for installation and it is in the route:

   <proyecto>\app\builds\outputs\apk\
    
answered by 14.03.2017 в 06:20
2

If you could install the debug APK without problems, but the APK release did not allow you (the message Application not installed appeared), I solved it in the following way:

I went to Build / Generate Signed APK ...

As you probably already did, in the KeyStore Path you will see the key generated previously. You leave it like this, and put the passwords that you put the first time you generated the Signed APK.

And in the next, TILDAS BOTH "V1 (Jar Signature)" and "V2 (Full APK Signature)", and you hit Finish.

The first time I created it, I only had V2 marked with tilde and I had the same problem. I marked both options, I generated the APK Release again, and I could install it.

And if it's the first time you generate the APK Release, simply check both options when they appear.

    
answered by 19.10.2017 в 20:33
1

The same thing happened to me, as long as I generated my apk from Build> Build APK. I could install and un-install the apk as many times as they were without any problem, but instead if I generated the Build > Generate Signed APK, when I passed the apk to the phone and tried to install it, it only allowed me one occasion, the same one in which I got the following message:

until then everything was fine if I selected "INSTALL IN ANY WAY", but what happened if I uninstalled the app and wanted to reinstall it (a possible scenario), the following happened:

so I solved the problem by disabling play protect , which I achieved (within Google Play) > Menu > Play Protect > Search for security threats (disable).

    
answered by 30.10.2018 в 23:53
0
  • You do not have to generate APK to test it on your cell phone.
  • The difference is: release (compiled to publish) debug (compiled from test). The debug can not be uploaded to Google Play.
  • If you want to try your App (in development) on your cell phone do the following:
  • Activate developer mode on your phone (they also call it developer mode or programmer).
  • Connect your cell phone to your PC via USB cable.
  • Probably a notification appears on your cell phone in which you must allow "administration through that PC."
  • Open Android Studio (and wait for Gradle to finish his work)
  • Run (run) your application from android studio.
  • Instead of choosing an emulator, choose your cell phone
  • Android Studio will install the app on your cell phone every time you run it (run).
  • answered by 13.03.2017 в 17:29