Spring for Android


Source link: https://github.com/spring-projects/spring-android

Spring for Android

Spring for Android is a library that is designed to provide components of the Spring Framework family of projects for use in native Android applications.

Code of Conduct

This project adheres to the Contributor Covenant code of conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to [email protected].

Features

  • A REST client for Android
  • Auth support for accessing secure APIs

Download Artifacts

The new Android Build System provides a Gradle plugin for building Android apps, and Gradle itself supports external dependency resolution via Maven repositories. Additionally, the Android Maven Plugin makes it possible to build Android applications utilizing the power of Maven dependency management. See downloading Spring artifacts for Maven repository information.

Rest Template

The Rest Template library can be included in your project using Gradle or Maven.

Gradle:

dependencies {

  compile("org.springframework.android:spring-android-rest-template:${
version
}
") 
}

Maven:

<dependencies>
  <dependency>

<groupId>org.springframework.android</groupId>

<artifactId>spring-android-rest-template</artifactId>

<version>${
org.springframework.android-version
}
</version>
  </dependency>
  </dependencies>

Spring Repositories

The following Maven repositories are available from Spring. You do not need to include all three repositories, rather select the one that corresponds to the release type of the dependency. GA releases are also available through Maven Central.

Gradle:

repositories {

  maven {
 url "https://repo.spring.io/release" 
}

  maven {
 url "https://repo.spring.io/milestone" 
}

  maven {
 url "https://repo.spring.io/snapshot" 
}
 
}

Maven:

<repositories>
  <repository>

<id>spring-repo</id>

<name>Spring Repository</name>

<url>https://repo.spring.io/release</url>
  </repository>
  <repository>

<id>spring-milestones</id>

<name>Spring Milestones</name>

<url>https://repo.spring.io/milestone</url>
  </repository>
  <repository>

<id>spring-snapshots</id>

<name>Spring Snapshots</name>

<url>https://repo.spring.io/snapshot</url>

<snapshots>

 <enabled>true</enabled>

</snapshots>
  </repository> </repositories>

Example Build Configuration

The following is an example build.gradle that illustrates how to include the spring-android-rest-template module along with the jackson-databind library for marshaling JSON data. Note the packagingOptions section which filters specific files that can cause APK packaging to fail.

apply plugin: 'com.android.application'  android {

  compileSdkVersion 20
  buildToolsVersion '20.0.0'

defaultConfig {

applicationId 'org.springframework.demo'

minSdkVersion 15

targetSdkVersion 20

versionCode 1

versionName '1.0'
  
}

  buildTypes {

release {

 runProguard false

 proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

}

  
}

  packagingOptions {

exclude 'META-INF/ASL2.0'

exclude 'META-INF/LICENSE'

exclude 'META-INF/license.txt'

exclude 'META-INF/NOTICE'

exclude 'META-INF/notice.txt'
  
}
 
}
  dependencies {

  compile fileTree(dir: 'libs', include: ['*.jar'])
  compile 'com.android.support:support-v4:20.+'
  compile 'org.springframework.android:spring-android-rest-template:2.0.0.M1'
  compile 'com.fasterxml.jackson.core:jackson-databind:2.4.1.3' 
}
 

Documentation

See the current Javadoc and reference docs.

Sample Applications

Several example projects are available in the samples repository.

Getting Started Guides

The spring.io web site contains many getting started guides that cover a broad range of topics.

Support

Check out the spring-android tag on Stack Overflow. Commercial support is also available.

Issue Tracking

Report issues via the Spring Android JIRA. While JIRA is preferred, GitHub issues are also welcome. Understand our issue management process by reading about the lifecycle of an issue.

Build from Source

  1. Clone the repository from GitHub:

    $ git clone git://github.com/spring-projects/spring-android.git

    Note: If you are unfamiliar with Git, you may want to try GitHub for Windows or GitHub for Mac.

  2. Navigate into the cloned repository directory:

    $ cd spring-android
  3. The project uses Gradle to build:

    $ ./gradlew build
  4. Install jars into your local Maven cache (optional)

    $ ./gradlew install

Import Source into your IDE

Eclipse

  1. To generate Eclipse metadata (.classpath and .project files):

    $ ./gradlew eclipse
  2. Once complete, you may then import the projects into Eclipse as usual:

    File -> Import -> Existing projects into workspace 

    Note: Spring Tool Suite includes support for Gradle, and you can simply import as Gradle projects.

IDEA

Generate IDEA metadata (.iml and .ipr files):

$ ./gradlew idea

Tests

There are three Android Test Projects located in the "test" folder of the repository that correspond to the three Spring for Android Modules (Core, Rest Template, and Auth). To run the suite of tests, perform the following steps. The parent POM located in the root of the "test" folder will execute each test project on all attached devices and emulators. The tests will fail if there is no device or emulator attached.

Run the Android tests:

$ ./gradlew testAndroid

Note: To view the output, use the --info parameter when running Gradle

Gradle runs the tests using the Android Maven Plugin. Alternatively the test suite can be executed using the following Maven command:

$ mvn clean install -f ./test/pom.xml

Test results are available in the following directory for each test project:

/test/<test-project>/target/surefire-reports 

Contributing

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

Stay in Touch

Follow @SpringCentral as well as @SpringAndroid on Twitter. In-depth articles can be found at The Spring Blog, and releases are announced via our news feed.

License

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

Resources

A custom animated confirmation dialog for Android.

jadx - Dex to Java decompiler.

Command line and GUI tools for produce Java source code from Android Dex and Apk files.

LinearLayout with "pull-to-refresh" feature.

FragmentSwapper is an Open Source Android library that allows easy fragment's management. It is somewhat similar to Activities management model. For instance, new fragment can be launched from another one with action's request (using request code) and then recieve the result.

A couple of sticky header decorations for android's RecyclerView.

A 'Google Fit' like activity indicator for Android.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes