在android系统无法解析符号'Defaulthttpclient'和'Httppost“ [英] Can't resolve symbol 'Defaulthttpclient' and 'Httppost' in android

查看:1042
本文介绍了在android系统无法解析符号'Defaulthttpclient'和'Httppost“的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建立一个新的project.but我有一个小的疑难问题不能使用 DefaultHttpClient HttpPost 即使我用它在我的previous项目了。

i build a new project.but i have a little problem.i can't use DefaultHttpClient and HttpPost even after i use it in my previous project already.

有任何外部librery我要补充的吗?

Is there any external librery i have to add?

我不知道我该如何使用这一两者。

i don't know how can i use both of this.

帮我这个问题。

我的build.gradle

My build.gradle

apply plugin: 'com.android.application'

    android {
        compileSdkVersion 23
        buildToolsVersion "22.0.1"

        defaultConfig {
            applicationId "Id"
            minSdkVersion 14
            targetSdkVersion 23
            versionCode 1
            versionName "1.0"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }

    }

    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile 'com.android.support:appcompat-v7:23.0.1'
        compile files('libs/httpcore-4.3.3.jar')
        compile files('libs/httpmime-4.3.6.jar')
    }

在此先感谢.........

Thanks in advance.........

推荐答案

有两种不同的DefaultHttpClient类是在坛子里可用,您输入错了,结果
除去进口的 DefaultHttpClient 从你的类文件,并添加这一项,

There are two different DefaultHttpClient classes are available in the jars, you imported the wrong one,
Remove the import of DefaultHttpClient from your class file, and add this one,

import org.apache.http.impl.client.DefaultHttpClient;

一件事,它不应该是HttpPost,这将是HttpClient的
完整的例子,

One more thing, It should not be HttpPost, it will be HttpClient complete example,

import org.apache.http.impl.client.DefaultHttpClient;
HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost();

这篇关于在android系统无法解析符号'Defaulthttpclient'和'Httppost“的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆