图一:我按照你们所写的类容,却打印不出请求的内容
2021-07-27 00:14:21.172 5437-5437/? I/.example.okhtt: Late-enabling -Xcheck:jni
2021-07-27 00:14:21.352 5437-5437/com.example.okhttp I/Perf: Connecting to perf service.
2021-07-27 00:14:21.408 5437-5470/com.example.okhttp I/.example.okhtt: The ClassLoaderContext is a special shared library.
2021-07-27 00:14:21.408 5437-5437/com.example.okhttp W/Binder:intercep: type=1400 audit(0.0:423073): avc: denied { getattr } for path="/data/data/com.miui.contentcatcher" dev="mmcblk0p87" ino=5240 scontext=u:r:untrusted_app:s0:c212,c256,c512,c768 tcontext=u:object_r:system_app_data_file:s0 tclass=dir permissive=0
2021-07-27 00:14:21.416 5437-5470/com.example.okhttp D/ViewContentFactory: initViewContentFetcherClass
2021-07-27 00:14:21.416 5437-5470/com.example.okhttp D/ViewContentFactory: getInterceptorPackageInfo
2021-07-27 00:14:21.416 5437-5470/com.example.okhttp W/.example.okhtt: Accessing hidden method Landroid/app/AppGlobals;->getInitialApplication()Landroid/app/Application; (light greylist, linking)
2021-07-27 00:14:21.417 5437-5470/com.example.okhttp D/ViewContentFactory: getInitialApplication took 1ms
2021-07-27 00:14:21.417 5437-5470/com.example.okhttp D/ViewContentFactory: packageInfo.packageName: com.miui.catcherpatch
2021-07-27 00:14:21.418 5437-5437/com.example.okhttp W/Binder:intercep: type=1400 audit(0.0:423074): avc: denied { getattr } for path="/data/data/com.miui.catcherpatch" dev="mmcblk0p87" ino=5646 scontext=u:r:untrusted_app:s0:c212,c256,c512,c768 tcontext=u:object_r:system_app_data_file:s0 tclass=dir permissive=0
2021-07-27 00:14:21.427 5437-5470/com.example.okhttp D/ViewContentFactory: initViewContentFetcherClass took 10ms
2021-07-27 00:14:21.427 5437-5470/com.example.okhttp I/ContentCatcher: ViewContentFetcher : ViewContentFetcher
2021-07-27 00:14:21.427 5437-5470/com.example.okhttp D/ViewContentFactory: createInterceptor took 11ms
2021-07-27 00:14:21.436 5437-5437/com.example.okhttp W/.example.okhtt: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (light greylist, reflection)
2021-07-27 00:14:21.438 5437-5437/com.example.okhttp W/.example.okhtt: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (light greylist, reflection)
2021-07-27 00:14:21.533 5437-5437/com.example.okhttp W/TabLayout: MODE_SCROLLABLE + GRAVITY_FILL is not supported, GRAVITY_START will be used instead
2021-07-27 00:14:21.610 5437-5471/com.example.okhttp I/Adreno: QUALCOMM build : 6c0fbe4, I4f6179b11f
Build Date : 03/05/20
OpenGL ES Shader Compiler Version: EV031.26.03.02
Local Branch :
Remote Branch : refs/tags/AU_LINUX_ANDROID_LA.UM.7.11.R1.09.00.00.542.027
Remote Branch : NONE
Reconstruct Branch : NOTHING
2021-07-27 00:14:21.610 5437-5471/com.example.okhttp I/Adreno: Build Config : S P 6.0.9 AArch64
2021-07-27 00:14:21.608 5437-5437/com.example.okhttp W/RenderThread: type=1400 audit(0.0:423075): avc: denied { search } for name="proc" dev="debugfs" ino=11238 scontext=u:r:untrusted_app:s0:c212,c256,c512,c768 tcontext=u:object_r:kgsl_debugfs:s0 tclass=dir permissive=0
2021-07-27 00:14:21.613 5437-5471/com.example.okhttp I/Adreno: PFP: 0x016ee183, ME: 0x00000000
2021-07-27 00:14:21.621 5437-5471/com.example.okhttp I/ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
2021-07-27 00:14:21.623 5437-5471/com.example.okhttp I/ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
2021-07-27 00:14:21.624 5437-5471/com.example.okhttp I/OpenGLRenderer: Initialized EGL, version 1.4
2021-07-27 00:14:21.624 5437-5471/com.example.okhttp D/OpenGLRenderer: Swap behavior 2
2021-07-27 00:14:21.676 5437-5437/com.example.okhttp E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
2021-07-27 00:14:21.676 5437-5437/com.example.okhttp E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
2021-07-27 00:14:29.361 5437-5466/com.example.okhttp I/.example.okhtt: ProcessProfilingInfo new_methods=664 is saved saved_to_disk=1 resolve_classes_delay=8000
Java代码
import com.example.okhttp.model.Api;
import com.example.okhttp.model.domain.Categories;
import com.example.okhttp.presenter.IHomePresenter;
import com.example.okhttp.utils.LogUtils;
import com.example.okhttp.utils.RetrofitManager;
import com.example.okhttp.view.IHomeCallback;
import java.net.HttpURLConnection;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
public class HomePresenterImpl implements IHomePresenter {
@Override
public void getCategories() {
Retrofit retrofit = RetrofitManager.getInstance().getRetrofit();;
Api api = retrofit.create(Api.class);
Call<Categories> task = api.getCategories();
task.enqueue(new Callback<Categories>() {
@Override
public void onResponse(Call<Categories> call, Response<Categories> response) {
int code = response.code();
LogUtils.d(HomePresenterImpl.this,"result code is -->"+code);
if (code == HttpURLConnection.HTTP_OK){
Categories categories = response.body();
assert categories != null;
LogUtils.d(HomePresenterImpl.this,categories.toString());
}else {
LogUtils.i(HomePresenterImpl.this,"请求失败...");
}
}
@Override
public void onFailure(Call<Categories> call, Throwable t) {
LogUtils.e(this,"请求错误..."+t);
}
});
}
@Override
public void registerCallback(IHomeCallback callback) {
}
@Override
public void unregisterCallback(IHomeCallback callback) {
}
}
图二:当我导入这个依赖类时,就爆出这找不到此类的错误,所以只能屏蔽此

模块依赖检查其实很简单的
1、首先你要保证你的工程是不是包含了这个模块,settings.gradle是否include了?
2、对应模块的build.gradle文件有没有apply plugin: 'com.android.library'
3、最后才是在业务模块里的build.gradle去引用这个模块
另外二维码这块建议使用华为统一方案,比Zxing方便且好用,还有我不觉得照着视频抄代码就一定没问题,同样的代码会有不同的呈现很正常,你应该追根溯源,而不是说为什么照着打会有问题,堆栈一般会告诉你错在哪里,没有错误堆栈就打断点调试或者自己加一些日志
找不到此类的错误,所以只能屏蔽此?