Show TOC

Setting Up Eclipse with ADT Using MavenLocate this document in the navigation structure

Set up your Eclipse with ADT development environment that uses a Maven repository.

Procedure

  1. Open a command prompt at the file system location \SAP\MobileSDK3\NativeSDK\MAFReuse\Android.
  2. Make sure the folder contains the deploy.bat batch file.
  3. Execute the batch file with one parameter which is the path to your local Maven repository.

    The path must contain / characters instead of \. For example: deploy c:/maven_repo

  4. Open a command prompt at the file system location \SAP\MobileSDK3\NativeSDK\ODataFramework\Android.
  5. Make sure the folder contains the deploy.bat batch file.
  6. Execute the batch file with one parameter which is the path to your local maven repository.

    The path must contain / characters instead of \. For example: deploy c:/maven_repo.

  7. Create a new or open an existing Android Application Project.
  8. If your Eclipse project is not a Maven project then convert it. Right-click the project and select Start of the navigation path Configure Next navigation step Convert to Maven Project End of the navigation path.

    A pom.xml file is generated.

  9. If your pom.xml file is not similar (packaging type must be apk) to the following pom file then use this file:
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <groupId>dem2</groupId>
      <artifactId>dem2</artifactId>
      <version>0.0.1-SNAPSHOT</version>
    	<packaging>apk</packaging>
    	<build>
    		<sourceDirectory>src</sourceDirectory>
    		<plugins>
    			<plugin>
    				<artifactId>maven-compiler-plugin</artifactId>
    				<version>3.3</version>
    				<configuration>
    					<source />
    					<target />
    				</configuration>
    			</plugin>
    			<plugin>
    				<groupId>com.jayway.maven.plugins.android.generation2</groupId>
    				<artifactId>android-maven-plugin</artifactId>
    				<version>3.6.0</version>
    				<extensions>true</extensions>
    				<configuration>
    					<sdk>
    						<platform>14</platform>
    					</sdk>
    				</configuration>
    			</plugin>
    
    			<plugin>
    				<artifactId>maven-assembly-plugin</artifactId>
    			</plugin>
    		</plugins>
    	</build>
    	<dependencies>
    		<dependency>
    			<groupId>com.google.android</groupId>
    			<artifactId>android</artifactId>
    			<version>4.1.1.4</version>
    			<scope>provided</scope>
    		</dependency>
    		<dependency>
    			<groupId>com.sap.smp.client.android</groupId>
    			<artifactId>MAFSDK</artifactId>
    			<type>pom</type>
    			<version>1.207.0-sap-06</version>
    		</dependency>
    		<dependency>
    			<groupId>com.sap.smp.client.android</groupId>
    			<artifactId>MAFSDKODATA</artifactId>
    			<type>pom</type>
    			<version>3.7.0-sap-06</version>
    		</dependency>
    	</dependencies>
    </project>
    
    
  10. Add the following dependencies between the <dependencies> element in your POM file:
    <dependency>
        <groupId>com.sap.smp.client.android</groupId>
        <artifactId>MAFSDK</artifactId>
        <type>pom</type>
        <version>1.20X.X</version>
    </dependency>
    <dependency>
        <groupId>com.sap.smp.client.android</groupId>
        <artifactId>MAFSDKODATA</artifactId>
        <type>pom</type>
        <version>3.X.X</version>
    </dependency>
    
  11. The MAFSDK artifact version must be set to the version that you find in the pom file:
    \SAP\MobileSDK3\NativeSDK\MAFReuse\Android\MAFSDK.pom.xml
  12. The MAFSDKODATA artifact version must be set to the version that you find in the pom file:
    \SAP\MobileSDK3\NativeSDK\ODataFramework\Android\MAFSDKODATA.pom.xml
  13. Import the MAF resource projects:
    1. Open the folder <Client SDK dir>\NativeSDK\ODataFramework\Android\resources\
    2. Open Eclipse and import the projects by selecting Start of the navigation path File Next navigation step Import End of the navigation path.
    3. After the Import window opens, expand the Android folder and select Existing Android Code into Workspace and click Next.
    4. Click Browse in the Root Directory field to locate the .zip files in your local folder. For example, <Client_SDK_dir>\NativeSDK\ODataFramework\Android\resources\maflogonui-res.
    5. Select Copy projects into workspace and click Finish.
    6. Oen the folder <Client SDK dir>\NativeSDK\MAFReuse\Android\resources\, repeat the above substeps to import all other MAF project resources.
  14. After importing all MAF resources, check your project in the Package Explorer view to verify all resources have been imported:

  15. Right-click the maflogonui-res project, and select Properties from the context menu.
  16. Select Android in the project properties, then mark the project Is Library.

  17. Repeat steps 15 and 16 for all other resource projects.
  18. Right-click the project and select Properties.
  19. Select Android and check that the project references to MAF resources have been added:

  20. To use the native .so libraries (armeabi, armeabi-v7a, x86 folders with their content) residing in C:\SAP\MobileSDK3\NativeSDK\ODataFramework\Android\libraries, import them:

    into the <project-folder>/libs folder:

  21. Copy the icudt46l.zip file from C:\SAP\MobileSDK3\NativeSDK\ODataFramework\Android\libraries\assets to the <project-folder>/assets folder.
  22. Start developing your SAP mobile app.
    Note The pom.xml file has been tested with eclipse version kepler sr2 with ADT Eclipse plugin version 23.0.4. If you are using ADT bundle released by Google that is currently not supported, it may have issues with the Eclipse maven integration. In that case, we recommend you use the standalone Eclipse with ADT Eclipse plugin and use latest m2e eclipse plugin.