java


Spring Android not working with Gradle


I'm trying to use Spring Framework for Android in my project. I'm using IntelliJ with Gradle build tool. I'm following spring quick start tutorial.
My gradle.build file:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion 19
buildToolsVersion "19.0.1"
defaultConfig {
minSdkVersion 7
targetSdkVersion 19
}
}
dependencies {
compile 'com.android.support:support-v4:19.0.0'
compile 'com.android.support:appcompat-v7:19.0.0'
compile "joda-time:joda-time:2.2"
compile 'org.springframework.android:spring-android-rest-template:1.0.1.RELEASE'
compile 'org.springframework.android:spring-android-auth:1.0.1.RELEASE'
compile 'org.springframework.android:spring-android-core:1.0.1.RELEASE'
}
And when I try to do smth like this:
new Thread(new Runnable() {
public void run() {
RestTemplate rest = new RestTemplate();
}
}).start();
i get:
java.lang.NoClassDefFoundError: org.springframework.web.client.RestTemplate
Ofc I have in my imports
import org.springframework.web.client.RestTemplate;
For someone that faced the same issue. In my case, the problem was this: There was a library in my project that had spring as dependency, so in its build.gradle, there is this line:
compile 'org.springframework.android:spring-android-rest-template:2.0.0.M1'
But for some misterious (I don't really know why) the only way I could resolve the issue was adding the above dependency also in my root module. At first this dependency was not in my root module, because only the mentioned library uses RestTemplate class.

Related Links

Optimisation of searching HashMap with list of values
Passing a parameter into Duckling Clojure function from within Java application
Appium: Why is repeating touchAction: press&release frequently skip the input fields in a form?
How to hash SubjectPublicKeyInfo for certificate pinning using okhttp 3.x in Android
404 page when run as web application project
How to detect if two Strings in an array equal
LibGDX Table showing up too small on high DPI screens?
How to get an Array into Jlist
Output Arraylist String without brackets and commas
How to read in list objects to be serialized and deserialized using a different constructor?
Java - How Java decide where is infinity?
Read csv file with smooks
Build single Spring Boot WAR project for deployment
Dialog with email addresses
JavaFX: Access in FXML to a non-String-Object from a ResourceBundle
Auth filter in OSGi?

Categories

HOME
cakephp
compiler-construction
yii2
webpack
omnet++
youtube-dl
setup-deployment
google-oauth
elm
paw-app
microservices
binary-tree
gps
azure-storage-tables
gitpitch
gnupg
gz
fallback
carthage
tostring
database-replication
tapestry
url-scheme
ping
elasticsearch-net
buck
kendo-datasource
newline
gsoap
nouislider
bluestacks
titanium-mobile
gtrendsr
noraui
caret
avcapturesession
android-kernel
mozilla
swisscomdev
swift3.0.2
occlusion
streamsets
android-fingerprint-api
leading-zero
fedex
core-plot
elmah
botbuilder
galleria
sage-one
feeds
windows-iot-core-10
mako
wdf
static-ip-address
infix-notation
multi-level
yaws
suffix-tree
revolution-r
freelancer.com-api
historian
kendonumerictextbox
msys
jqgrid-formatter
security-testing
tarjans-algorithm
emailrelay
0xdbe
arcanist
apache-commons-fileupload
proj4js
npapi
modalpopup
jsonpickle
winddk
dml
reactfx
datagridviewcolumn
multiprocessor
.aspxauth
commoncrypto
odata4j
html4
orchardcms-1.7
smtp-auth
cassini-dev
angularjs-controller
dice
errai
reddot
netbeans-6.9
mod-auth
mongomapper
visitor-statistic
icanhaz.js
castle-monorail
user-friendly
microsoft-virtualization
boost-smart-ptr
pascal-fc
aquaticprime
3gp

Resources

Encrypt Message