1.导包:
import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpResponse; import lombok.extern.slf4j.Slf4j; import org.apache.commons.codec.binary.Base64; import org.apache.commons.lang3.StringUtils; import org.springframework.http.HttpMethod;
提示找不到包,需要导入依赖
在Android的Module: xxapp build.gradle 里面添加
dependencies { implementation 'cn.hutool:hutool-all:5.4.1' // implementation 'org.slf4j:slf4j-android:17.32' implementation 'org.projectlombok:lombok:1.18.10' implementation 'commons-codec:commons-codec:1.9' // implementation 'org.springframework:spring-webmvc:5.2.4.RELEASE' implementation 'org.springframework:spring-webmvc:5.3.9' implementation 'org.apache.commons:commons-lang3:3.6'
导入依赖,报错:More than one file was found with OS independent path ‘META-INF/license.txt’.
在这里添加
packagingOptions {
exclude 'META-INF/license.txt'
exclude 'META-INF/spring.schemas'
exclude 'META-INF/spring.tooling'
exclude 'META-INF/spring.handlers'
exclude 'META-INF/notice.txt'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}