Announcement Announcement Module
No announcement yet.
Spring for Android does not run on JVM Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring for Android does not run on JVM

    I'm writing some tests for Spring for Android and I copied the sample code and the neccassary libs in my Java project but I always get the following error:

    Exception in thread "main" java.lang.UnsatisfiedLinkError: android.util.Log.isLoggable(Ljava/lang/String;I)Z
    at android.util.Log.isLoggable(Native Method)
    at or.createRequest(
    at org.springframework.web.client.RestTemplate.doExec ute(
    at org.springframework.web.client.RestTemplate.execut e(
    at org.springframework.web.client.RestTemplate.getFor Object(
    at Main.springTest(
    at Main.main(
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De
    at java.lang.reflect.Method.invoke(
    at com.intellij.rt.execution.application.AppMain.main (
    Here's the sample code:

    private static void springTest() {
        // The connection URL
        String url = "" +
        // Create a new RestTemplate instance
        RestTemplate restTemplate = new RestTemplate();
        // Add the String message converter
        restTemplate.getMessageConverters().add(new StringHttpMessageConverter());
        // Make the HTTP GET request, marshaling the response to a String
        String result = restTemplate.getForObject(url, String.class, "Android"); // <-- Here raises the Exception!
    I'm running this on Oracle JVM. Is maybe this the problem?

    Thanks in advance!

  • #2
    I'am not sure, but look at the URI you are trying to access. Which protocol is being used? It seems you have not configured RestTemplate for HTTPS. I have found this thread at stackoverflow, check it out:

    If you created this just for trying


    • #3
      If you are trying to build JVM based applications, please use RestTemplate available in the spring-web module of Spring Framework. Spring for Android is expecting an Android runtime. The error you are seeing is because android.util.Log cannot be found.


      • #4
        Ok, thx for your reply!

        Best regards