-
Notifications
You must be signed in to change notification settings - Fork 681
Migrating Linux Deploy to Android Studio
Linux Deploy is the most simple and stable way to install GNU/Linux distribution on Android device. Yet the project is still written for Eclipse ADT, whose support from Google is http://android-developers.blogspot.co.id/2015/06/an-update-on-eclipse-android-developer.html[ending]. And you cannot simply import and build it to and in Android Studio as is.
So instead of waiting for the author to migrate the project, here is how to do it yourself.
= Preparation
By the end of these preparation steps your workspace should resemble this tree:
yourworkspace/ ├── ActionBarSherlock ├── linuxdeploy └── mulsellistprefcompat
. Get *Linux Deploy* code: +
git clone git://github.com/meefik/linuxdeploy.git
. Get *ActionBarSherlock*: +
git clone git://github.com/JakeWharton/ActionBarSherlock.git
. Get *MultiSelectListPreferenceCompat*: +
git clone git://github.com/h6ah4i/mulsellistprefcompat.git
= More preparation
Get into `linuxdeploy` directory.
[start=4] . Edit `project.properties`. Change +
android.library.reference.1=../actionbarsherlock android.library.reference.2=../MultiSelectListPreferenceCompat
+ into +
android.library.reference.1=../ActionBarSherlock/actionbarsherlock android.library.reference.2=../mulsellistprefcompat/android-studio/MultiSelectListPreferenceCompat
. Edit `.classpath`. Comment out or just delete this line: +
<classpathentry kind="src" path="/actionbarsherlock"></classpathentry>
= Import
[start=6] . Open Android Studio, close any open project, and select *Import project (Eclipse ADT, Gradle, etc.)* from *Quick Start* tab. Select `linuxdeploy` directory from your workspace, and give your import destination directory a good name (here: `yourworkspace/linuxdeploy1`). Select *Next* then *Finish*, and let it works a while until stops with +
Error: NDK integration is deprecated in the current plugin. Consider trying the new experimental plugin. For details, see http://tools.android.com/tech-docs/new-build-system/gradle-experimental. Set "android.useDeprecatedNdk=true" in gradle.properties to continue using the current NDK integration.
. Follow the suggestion and create `gradle.properties` file inside `yourworkspace/linuxdeploy1` directory, containing +
android.useDeprecatedNdk=true
. Edit `build.gradle` file inside `yourworkspace/linuxdeploy1/linuxDeploy` to resemble this: +
android { ...
defaultConfig { //minSdkVersion 7 minSdkVersion 10 }
compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 }
... }
dependencies {
//compile project(':multiSelectListPreferenceCompat') compile 'com.h6ah4i.android.compat:mulsellistprefcompat:1.0.0' compile 'com.android.support:support-v4:19.1.0' compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar' //compile 'com.android.support:support-v4:18.0.0'
}
+ //Then select *Try Again* from the yellow Gradle tab in Android Studio. Then select *Sync Project with Gradle Files* in Android Studio.
By the end of Gradle invocation, Linux Deploy is ready to build.
= Tested on
- Android Studio 1.3.2
- Ubuntu 12.04.03 LTS i386
SDK Manager may require you to install some components, e.g. NDK. Just follow whatever it tells you to.