How can I package my Android app into an .apk? - android

I need to email a coworker my android app as an .apk so that he can install & test it on his Samsung Galaxy Tab.
How can I do this?

You shouldn't distribute apk files that have not been signed. Here are the official instructions.

This can be done from the command line using something like:
$ cd project
$ android update project --path .
$ ant release
This requires:
The Android SDK installed and the tools sub-directory in the path.
Ant installed and in the path.
The result will be written into the bin sub-directory as 'project-release.apk'.

Follow this question's answers to obtain the .apk itself: How to build an APK file in Eclipse?. If you've built the project (i.e. with Eclipse) it exists in the project's bin directory.
If your friend needs a way to install the .apk, using the SDK tools then connect your phone via USB and run adb install appname.apk. Without SDK tools, your friend could use an app like Installer.

Related

Some Kivy Buildozer related stuff I'm not sure about

My Setup:
VM VirtualBox on windows 7 home p.
Guest - Linux Ubuntu 14.04
I have installed buildozer and dependencies and can run buildozer android debug and get an apk in the bin folder of the root project directory.
I have some questions that are killing me.
Why is it when I call buildozer android release, no apk gets placed in the bin folder in the project root directory. Instead I find the release apk in .buildozer......dist/mygame/release.unsigned-apk? Is it suppose to be there?
I can use keytool to create a .keystore file and run jarsinger... but, I don't have DIR ~/.buildozer/android/platform/android-sdk-21/build-tools/22.0.1/zipalign -v 4. If buildozer downloaded the android sdk and ndk, should I have zipalign somewhere? How can I build a debug apk if I didn't have the sdk and ndk? So how come I don't see an sdk or ndk folder anywhere on my system?
In my spec file, I use requirements kivy=master. Is that ok?
PS, I know the sdk and ndk were downloaded because it took forever to get those but where are they?
The release apk doesn't go to the bin folder in root, but by default goes to the bin folder in distrb directory, which is in the hidden .buildozer path (in the root project folder). Only the debug release goes to the bin folder that gets created in the project root.
The NDK and SDK were found in the hidden .buildozer path located in my Home directory. Linux Ubuntu is one system that would be superior in the game "hide-n-seek"...if it were human..... Which might happen given the way mankind constant feed human life and soul into machines. :D

Can't find 'apksigner' executable to manually sign APK

Following the Sign Your App Manually guide,
You can sign your app from the command line using standard tools from the Android SDK and the JDK
I should have apksigner somewhere to run
$ apksigner sign --ks my-release-key.jks my-app.apk
Where is this executable supposed to be? The documentation never specifies where I'm supposed to get the tool on the Signing guide or the apksigner doc.
I don't recall having this problem last time I manually signed an app. I've searched all the directories I can think of with no luck (including subdirectories):
AppData\Local\Android\sdk
Program Files\Android\Android Studio
Program Files\Java\jdk1.8.0_91
Googling for 'apksigner' just seems to turn up a number of unofficial apk signing tools but no official download. What am I missing?
Running Android Studio 2.2, Build Tools 24.0.2, JDK 1.8
Thanks
ANSWERED: Updating to to 24.0.3 solves it. Thanks to Alex Klyubin, please upvote his answer. For some reason Build Tools 24.0.2 simply does not have apksigner.
Build Tools, Revision 24.0.3 (September 2016)
Added apksigner, an APK signing tool to replace jarsigner ...
apksigner shipped with Android SDK Build Tools 24.0.3 (see https://developer.android.com/studio/releases/build-tools.html). The tool can be found in the Android SDK's build-tools/<tools version> directory. For example, build-tools/24.0.3/apksigner on Linux/OSX and build-tools/24.0.3/apksigner.bat on Windows.
On mac The Apksigner is inside build tools all you need is this line
/Users/adewale***/Library/Android/sdk/build-tools/28.0.3/apksigner verify MyApp.apk
just change /Users/adewale***/Library/Android/sdk/build-tools to your build tools path.
Done
I was facing the same problem on windows 10, I found apksigner.jar jar file in the following path:
C:\Users\miaou\AppData\Local\Android\Sdk\build-tools\29.0.2\lib
I did copy the .jar file and paste it inside platform-tools folder inside Android sdk directory
On Windows 10 it should be under directory
C:\Users\{user}\AppData\Local\Android\Sdk\build-tools\
Note the AppData directory is by default hidden.
First make sure you installed Android SDK 24.0.3 or later.
Use this command will work for sure (For Windows)
--Go to this directory
C:/Users/{UserName}/AppData/Local/Android/Sdk/build-tools/29.0.0/
--Type this command :
apksigner.bat verify {PathToApp/AppName}.apk
Full Example :
C:/Users/Surya/AppData/Local/Android/Sdk/build-tools/29.0.0/apksigner.bat verify C:/AndroidApp/test.apk
On windows I couldn't use apksigner even with build tools version 31.0.0.
finally used apksigner command with .bat postfix and it worked fine.
for example
apksigner.bat verify AppName.apk
If you have downloaded command-line tools and haven't extracted "build-tools" folder yet then open cmd and go to folder's location where your SDKManager is present and then run the following command:
//sdkmanager build-tools verison number like following command
sdkmanager build-tools;31.0.0
"apksigner.jar" comes inside the build-tools\version number\lib folder.
After running the above command, set the path (where your apksigner.jar is present) in environemnt variable.
You can check list of build tools versions from following link:
https://developer.android.com/studio/releases/build-tools
Or simply you can run following command in the cmd:
sdkmanager --list
just store this in path environment values: %LOCALAPPDATA%\Android\Sdk\build-tools\32.0.0

How can I compile an APK from a GitHub source

I want to build an APK from this GitHub repository:
https://github.com/SDLash3D/cs16-client/
How can I do it? (Please mention the name of the apps required (preferably for Windows) and the process)
To make a apk from this repo downlad android folder using git or any tool that you prefer.
And open android studio if don't have this down download it from this link
If you don't have the android sdk with you then download android studio bundle
http://developer.android.com/sdk/index.html
For this you will need jdk . If you don't have this dowload it and install it.
http://www.oracle.com/technetwork/java/javase/downloads/index.html
And add the jdk path as JAVA_HOME in environmental variable.
And install your android studio.
Then open the android studio and import downladed repo earlier.
Android studio will resolve the dependencies and after all is done you can build an apk from it.
You can get the apk from the app-build-output-apk folder.
Running ~/buildAPKs/build.github.bash https://github.com/SDLash3D/ will attempt to build APKs from all the AndroidManifest.xml files it finds at this GitHub account.
As https://github.com/SDLash3D/ currently has no AndroidManifest.xml files to build from, try ~/buildAPKs/build.github.bash https://github.com/BuildAPKs which should build many APKs for you from GitHub in Android on handheld as well as in Windows.

How do I put my cordova application on the android play store?

If there is official cordova documentation for this, I couldn't find it and would appreciate a link. I have run cordova run android to deploy to my phone. Things look good. Now I'm ready to turn this into an official app that users can download on the android play store? When I build my app it generates a file named "CordovaApp-debug.apk". That "debug" part makes me think this is the wrong file to work with, but I'm not sure how to generate the right file.
Deploying a hybrid app to the Google Play Store
These steps would work for Cordova, PhoneGap or Ionic. The only difference would be, wherever a call to cordova is placed, replace it with phonegap or ionic, for your particular scenario.
Once you are done with the development and are ready to deploy, follow these steps:
Open a command line window (Terminal on macOS and Linux OR Command Prompt on Windows).
Head over to the /path/to/your/project/, which we would refer to as the Project Root.
While at the project root, remove the "Console" plugin from your set of plugins.The command is: cordova plugin rm cordova-plugin-console
While still at the project root, use the cordova build command to create an APK for release distribution.The command is: cordova build --release android
The above process creates a file called android-release-unsigned.apk in the folder ProjectRoot/platforms/android/build/outputs/apk/
Sign and align the APK using the instructions at https://developer.android.com/studio/publish/app-signing.html#signing-manuallyAt the end of this step the APK which you get can be uploaded to the Play Store.
Note: As a newbie or a beginner, the last step may be a bit confusing as it was to me. One may run into a few issues and may have some questions as to what these commands are and where to find them.
Q1. What are jarsigner and keytool?
Ans: The Android App Signing instructions do tell you specifically what jarsigner and keytool are all about BUT it doesn't tell you where to find them if you run into a 'command not found error' on the command line window.
Thus, if you've got the Java Development Kit(JDK) added to your PATH variable, simply running the commands as in the Guide would work. BUT, if you don't have it in your PATH, you can always access them from the bin folder of your JDK installation.
Q2. Where is zipalign?
Ans: There is a high probability to not find the zipalign command and receive the 'command not found error'. You'd probably be googling zipalign and where to find it?
The zipalign utility is present within the Android SDK installation folder. On macOS, the default location is at, user-name/Library/Android/sdk/. If you head over to the folder you would find a bunch of other folders like docs, platform-tools, build-tools, tools, add-ons...
Open the build-tools folder. cd build-tools. In here, there would be a number of folders which are versioned according to the build tool-chain you are using in the Android SDK Manager. ZipAlign is available in each of these folders. I personally go for the folder with the latest version on it. Open Any.
On macOS or Linux you may have to use ./zipalign rather than simply typing in zipalign as the documentation mentions. On Windows, zipalign is good enough.

how to run apk file in android

First get the Android SDK and unzip it somewhere on your hard drive
Add SDK_ROOT to your system variables pointing to /tools folder under the sdk
Run the emulator
Copy the apk file to /tools folder
i followed above this procedure but i didn't get result ,
what can i do ?
Copying an apk to the tools folder accomplishes nothing, you need to install it on the real or emulated android device, using a command such as
adb install someappliction.apk

Categories

Resources