[Android-tools-devel] Simple Instructions for Using Android SDK on Stretch
殷啟聰
seamlikok at gmail.com
Mon Mar 13 11:11:38 UTC 2017
Here are the steps for building Android apps using Debian's Andoid SDK
on Stretch. It can be included in the release notes.
Currently there is only the target platform of API Level 23 packaged,
so we can only build apps targeted at android-23. We will add more API
Levels after via backports afterwards. Apart from this, only
Build-Tools 24.0.0 is available. So in order to use the SDK, build
scripts need to be modified.
1. sudo apt install android-sdk android-sdk-platform-23
2. export ANDROID_HOME=/usr/lib/android-sdk
3. In `build.gradle`, change `compileSdkVersion` to 23 and
`buildToolsVersion` to 24.0.0
4. gradle build
The Gradle Android Plugin is also packaged. In order to use it instead
of the one from online Maven repositories, do the following before
running Gradle:
1. In `buildscript {}` block, add `maven { url
'file:///usr/share/maven-repo` }` to repositories
2. In `buildscript {}` block, use
`com.android.tools.build:gradle:debian` as the plugin classpath
Beware that the Lint in this version of Gradle Android Plugin always
fails, so make sure not to run the `:lint` tasks or turn off
`lintOptions.abortOnError`.
In Sid (and stretch-backports), the Gradle Android Plugin is patched
to work with Debian's Android SDK. It detects what versions of API
Levels and Build-Tools are available and you no longer need to modify
the build scripts. In order to build apps, do the following:
1. sudo apt install android-sdk android-sdk-platform-23 android-sdk-helper
2. export ANDROID_HOME=/usr/lib/android-sdk
4. gradle build --init-script /usr/share/android-sdk-helper/init.gradle
Thus, `init.gradle` forces Gradle to use the Gradle Android Plugin in
Debian and the plugin will do the rest.
Do reply this email if anyone have any questions.
Cheers,
Kai-Chung Yan
More information about the Android-tools-devel
mailing list