GoogleCloudPlatform / gradle-appengine-templates

Freemarker based templates that build with the gradle-appengine-plugin
438 stars 205 forks source link

Unable to import HttpClient and HttpPost Libraries into ServletPostAsyncTask #62

Open troy21688 opened 8 years ago

troy21688 commented 8 years ago

When I add the ServletPostAsyncTask class, I am unable to import the relevant libraries. I read in Stack Overflow that I could update my build.grade with the following:

useLibrary 'org.apache.http.legacy'

However, when doing so, it looks like the HttpClient and HttpPost libraries are deprecated.

Please let me know what I am doing wrong and how I should proceed.

BazM01 commented 7 years ago

Having the same problem after updating Android Studio.

patflynn commented 7 years ago

@loosebazooka @akerekes

loosebazooka commented 7 years ago

This might have something to do with Android's dependency resolution, which seems to get messed up every now and then?

loosebazooka commented 7 years ago

Your ServeltPostAsyncTask will have to be updated to use HttpUrlConnection instead of HttpClient/Post.

BazM01 commented 7 years ago

Is there an example of how to do this?

I followed the instructions on on the tutorial https://cloud.google.com/appengine/docs/standard/java/endpoints/helloendpoints-android-studio

As I said, this worked until I updated android studio. I have since tried following the instructions on the link about migrating to 2.0 but so far only seemed to make things worse.

loosebazooka commented 7 years ago

Okay, sorry I bit out of date on this guide. It looks like it's using HttpUrlConnection already since this change https://github.com/GoogleCloudPlatform/gradle-appengine-templates/commit/c4c0486576dffa6d5932c2dde89aaa65d5128dbd

if that's not your issue, can you explain what it is?