Skip to content

Getting started with the code

Jordyn/The Linux Geek edited this page Oct 22, 2017 · 21 revisions

Get the Code

You need to get the code first before you can do anything. Clone it from here:

$ git clone git://github.com/ubergeek42/weechat-android.git

Building with gradle

If you don't want to use eclipse, or want to automate the build process, you can use gradle.(This is how the official releases are created.)

For this you need to download the Android SDK from here: https://developer.android.com/sdk/index.html (the one without ADT is enough). Extract the zip to a directory named android-sdk-linux with tools as a subdirectory and run the below to install the dependencies:

$ export ANDROID_HOME=/path/to/android-sdk-linux
$ ./android-sdk-linux/tools/android update sdk --no-ui -a --filter build-tools-25.0.2,platform-tools,android-23,extra-android-support,extra-google-m2repository,extra-android-m2repository

Compiling the code

All you should need to do is run something like:

$ ./gradlew

Which will produce an weechat-android-debug.apk file in weechat-android/build/outputs/apk/

Building and using Eclipse

Eclipse is a lot more useful than running maven from the command line, and since it is one of the more popular IDE's for java development I've included the steps below to get it working. These were tested with Eclipse Juno(4.2), but I believe it should be working with Indigo(3.7) as well.

Prerequisites

Since the maven integration for android apklib's isn't 100% working properly, we have a little bit of setup to do. Download actionbarsherlock, and extract it somewhere on your disk. We will be needing the library/ directory. We also need ViewPagerIndicator, and we get it in the same manner.

$ curl -L https://github.com/JakeWharton/ActionBarSherlock/tarball/4.1.0 | tar -zx
$ curl -L https://github.com/JakeWharton/Android-ViewPagerIndicator/tarball/master | tar -zx

Import the ActionBarSherlock library.

  1. Start eclipse. Choose any directory you wish for your workspace.
  2. File->New->Other
  3. Under Android, choose "Android Project from Existing Code"
  4. Point the root directory to the library directory inside the actionbarsherlock directory.
  5. Finish
  6. Edit the project properties, and go to the "Java Compiler" section. Make sure the Compiler Compliance Level is set to 1.6.

Import the ViewPagerIndicator library

  1. In eclipse, File->New->Other.
  2. Under Android, choose "Android project from existing code"
  3. Point the root directory to the library directory inside the viewpagerindicator directory.
  4. Finish.
  5. Edit the project properties, and go to the "Java Compiler" section. Make sure the Compiler Compliance Level is set to 1.6.

Cleanup

It might be nice to rename the two imported libraries to have real names. Right click on the project and select Refactor->Rename. Choose something more reasonable than 'library'.

Import the weechat-android projects

  1. File->Import...
  2. Under Maven, select "Existing Maven Projects"
  3. Point the root directory to where you cloned the weechat-android repository.
  4. Unselect the parent pom.xml, then select only the weechat-relay, and weechat-android projects to import for now.(There should only be 2 things checked)
  5. Finish
  6. Edit the project properties for weechat-android. Under the "Android" section, remove any "Library" entries from the bottom, then click "Add..." and choose the actionbarsherlock library project we imported earlier. Repeat for the viewpagerindicator library.
  7. Force a clean/rebuild of the workspace: Project->Clean.
  8. Verify that there are no errors under the "Problems" tab.

Troubleshooting

Eclipse gets confused sometimes. Force a rebuild by choosing Project->Clean.

Any other problems?
File an issue, send me an email, or join our (small) channel on freenode, #weechat-android.

Clone this wiki locally