How to set up your Android development environment using STS, Android SDK, Maven, and Spring Android

  1. Install the latest version of STS (currently 3.4.0)
  2. Set up your Android development environment in STS in accordance with the usual steps for setting up Android development for an existing IDE: http://developer.android.com/sdk/install/index.html
  3. To complete the above step, you can save time by copying the "android-sdk" folder from another developer who has already set up his environment and specify your STS in this android folder (Window -> Preferences → Android -> SDK Location)
  4. Install m2e-android according to: http://rgladwell.imtqy.com/m2e-android/

Create an example Android application using Maven

  1. In STS, click File -> New → Maven Project.
  2. Choose the location of your workspace and click "Next"
  3. For Maven Archetype, select "android-quickstart" and click "Next." This archetype must exist if you added the archetype according to: http://rgladwell.imtqy.com/m2e-android/
  4. Fill out the necessary details of the Maven project and click Next.
  5. In the pom.xml file, set the "platform.version" tag to 4.1.1.4.
  6. Right-click on the project and select Build Project.
  7. Right-click on the project and select "Run as" Application "Application for Android."
  8. It should launch your Android emulator and deploy the Hello World app.

Using Spring libraries in an Android application:

  1. Maven, , : http://projects.spring.io/spring-android
  2. , . Android STS : " dex Lorg/springframework/core/ErrorCoded". , . , maven "spring-android-auth".

RestTemplate Spring Android:

  1. : http://docs.spring.io/spring-android/docs/1.0.1.RELEASE/reference/html/rest-template.html
  2. , Android . : restTemplate.getMessageConverters(). Add (new MappingJackson2HttpMessageConverter());
  3. , Android "android.permission.INTERNET", .
+8

Source: https://habr.com/ru/post/1530924/


All Articles