Does IntelliJ IDEA publish an Android app with one click? - android

On Android developer's page (http://developer.android.com/guide/publishing/app-signing.html) there is a tutorial on publishing which says that an app has to be compiled as an unsigned app, a private key must be generated with keytool then signed with jarsigner.
How do we create an unsigned app with IntelliJ?
Alternatively, can we do all these steps via Tools->Android->Export Signed Android Package?
Thanks in advance!

New IDEA versions have an option to generate unsigned APK in the Android Facet settings, Compiler tab:
However you don't need to do that if you use the Export Signed Android Package feature:
Tools | Android | Export Signed Android Package will generate the release version of your application signed with the release key and ready for Market.
You can also create a batch file that will sign the unsigned APK and configure it as an External Tool in IDEA so that you can generate it in one click or via keyboard shortcut (if you are OK with a batch file containing your keystore passwords in open text).
I use such script to generate the signed APK, upload it to a phone and start the main Activity to perform application testing, it has the following sequence of actions:
jarsigner
zipalign
adb install
adb start
EDIT 2013/2/8: The option to export a Signed APK is now under Top Menu > Build > Generate Signed APK (IntelliJ IDEA 12)
IDEA 12 has even better way to do it via artifact, configured like this:
Then use Build | Build Artifacts when you need to make a release version.

Well you could modify the ant scripts slightly and have one target which builds a final signed APK. So that technically could be a one click build. Not sure about publishing, you may be restricted to using the web interface to upload and publish the app.
I wrote a tutorial on publish, it might be worth a read as I cover some of the building final releases and such

Related

Cannot install signed apk to device manually, got error "App not installed"

I'd like to publicate my app to GooglePlay but first i would like to do a last testing with the signed apk to ensure that all of the used API keys are working correctly with the release version (GMaps, Facebook, etc)
So i just made a signed version of my app with our release key and when i try to install the app to the device i got an error:
I have tried to copy the apk to the device and install it with an apk installer app.
Strange thing is when i do the same process with debug signing key, all is well, I can install and run the app.
Here are the steps of the procedure:
I select the release key, type password.
I do select release build type instead of debugging
Just in case i also defined in the gradle file the signing keys but I must admit i dont know is it necessary.
I tried like 7 seven times now so i assume this problem is not just a
mistyped password, also I can make this work with the standard debug android signing key.
Please help if you can.
You may be using the android 5.0 or above device.
May be your development version is not uninstalled properly.
Try this,
Just go to the Settings --> Apps --> Click on your App. ---> In App info page at the action bar menu there will be an option called " Uninstall for All users " click that. Your app will be completely uninstalled and now you can try installing the new version with no issue. Hope this will help you
NOTE : This is for lollipop and above.
Refer the screenshot attached.
For Current Updated Android Studio 2.3 users this answer is for you as hardly people use eclipse nowadays for Android development as Android studio has huge advancements.
So, Follow this way to create your Signed apk file.
Build > Generate Signed apk.
Create Keystore path.
Put Password, alias, key password.
Build type select accordingly(eg to release in playstore use release).
Signature Version select both V1 and V2 checkboxes.
Finsih.
Go to from explorer where you selected for the apk to store and you will see your .apk file name as app-release.apk use it.
selecting Signature Version v1 and v2 both solved the problem for me....try it
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 try to install it, it only allowed me one occasion, the same one that came out 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).
"App not installed" shows when an app with same package already installed in same device. just delete your first application which you were using for testing purpose before making it to signed apk. This will work. cheers!
Select both Signature Version v1 and v2 will resolve the issue
v1 scheme
A JAR file can be signed by using the command line jarsigner tool or
directly through the java.security API. Every file entry, including
non-signature related files in the META-INF directory, will be signed
if the JAR file is signed by the jarsigner tool. For every file entry
signed in the signed JAR file, an individual manifest entry is created
for it as long as it does not already exist in the manifest
V2 scheme
v1 signatures do not protect some parts of the APK, such as ZIP
metadata. The APK verifier needs to process lots of untrusted (not yet
verified) data structures and then discard data not covered by the
signatures. This offers a sizeable attack surface. Moreover, the APK
verifier must uncompress all compressed entries, consuming more time
and memory. To address these issues, Android 7.0 introduced APK
Signature Scheme v2
By default, Android Studio 2.2 and the Android Plugin for Gradle 2.2 sign your app using both APK Signature Scheme v2 and the traditional signing scheme, which uses JAR signing.
It is recommended to use APK Signature Scheme v2 but is not mandatory.
please see the details
In Android Studio 3.0 and Above
As described here
Note: The Run button builds an APK with testOnly="true", which means the APK can only be installed via adb (which Android Studio uses). If you want a debuggable APK that people can install without adb, select your debug variant and click Build Bundle(s) / APK(s) > Build APK(s).
Add android:testOnly="false" inside Application tag in AndroidManifest.xml
Reference: https://commonsware.com/blog/2017/10/31/android-studio-3p0-flag-test-only.html
Above shubham soni answer works for me,actually it happens to android version >=5.0.In above you able to install just use this while creating your apk...
Here I resolved this issue
The reason behind this issue is, there is already an application with the same package name in the phone, but you cannot find it in phone menu(U already made the un-installation but actually its still in your phone).
To see the application go to phones SETTINGS -> APPS.
There you can see the application, but inside that the UNINSTALL button may be disabled. click on the menu overflow button to see Uninstall for all users.
After performed uninstalled for all users I have successfully installed my signed apk.
You can also use adb to uninstall the app from phone.
adb uninstall package name
In addition to this,
if your mobile supports multiple users then check if respective app is not installed for other users. If it is installed for others then first uninstall previous app and try again
I faced the same issue today, I remembered that I signed my apk with the "new" Google Play signing:
Make sure if you signed your application with Google Play signing.
If you did:
Upload your apk to Google Console (like you
usually would when updating your application):
After it has successfully uploaded, open the Artifact library in the menu.
You will see the apk you have just uploaded.
Press the download button and select Download derived APK.
You will now be able to install the apk.
You can delete the draft after have downloaded the apk without having to update your application to the Google Play Store
minifyEnabled false
is the only that worked for me after 3 days of research on all forum!
Android Studio 4.1.1
If you want to create the debug apk, and just before creating the apk you tried running on your phone/simulator (doing create signed apk right away will cause the APP NOT INSTALLED),YOU SHOULD CLEAN THE PROJECT before creating signed bundle/apk
It's quite old question, but my solution was to change versionCode (increase) in build.gradle
Go To Build.Gradle(module:app)
use this - minifyEnabled false
That may because you run APK file from external SD card storage.
Just copy APK file into internal storagem problem will be solved
This can happen due to your choice of the signature version. On some phones, installation errors occur if the signature version was selected as V2. So if that happens, try selecting V1, it will surely work.
Removing android:testOnly="true" attribute from the AndroidManifest.xml worked.
link
I am using Android 10 in MiA2. The mistake I was making is that I tried to install the app via ES Explorer. I tried Settings -> Apps & Notifications -> Advanced -> Special App Access -> Install Unknown Apps -> ES File Manage -> Allow from this source. Even then the app won't install.
Then I tired to install the app using the default File Manager and it installed easily.
The checked answer is for rooted devices, or at least it doesn't work for me.
I found a way that you can simply solve the problem by uninstall your apk from adb by using adb uninstall app.package.name (make sure that Debug app is installed on your phone)
then try to install signed apk. Hope this helps you guys.
I was facing the same issue with my android application.
I just updated a library and then created a signed APK. Now it's working.
if Your Android Studio Version Greater than 3.0
Looks like we can not directly use the apk after running on the device from the build -->output->apk folder.
After upgrading to android studio 3.0 you need to go to Build -> Build Apk(s) then copy the apk from build -> output -> apk -> debug
File > Project Structure > Build Variants > Select release > Make sure 'Signing Config' is not empty > if it is select from the drop window the $signingConfigs.release
I did this with Android Studio 3.1.4 and it allowed me to create a release apk after following all the steps above of creating the release apk and release key and adding the info to the app gradle. Cheers!
You don't have to uninstall the Google Play version if App Signing by Google Play is enabled for your app, follow the steps:
1. Make a signed version of your app with your release key
2. Go to Google Play Developer console
3. Create a closed track release (alpha or beta release) with the new signed version of your app
4. You can now download the apk signed by App Signing by Google Play, choose derived APK
Install the downloaded derived APK
The reason is App Signing by Google Play signs release apps with different keys, if you have an app installed from Play Store, and you want to test the new release version app (generated from Android Studio) in your phone, "App not installed" happens since the old version and the new version were signed by two different keys: one with App Signing by Google Play and one with your key.
Kindly uninstall the debug app in the device or just increase the version code to overcome this issues
In my case I was trying to test installing a signed APK and the current installed version on my device was unsigned (building a debug version directly from Android studio)
I tried a lot of things and the following combination worked
Clean, Rebuild
Generating a new key. I used a new key alias that had not been used before. Also, for all the passwords, I used only alphabets and numbers without any spaces or special characters
To uninstall any apk, version etc from the device, I connected my device via usb and ran the command
gradlew uninstallAll
The signed release and debug apk worked
(Note: The debug and release configurations had)
minifyEnabled false
shrinkResources false
versionCode and versionName must be greater than preview version in app level build.gradle file.

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

How do I sign an Android APK which was built with PhoneGap Build?

PhoneGap Build seems like a great tool and I've build an .apk with it and tested it on multiple Android devices.
Now I need to submit it to the Google Play store but I need to sign the apk.
I've read all about signing an .apk on Google's developer site but it seems that I need to install the Android development tools and use Eclipse. I've installed it but I can't find a way to import my .apk so I'm stuck.
I don't get it - what is the point of PhoneGap Build then?
This is all very disheartening. The app is ready to go but...
This was the solution.
I got the Android dev kit - http://developer.android.com/sdk/index.html
From there I used this video to get KeyTool: http://www.youtube.com/watch?v=IaXE2FUENFI
From there I could create a KeyStore. Make sure you keep a record of the Alias and Password (I wrote them down and did not store them on any electronic device) and the location of the keystore.
When you are in PhoneGap Build and you pull files from GitHub (which is the way I'm doing it) after the build is done you'll see there is a dropdown. Select "add a key" and upload your keystore.
Note: The keystore will usually be locked. You have to unlock it in order to build with it. It only stays unlocked for one hour.
You PhoneGap Build apk will now be appended with -release instead of the usual -debug.
It's now ready for uploading to Google Play!
Go Build! :)
I have never used PhoneGap or signed an apk, but I found this on the phonegap.com website:
https://build.phonegap.com/docs/config-signing-android
Sounds like you can just add your signing key (How to get one) to your phonegap account and when a release build of your app is made with the PhoneGap Build they sign it.
You need to provide Title, Alias and a Keystore File to PhoneGap Build.
Generate a private key using keytool (comes with the Java SDK - so no Eclipse required)
On your next PhoneGap Build be sure to enter the Information under Options>Add a key
PhoneGap Build takes care of the rest.
As far as the keytool goes, someone else gave a short & sweet description of how to...

Automatic APK signing when running ADT projects

I'm used to develop and debug android apps on my phone, it's pretty faster.
When I'm ok, I export a signed APK to upload to the market.
Now I use Google Maps APIs, I must add a signature to the Manifest, this signature is associated with my key I use to sign APKs for release. So I am able to export a signed APK to test on my phone, but it's not automated and I cannot view LogCat anymore.
Can I just instruct ADT+Eclipse to auto-sign the APK before uploading it to my attached phone?
Am I missing a point?
I don't think you can do this via ADT directly. But you could use ant to build instead which supports signing (http://developer.android.com/tools/building/building-cmdline.html).
Just set the key.store, key.alias, and key.store.password, key.alias.password properties in the ant.properties file.
You can also trigger ant builds from within eclipse and add a new ant target to install/launch the app on your device

android export signed vs unsigned application

I have multiple developers working on a project. When they just run the program and then manually get the APK, our testers have to uninstall and re-install for each different developer that publishes the APK (something about debugging key). So I am wondering, what if I make them all use android tools> export unsigned application package? will that solve the problem?
You should create a new debug keystore for your team and check it in to our project repository. Then have each of them open Eclipse > Preferences > Android > Build and change the "default debug keystore" value to point to this new keystore. That way they all use the same debug keystore and you dont have to worry about signing debug builds yourself.
By default eclipse signs it with the default key which is different for different systems and on any android device if you try to reinstall it without first uninstalling it treats it as an update and it requires the update to be signed with the same key with which installed application is signed so follow what Karakuri suggested and it should solve your problem.

Categories

Resources