As an academic exercise, I'm following this to build an Android app from the command line using just the android sdk.
I was wondering where in the Android SDK I could find the Android library to javac against? Otherwise, javac doesn't know where to find, for instance, android.app.Activity. I think dx needs the library too right?
As an academic exercise, I'm following this to build an Android app from the command line using just the android sdk.
That blog post is from 2009. At the time of this writing, it is 2015. The build process has substantially changed since 2009.
I was wondering where in the Android SDK I could find the Android library to javac against?
$ANDROID_SDK/platforms/platform-NNN, where $ANDROID_SDK is wherever you have the Android SDK installed and NNN is an API level (e.g., 21). In there, you will find an android.jar file that contains the mocks of the Android SDK API that we compile against.
I looked at the docs on the Android page for creating a project through cli, but it would generate an Ant project?
I have heard that you can have a -g switch to generate Gradle build files instead of Ant, but I haven't ever used it. Personally, I would just copy the Gradle build files from a known-working project and modify them to suit.
Related
I tried to import multiple android projects with render scripts, but often it does not make me compile with the "Project SDK is not defined" warning.
How should I do? Do I have to include some words?
I was interested in this project:
https://android.googlesource.com/platform/frameworks/rs/+/master/tests/java_api/LivePreview/
Use Android Studio 2.3.3
Those sources are part of the platform build, not a normal app build used by Android Studio (or even Eclipse.) In order to build it in Android Studio, you would need to manually setup your own project structure and pull the code into the correct place. Sources need to follow the Android Studio / gradle layout (app/src/main/java/... for Java sources, app/src/main/rs for Renderscript sources, etc.)
The SDK location is typically stored in the local.properties file at the top level of your project tree and is developer specific (not committed to rev control.)
First step: I use QtCreator to compile a bunch of libraries (.so files) + a GUI test program to test those libraries on an Android device.
Second step: After I tested them, I re-compile the libraries without the GUI test program and send them to a client who's going to integrate those .so file in its own Andoid application (generating and apk), not using QtCreator anymore. I do this step using QtCreator (because it's setup, very easy for me to just remove the GUI test program and hit compile), but I'm pretty sure they could also be compiled directly using ndk-build if I work on writting the correct make files for that.
When I re-compile the libraries, there's still a "Android build SDK" option under "Build Android APK" set to "android-22" in QtCreator. However, my client generates its final app for "android-19". And we are wondering if this could be a problem.
My understanding is that my .so files generated in "second step" are built using the NDK only (SDK is not used, so android API version "android-22" is irrelevant as I do not generate any APK...). So there should be no compatibility issue when those .so files are integrated in an application, as far as the same NDK version is used.
Am I right?
What are the differences of apk from Eclipse and Android Studio[IntelliJ IDEA]
is there more security in Android Studio build?
Android Studio utilizes the fast growing Gradle build system. It builds on top of the concepts of Apache Ant and Apache Maven but it also introduces a Groovy DSL (Domain-Specific Language) that allows for scripted builds which opens up many automation possibilities like uploading your beta .apk to TestFlight for testing.
Eclipse on the other hand uses Apache Ant as its main build system which a very robust XML based build system .
Please check this SO Answer
ADT (Eclipse) vs. Android Studio: How much APK file size difference is normal?
Conclusion
Both are identical.But i prefer Android Studio.
They both use the Android SDK to generate the APKs, they should be identical.
Code protection (security by obfuscation) is done with ProGuard both on Android Studio and on ADT (Eclipse). So if you use ProGuard, there should be no difference.
I'm using the Android SDK as a standalone version (since I don't like IDEs very much).
However, now I wanted to use the Support Libraries and downloaded them with the ./android tool. And I checked that the /extras/android/support/v4/android-support-v4.jar exists.
Yet, my compiler doesn't seem to recoginize them (error: package android.support does not exist).
I believe that I have to get them in my classpath somehow, but have no idea how this should work (on the android page it is only explained for IDEs).
Any suggestions?
While the Android Support library documentation focuses on the two main IDEs, the documentation on command-line projects has instructions on how to reference an Android library project.
I needed to specifically get the support libraries (a jar file) to be included in a legacy ant-based Android build, and I wasn't able to get the command line suggested by the links from CommonsWare to work (specifically, the suggestions from https://developer.android.com/tools/projects/projects-cmdline.html#ReferencingLibraryProject required that I actually have a full project to reference.)
As it turns out, all I had to do was put the support library jar (eg: android-support-v4.jar) in the project's lib directory and everything worked. That may be specific to the ant build I'm using, but I think it's the same build file that the google tools used to generate.
I'm on a team with some members who like to the use the Android Eclipse plugin and some who like to use other editors and therefore use the Android command-line tools. We're about to start a project with members from both camps, so I'm wondering if it is possible to use both the Eclipse plugin and the command-line tools at the same time so that everyone can work in their preferred environment.
Personally, I've been using VIM and the command-line tools for Android development so far. I had a look at the Eclipse plugin to see if interoperability with the command-line tools would be possible, but it seems that the plugin does not generate any of the Ant build files that the command-line tools use. Is there some way to make the Eclipse plugin generate these files?
That shouldnt be a problem...
Eclipse builds the app and produces a .apk file like on the fly where if you want to use the command line you have to follow a different procedure..
Read this: http://developer.android.com/guide/developing/building/index.html
and in particular
"if you are developing in a non-Eclipse environment, you can build your project with the generated build.xml Ant file that is in the project directory. The Ant file calls targets that automatically call the build tools for you."