android 微信支付Demo遇到的问题,org.apache.http.legacy Library 的导入

1、httpclient错误

官方给的demo是eclipse的,就用as通过import project的方式打开了这个demo。打开之后导包org.apache.http的错误,

在as中解决httpclient的办法,打开app里的build.gradle

 

解决方法:

在android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
}
后面加上 useLibrary 'org.apache.http.legacy',就没问题了。

android {
useLibrary 'org.apache.http.legacy'
}

注意放置的位置:是在android {}中

有的小伙伴可能会下载失败,在这里提供一个jar包

下载jar包导入项目就可以了

也可以用于Eclipse的项目

org.apache.http.legacy.jar


2.还有一个图片资源为jpg的问题

在app下面的Gradle android 下 添加下面代码即可

也可以手动是修改图片


aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
 
 
 
 
android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
   //
    aaptOptions.cruncherEnabled = false
    aaptOptions.useNewCruncher = false
    defaultConfig {
        applicationId "net.sourceforge.simcpux"
        minSdkVersion 4
        targetSdkVersion 25
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
    useLibrary 'org.apache.http.legacy'
}


猜你喜欢

转载自blog.csdn.net/qq_29983773/article/details/72870195