Android : Setup Eclipse Dev Environment

Document created by resplin Employee on Jun 6, 2015
Version 1Show Document
  • View in full screen mode

Obsolete Pages{{Obsolete}}

The official documentation is at: http://docs.alfresco.com




Introduction


This wiki page explains how to setup an Eclipse Development Environment to build and customize Alfresco Mobile SDK & App for Android.
This procedure will use mostly the 'Maven' approach. Nevertheless it's also possible to setup an Android Alfresco development environment without using Maven. Other alternatives are Gradle, Ant or Eclipse only.

Before setting up any development environment in combination with Alfresco Mobile source code it's important to know which component (eclipse project) the developer are going to use.
If the component used is a(n)


  • Java library (jar) : Can be integrated directly into an Android libs project folder or declared as dependencies inside the pom.xml of your maven project or as eclipse project dependency inside your build path.
  • Application Library (apklib) : Must be integrated as Eclipse project inside your workspace.

NB : The goal of this page is not to describe precisely each component installation process. It's here to give enough hints.


Build Alfresco Mobile using Eclipse & Maven


In this example we will build the release of Alfresco Mobile 1.3.1

The most important things to know in this configuration example is everything is done by Maven and associated Eclipse plugins.
In other words most of the configuration are done via pom.xml files.


Prerequisites


NB : In this example Maven & Eclipse plugins are mandatory


NB : In this example we use Samsung Mobile SDK 1.0.2


Retrieve Project from Git


Import Eclipse Projects


To build Alfresco Mobile 1.3.1, the minimum Eclipse projects required are the following :


  • SDK > alfresco-mobile-android-ui-library (apklib)
  • APP > alfresco-mobile-android-commons (apklib)
  • APP > alfresco-mobile-android-extension-samsung (apklib)
  • APP > alfresco-mobile-android (apk)

NB : Other transitive dependencies (jar essentially) are managed by Maven regarding pom.xml files of each project.

For each preceding projects


  • Inside your workspace > Import > Git > Projects from Git > Local > <Selected Projects>
  • If necessary you can import/convert those projects as Maven Project.

For reference, this is eclipse .project file for apklib eclipse project



<projectDescription>
<name>Your Application Project Name</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
  <buildCommand>
   <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
   <arguments>
   </arguments>
  </buildCommand>
  <buildCommand>
   <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
   <arguments>
   </arguments>
  </buildCommand>
  <buildCommand>
   <name>org.eclipse.jdt.core.javabuilder</name>
   <arguments>
   </arguments>
  </buildCommand>
  <buildCommand>
   <name>com.android.ide.eclipse.adt.ApkBuilder</name>
   <arguments>
   </arguments>
  </buildCommand>
  <buildCommand>
   <name>org.eclipse.m2e.core.maven2Builder</name>
   <arguments>
   </arguments>
  </buildCommand>
</buildSpec>
<natures>
  <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
  <nature>org.eclipse.jdt.core.javanature</nature>
  <nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

and .classpath file



<classpath>
<classpathentry exported='true' kind='con' path='com.android.ide.eclipse.adt.DEPENDENCIES'/>
<classpathentry kind='con' path='com.android.ide.eclipse.adt.ANDROID_FRAMEWORK'/>
<classpathentry kind='src' path='gen'>
  <attributes>
   <attribute name='maven.pomderived' value='true'/>
  </attributes>
</classpathentry>
<classpathentry kind='con' path='org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER'>
  <attributes>
   <attribute name='maven.pomderived' value='true'/>
  </attributes>
</classpathentry>
<classpathentry kind='src' output='bin/classes' path='src'>
  <attributes>
   <attribute name='optional' value='true'/>
   <attribute name='maven.pomderived' value='true'/>
  </attributes>
</classpathentry>
<classpathentry exported='true' kind='con' path='com.android.ide.eclipse.adt.LIBRARIES'/>
<classpathentry kind='output' path='bin/classes'/>
</classpath>

Associate library projects


  • Select Alfresco Mobile Eclipse Project
  • Right Click on the project > Properties
  • On the left Menu select > Android
  • In library section select > Add... and then select all 3 libraries : alfresco-mobile-android-ui-library / alfresco-mobile-android-commons / alfresco-mobile-android-extension-samsung
  • Apply & Validate




  • Select alfresco-mobile-android-commons Eclipse Project
  • Right Click on the project > Properties
  • On the left Menu select > Android
  • In library section select > Add... and then select alfresco-mobile-android-ui-library
  • Apply & Validate




  • Select alfresco-mobile-android-extension-samsung Eclipse Project
  • Right Click on the project > Properties
  • On the left Menu select > Android
  • In library section select > Add... and then select alfresco-mobile-android-ui-library /  alfresco-mobile-android-commons
  • Apply & Validate

Build Alfresco Mobile


  • Select Alfresco Mobile Eclipse Project
  • Right Click on the project > Run As > Android Application Project

or


  • Right Click on the project > Run As > Run configurations >  mvn clean install -P android-release,extension-samsung




Eclipse Project Dependencies Pattern


Below you will find the minimum eclipse project you must have inside your Eclipse Workspace regarding the goal you want to achieve.


Alfresco Project Dependencies


Those dependencies pattern are used by Alfresco Android Team to change/modify Alfresco Mobile SDK & App.


Alfresco SDK


Goal : develop / extend / modify Alfresco Android SDK


  • SDK > alfresco-mobile-android-client-api (jar)
  • SDK > alfresco-mobile-android-async (jar)
  • SDK > alfresco-mobile-android-ui-library (apklib)

Alfresco Application (without extension)


Goal : develop / extend / modify Alfresco Android APP (without extension)


  • SDK > alfresco-mobile-android-ui-library (apklib)
  • APP > alfresco-mobile-android-commons (apklib)
  • APP > alfresco-mobile-android (apk)

Alfresco Application with extension


  • SDK > alfresco-mobile-android-ui-library (apklib)
  • APP > alfresco-mobile-android-commons (apklib)
  • APP > alfresco-mobile-android-extension-samsung (apklib)
  • APP > alfresco-mobile-android (apk)

Complete Alfresco Android Dev env


Goal : develop / extend / modify Alfresco Android SDK & APP


  • SDK > alfresco-mobile-android-client-api (jar)
  • SDK > alfresco-mobile-android-async (jar)
  • SDK > alfresco-mobile-android-ui-library (apklib)
  • APP > alfresco-mobile-android-commons (apklib)
  • APP > alfresco-mobile-android-extension-samsung (apklib)
  • APP > alfresco-mobile-android (apk)




Custom Dependencies


Those project dependencies pattern are typically used by third party developers to create Android Application or extends Alfresco Mobile.


Custom SDK Extension


Goal : create an Alfresco Android SDK extension


  • SDK > alfresco-mobile-android-client-api (jar)
  • SDK > alfresco-mobile-android-async (jar)
  • SDK > alfresco-mobile-android-ui-library (apklib)
  • <Your Custom SDK Extension Project>  (apklib/jar)

Custom Application based on Alfresco SDK


Goal : create a new Android application based on Android SDK


  • SDK > alfresco-mobile-android-client-api (jar)
  • <Your Custom Application Project>  (apk)

or


  • SDK > alfresco-mobile-android-client-api (jar)
  • SDK > alfresco-mobile-android-async (jar)
  • <Your Custom Application Project>  (apk)

or


  • SDK > alfresco-mobile-android-ui-library (apklib)
  • <Your Custom Application Project>  (apk)




Custom version of Alfresco Mobile


Goal : create a new Android application based on Android App Components or Alfresco Mobile Source code


  • SDK > alfresco-mobile-android-ui-library (apklib)
  • APP > alfresco-mobile-android-commons (apklib)
  • APP > alfresco-mobile-android-extension-samsung (apklib)
  • <Your Custom Application Project>  (apk)

Android

Attachments

    Outcomes