I'm working my way through APress's Beginning Android 2 and I've made it all the way to chapter 3, where we build a skeleton app. The book tells me to compile my application by typing "ant" in the command line, but my pc doesn't know what "ant" is yet. I checked in the SDK files and it looks like it wasn't included with the Android SDK. Does anybody know where ant is?
Thanks
Ant isn't included with the Android SDK. I suggest you get it from the official site.
Ant is tool to build projects from commondline and it is different tool. It's not android specific. So if your are using a Debian-based/Ubuntu machine you can install it by
sudo apt-get install ant
I know it is a bit odd, but even I install brew install ant and rebuild / re-sync the gradle file, it still doesn't work, so I restarted my Intellij and it started to download the ant1.7 again from maven.
Related
I have looked EVERYWHERE for the solution to this.
Ionic Cordova Build Android No installed build tools found did not work
cordova build android failed with exception was a ridiculous non-answer. OF COURSE Android Studio is installed!!!
Android studio- "SDK tools directory is missing" I did this. The $ANDROID_SDK_ROOT/tools folder now exists, but that didn't solve my problem.
I tried the advice given here: Ionic Cordova Build Android No installed build tools found and all I get when I run sdkmanager packages "build-tools;30.0.3" is "failed to find package 'packages'" from the SDK Manager.
I looked here: Android SDK Manager does not exist and installed ALL the stuff they said to install -- including the obsolete packages. And still no luck.
Here's my path:
/opt/homebrew/bin:/Users/lmacneill/.sdkman/candidates/java/current/bin:/Users/lmacneill/.sdkman/candidates/gradle/current/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/lmacneill/CordovaProjects/gamapp/node_modules/.bin:/Users/lmacneill/Library/Android/sdk/tools:/Users/lmacneill/Library/Android/sdk/build-tools:/Users/lmacneill/Library/Android/sdk/platform-tools
Here's my Android Studio SDK Platforms screen:
https://i.stack.imgur.com/2e5YI.png
And here's my Android Studio SDK Tools screen:
https://i.stack.imgur.com/btLIR.png
(Unrelated to this post, but very weird -- it told me I needed 10 reputation to post images, yet I have 661 reputation. Why did it do that? Hence the link to my images instead of the actual images.)
SO WHY CAN THE TOOLS NOT BE FOUND?!!!!!!. I've done EVERYTHING that EVERYONE has suggested, and STILL IT DOESN'T WORK!!!!
This is ridiculous!!!! Surely someone must know the answer?
Well... I FINALLY figured it out...
In the $ANDROID_SDK_ROOT/build-tools folder, there was a 33.0.2 folder. So in my .zshrc file, instead of adding $ANDROID_SDK_ROOT/build-tools to the path, I needed to add $ANDROID_SDK_ROOT/build-tools/33.0.2 to the path.
Then cordova build android FINALLY worked!!!
BTW, I figured this out when I finally got sdkmanager to install the build-tools;30.0.3 -- you have to use sdkmanager "build-tools;30.0.3" command, NOT the sdkmanager packages "build-tools;30.0.3" command. Maybe the command with the 'packages' bit worked for an older version of sdkmanager? But it definitely doesn't work now. Anyway, once I saw that it had created a new folder in $ANDROID_SDK_ROOT/build-tools, I finally realized that exporting only $ANDROID_SDK_ROOT/build-tools in the path wasn't enough. You have to include the version folder in there as well.
ANDROID!!! Y'ALL SHOULD MAKE THIS EASIER!!!! INSTALLING ANDROID STUDIO SHOULD DO ALL OF THIS STUFF AUTOMATICALLY!!!!!
I'm on windows7 x64, installed today's latest stable release of android sdk studio (through android studio bundle, since it's shipped together now apparently). I have properly configured the environment variables as you'll see above.
This is what I get when issuing the following command
$ cordova build android
ANDROID_HOME=G:\installs\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_121
Error: Could not find gradle wrapper within Android SDK. Might need to update your Android SDK.
Looked here: G:\installs\Android\sdk\tools\templates\gradle\wrapper
And indeed, the "templates" directory doesn't even exist in my sdk install.
I've already tried the suggestions (setting the right path, uninstall/reinstall) of this question here but nothing applies to my case, and I find that manually copying and pasting packages is not really a solution, since there's a package manager in place.
If anybody has an answer as of today's android install, would be very much appreciated.
If still not working then copy all file from gradle\wrapper from Android Studio installation folder
C:\Program Files\Android\Android
Studio\plugins\android\lib\templates\gradle\wrapper
and paste it in your Android SDK gradle\wrapper then run same command.
E:\android-sdk\tools\templates\gradle\wrapper
This is a known issue; see CB-12544. For now you'll need to downgrade.
I downloaded Android SDK r25 manually and placed templates folder inside Android/sdk/tools. This solved the issue for me.
You can get it from https://dl.google.com/android/repository/tools_r25.2.3-macosx.zip
For Windows:
https://developer.android.com/studio/index.html
Go to the section :"Get just the command line tools"
There is a link 'sdk-tools-darwin-3859397.zip' for Mac, Unfortunately that didn't have the templates folder with Gradle Wrapper. So for Mac users, i will suggest not to go for this zip.
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.
We are trying to install a set of eclipse plugins from the commandline.
First we need to install ADT plugin.
Then we are trying to install a plugin which dependent on the ADT plugin.
The installation of the dependent plugin is failing with an error:
Missing requirement: "OurPluginName" ("Ourplugin.feature.group") requires 'com.android.ide.eclipse.adt 11.0.0' but it could not be found
We are using the following command to install a plugin from the commandline:
eclipsec.exe -application org.eclipse.equinox.p2.director -repository [our-update-side] -installIU [our.feature.group] -destination "[eclipse-install-directory]"
We observed the following:
If we only install the ADT plugin then start the eclipse IDE in UI mode, stop it again and perform afterwards an installation of the plugin which is dependent on the ADT plugin, the above error is not occurring.
So the question is now: How can we install the dependent plugin via command line without starting the ecilpse IDE manual.
Do you know a way how to update the eclipse repository from the command line?
Thanks for a hint.
Best Regards
Frank
The issue is solved :-):
Do it in the following way:
Download the ZIP File containing the ADT plugin, don't download it via the update side!
Extract the ZIP-File content in your eclipse folder.
Now you can install additional plugins dependent from the ADT plugin as described above.
Hope this helps you too.
Best Regards
Frank
I'm setting up a Continuous Integrations System with Hudson and it's just amazing.
I got a SVN repository and integrated a post-commit hook that notifies Hudson when someone commits to the repository. This part is working splendid.
The general idea is, that if the project fails, with unit-tests or anything else, it should tell the collaborator(i'm using a simple e-mail notifier atm). But if it successes I want it to compile the project and build either an unsigned or a signed .apk file.
What's the easiest or smartest way to do this?
I've read you can use a Shell Command to build the .apk but I can't seem to figure out how this works? Can anyone tell me how I can do this or should I go for another solution?
Thanks in advance
Finn Larsen
There is a guide on the Jenkins wiki about building Android apps with Hudson or Jenkins, including building and running a test app, obtaining code coverage and static analysis stats.
Essentially you can use the Ant support built-in to build your application.
If you want to run automated tests, you can also use the Android Emulator Plugin.
Since you're just starting out with Hudson, I would say now is a good time to upgrade to Jenkins. ;)
As far as I remeber hudson supports ant's builds. And android apps can be built using ant use this link for more info about building android apps with ant. Be aware that you'll have to install Android SDK on your build agent.
Android provides ant build script. So, you can make apk easily.
install android-sdk in hudson server
install ant in hudson server ( ant version should be > 1.8 )
in hudson, call cmd android update project -p <PATH to your project>
in hudson, call ant debug. debug target generates debug apk build