title: Yandex API Translator not working on Android Aplication
body: <p>I'm trying to use the Yandex translator in my Android application, but it is giving an error. When tested in a Java application (in the main), it works perfectly. What is my problem?</p>
  
  <p>Main code:</p>
  
  <pre><code>import com.rmtheis.yandtran.language.Language;
  import com.rmtheis.yandtran.translate.Translate;
  import com.veryinteligent.jarvas.R;
  
  import com.veryinteligent.jarvas.activity.WordCommands;
  
  import android.app.Activity;
  import android.os.Bundle;
  
  public class YandexTranslator extends Activity{
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          // TODO Auto-generated method stub
          super.onCreate(savedInstanceState);
          setContentView(R.layout.wordcommands);
          Translate.setKey(WordCommands.myKey);
          String term = "obrigado por me ajudar";
          try {
              term = Translate.execute(term, Language.PORTUGUESE, Language.ENGLISH);
          } catch (Exception e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
          System.out.println(term);
      }
  }  
  
  import com.rmtheis.yandtran.language.Language;
  import com.rmtheis.yandtran.translate.Translate;
  
  public class TranslationTester {
  
      public static void main(String[] args) {
          // TODO Auto-generated method stub
          Translate.setKey("trnsl.1.1.20160515T173032Z.cb8002677c95725e.93f4f996a1647d5d0c6e336758723a8bb1bb41b4");
  
          String term = "abrir vá";
          try {
              term = Translate.execute(term, Language.PORTUGUESE, Language.ENGLISH);
          } catch (Exception e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
          System.out.println(term);
  
      }
  
  }
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>08-11 16:10:35.333: I/dalvikvm(1152): Could not find method org.json.simple.JSONValue.parse, referenced from method com.rmtheis.yandtran.YandexTranslatorAPI.jsonObjValToStringArr
  08-11 16:10:35.333: W/dalvikvm(1152): VFY: unable to resolve static method 15804: Lorg/json/simple/JSONValue;.parse (Ljava/lang/String;)Ljava/lang/Object;
  08-11 16:10:35.333: D/dalvikvm(1152): VFY: replacing opcode 0x71 at 0x0000
  08-11 16:10:35.333: D/dalvikvm(1152): VFY: dead code 0x0003-0015 in Lcom/rmtheis/yandtran/YandexTranslatorAPI;.jsonObjValToStringArr (Ljava/lang/String;Ljava/lang/String;)[Ljava/lang/String;
  08-11 16:10:35.333: I/dalvikvm(1152): Could not find method org.json.simple.JSONValue.parse, referenced from method com.rmtheis.yandtran.YandexTranslatorAPI.retrievePropString
  08-11 16:10:35.333: W/dalvikvm(1152): VFY: unable to resolve static method 15804: Lorg/json/simple/JSONValue;.parse (Ljava/lang/String;)Ljava/lang/Object;
  08-11 16:10:35.333: D/dalvikvm(1152): VFY: replacing opcode 0x71 at 0x0004
  08-11 16:10:35.333: D/dalvikvm(1152): VFY: dead code 0x0007-0012 in Lcom/rmtheis/yandtran/YandexTranslatorAPI;.retrievePropString (Ljava/net/URL;Ljava/lang/String;)Ljava/lang/String;
  08-11 16:10:35.333: W/System.err(1152): java.net.UnknownHostException: translate.yandex.net
  08-11 16:10:35.333: W/System.err(1152):     at java.net.InetAddress.lookupHostByName(InetAddress.java:497)
  08-11 16:10:35.333: W/System.err(1152):     at java.net.InetAddress.getAllByNameImpl(InetAddress.java:294)
  08-11 16:10:35.333: W/System.err(1152):     at java.net.InetAddress.getAllByName(InetAddress.java:256)
  08-11 16:10:35.333: W/System.err(1152):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.&lt;init&gt;(HttpConnection.java:69)
  08-11 16:10:35.333: W/System.err(1152):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.&lt;init&gt;(HttpConnection.java:48)
  08-11 16:10:35.333: W/System.err(1152):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection$Address.connect(HttpConnection.java:322)
  08-11 16:10:35.333: W/System.err(1152):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionPool.get(HttpConnectionPool.java:89)
  08-11 16:10:35.333: W/System.err(1152):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getHttpConnection(HttpURLConnectionImpl.java:285)
  08-11 16:10:35.333: W/System.err(1152):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.makeConnection(HttpURLConnectionImpl.java:267)
  08-11 16:10:35.333: W/System.err(1152):     at org.apache.harmony.luni.internal.net.www.protocol.https.HttpsURLConnectionImpl$HttpsEngine.makeSslConnection(HttpsURLConnectionImpl.java:406)
  08-11 16:10:35.333: W/System.err(1152):     at org.apache.harmony.luni.internal.net.www.protocol.https.HttpsURLConnectionImpl$HttpsEngine.makeConnection(HttpsURLConnectionImpl.java:387)
  08-11 16:10:35.333: W/System.err(1152):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.retrieveResponse(HttpURLConnectionImpl.java:1018)
  08-11 16:10:35.333: W/System.err(1152):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:726)
  08-11 16:10:35.333: W/System.err(1152):     at org.apache.harmony.luni.internal.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:121)
  08-11 16:10:35.333: W/System.err(1152):     at com.rmtheis.yandtran.YandexTranslatorAPI.retrieveResponse(YandexTranslatorAPI.java:76)
  08-11 16:10:35.333: W/System.err(1152):     at com.rmtheis.yandtran.YandexTranslatorAPI.retrievePropArrString(YandexTranslatorAPI.java:104)
  08-11 16:10:35.333: W/System.err(1152):     at com.rmtheis.yandtran.translate.Translate.execute(Translate.java:52)
  08-11 16:10:35.333: W/System.err(1152):     at com.veryinteligent.jarvas.activity.YandexTranslator.onCreate(YandexTranslator.java:22)
  08-11 16:10:35.333: W/System.err(1152):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
  08-11 16:10:35.333: W/System.err(1152):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
  08-11 16:10:35.333: W/System.err(1152):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
  08-11 16:10:35.333: W/System.err(1152):     at android.app.ActivityThread.access$1500(ActivityThread.java:117)
  08-11 16:10:35.333: W/System.err(1152):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
  08-11 16:10:35.333: W/System.err(1152):     at android.os.Handler.dispatchMessage(Handler.java:99)
  08-11 16:10:35.333: W/System.err(1152):     at android.os.Looper.loop(Looper.java:130)
  08-11 16:10:35.333: W/System.err(1152):     at android.app.ActivityThread.main(ActivityThread.java:3683)
  08-11 16:10:35.333: W/System.err(1152):     at java.lang.reflect.Method.invokeNative(Native Method)
  08-11 16:10:35.333: W/System.err(1152):     at java.lang.reflect.Method.invoke(Method.java:507)
  08-11 16:10:35.333: W/System.err(1152):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
  08-11 16:10:35.333: W/System.err(1152):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
  08-11 16:10:35.333: W/System.err(1152):     at dalvik.system.NativeStart.main(Native Method)
  08-11 16:10:35.333: I/System.out(1152):
  </code></pre>