Giter Site home page Giter Site logo

xiaomaguoguo / spring-android-samples Goto Github PK

View Code? Open in Web Editor NEW

This project forked from spring-attic/spring-android-samples

0.0 2.0 0.0 3 MB

Spring for Android Sample Applications

Home Page: http://www.springsource.org/spring-android

License: Apache License 2.0

spring-android-samples's Introduction

Spring for Android Samples

This repository contains sample projects illustrating usage of Spring for Android. Each project requires set up of the Android SDK, command line tools, Maven, the Android Maven Plugin, and Android Maven artifacts such as Spring dependencies. This document walks through that setup. See Spring for Android on GitHub for more information about building from source.

Sample Applications

The following sample applications demonstrate the capabilities of [Spring for Android]. See the README in each directory for more information on the sample project and additional instructions.

Development Environment

The Android SDK is required for developing Android applications. Google provides command line tools, and an Eclipse plugin for building Android applications, however you are not restricted to only those options. The Android Maven Plugin makes use of the Android SDK command line tools to compile and deploy the app to the emulator, so there is no need for a separate IDE setup or configuration.

Install the Android SDK

  1. Download the correct version of the Android SDK for your operating system from the Android web site.

  2. Unzip the archive and place it in a location of your choosing. For example on a Mac, you may want to place it in the root of your user directory. See the download web site for additional installation details.

  3. Add Android to your path. The following is an example bash configuration on a OS X:

    $ export ANDROID_HOME=~/android-sdk-macosx
    $ export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools

Install Android SDK Platform(s)

The Android SDK download does not include any specific Android platform SDKs. In order to run the sample code you need to download and install the Android 2.1 SDK Platform or higher. You accomplish this by using the Android SDK and AVD Manager that was installed from the previous step.

  1. Open the Android SDK Manager window:

    $ android

    Note: if this command does not open the Android SDK Manager, then your path is not configured correctly.

  2. Select the checkbox for "Tools"

  3. Select the checkbox for the latest Android SDK

  4. Click the Install packages... button to complete the download and installation.

    Note: you may want to simply install all the available updates, but be aware it will take longer, as each SDK level is a sizable download.

Configure an Android Virtual Device

The following steps describe how to configure an Android Virtual Device (AVD) for use in running the sample application. More information can be found on the Managing Virtual Devices at the Android Developers web site.

  1. Open the Android Virtual Device Manager window:

    $ android avd
  2. Select the New… button

  3. Enter "Default" in the Name field

    Note: The Android Maven Plugin attempts to start an AVD with the name "Default" unless you specify an alternate emulator in the POM.

  4. Select "Nexus 7" as the device

  5. Select "Android 4.2.2 - API Level 17" for the target

  6. Select "ARM (armeabi-v7a)" for the CPU

  7. Click the OK button to finish.

    Note: The sample application is configured for Android 2.1 as the minimum version.

Build and Run the App

The following instructions apply to each Android sample app. They should be executed from within the sample app's directory, where the project's pom.xml is located.

  1. Start the emulator using the Android Maven Plugin:

    $ mvn android:emulator-start

    Alternatively, you can start the emulator using the Android command line tools:

    $ emulator @Default

    Important: Ensure the emulator is fully initialized and ready or the deploy will fail.

  2. Build the app:

    $ mvn clean package
  3. Deploy and run the app:

    $ mvn android:deploy android:run

    Note: the Android Maven Plugin will attempt to deploy the app to all available devices, both emulators and physical devices attached to your computer.

Troubleshoot Failed Deployment

View realtime logging of the app using this command:

$ adb logcat

If "mvn android:deploy" fails, stop and restart the adb server:

$ adb kill-server
$ adb start-server
$ mvn android:deploy

List the available virtual devices using this command:

$ adb devices

Contribute

Pull requests are welcome. See the contributor guidelines for details.

Additional Resources

License

[Spring for Android] is released under version 2.0 of the Apache License.

spring-android-samples's People

Contributors

pyricau avatar royclarkson avatar samitny avatar simonmartinecon avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.