Target host must not be null, or set in parameters

I get this error “Target host must not be null, or set in parameters”. My manifest file has internet permission set, and I have put ‘http://’ before my Url. It still gives the same error. My URL does not have a ‘www.’ attached to it.

Part of my Code:

  • Could not find class$Builder
  • The developers of this app have not set up this app properly for Facebook Login?
  • Android Studio Git Push Rejected
  • Android: How to query a list of bucket name
  • Android WallpaperManager crops image
  • Is there any 2D Game Engine Better than Libgdx?
  • HttpPost post = new HttpPost("http://infocreation.something_something1.xml");

    Part of my manifest is like below:

    <uses-permission android:name="android.permission.INTERNET/>

    What do I do now?

    Related posts:

    ListView and Buttons inside ListView
    Is it possible to specify multiple gravity values in spinner item custom_style.xml?
    TTS-UtteranceProgressListener not being called
    Android &ldquo;java.lang.RuntimeException: Parcelable encounteredClassNotFoundException reading ...
    Android ScaleAnimation
    Cordova Build Gradle Error while opening/extracting zip file
  • Hide soft keyboard on application load
  • How to get day of the month?
  • Android Unit Testing: Bundle/Parcelable
  • Android - event listener
  • What are the actual ms time values for Android's animTime constants?
  • Send SMS via intent
  • 3 Solutions collect form web for “Target host must not be null, or set in parameters”

    It should be

    HttpPost post = new HttpPost("http://www.infocreation.something.xml");

    So I replaced the URL, with almost the same URL, except without the underscore and that worked. I realized from further searches (for example here) that URLs with _(underscore) are not valid, although that particular URL may work. Thanks for all your help.

    Are you putting a real and working url inot the HttpPost constructor?

    Anyway this is your solution:

    If you have the following code failing:

    HttpGet httpget = new HttpGet("");

    Then the error is pretty easy to solve:
    The problem is that you have not added a protocol to the URL, so change it to:

    HttpGet httpget = new HttpGet("");

    And then it will work as wanted.


    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.