小编Asi*_*ari的帖子

Retrofit 2 enqueue 将失败,但在 http 响应中得到 200(Android REST)

登录的主要调用:

public void work(){

        api = createService(context, XYZapi.class);
        Call<HashMap<String, String>> repo = api.doLogin(login);

        repo.enqueue(new Callback<HashMap<String, String>>() {
            @Override
            public void onResponse(Call<HashMap<String, String>> call, Response<HashMap<String, String>> response) {
                Headers headers = response.headers();
                mAuth = headers.get("Authorization");
                // get header value
                String cookie = response.headers().get("Set-Cookie");
                // TODO
                if (response.headers().get("Authorization")!= null) {
                    Log.d(TAG, "onResponse: "+response.body());
                    Log.d(TAG, "onResponse: "+response.headers().get("Authorization"));
                    mAuth = response.headers().get("Authorization");
                    callConfig();
                }
                Log.d(TAG, "onResponse error : "+response.errorBody().toString());

            }

            @Override
            public void onFailure(Call<HashMap<String, String>> call, Throwable t) {
                Log.d(TAG, "onFailure: "+t.getCause());
            }
        });
Run Code Online (Sandbox Code Playgroud)

} …

rest android gson retrofit retrofit2

5
推荐指数
0
解决办法
450
查看次数

OnePlus Expresso 测试运行问题 (Android Studio 3.6.2)

我是一名 Android 开发人员,面临着一个非常严重的问题,但在任何地方都没有提到解决方案。

我正在尝试在我的 oneplus6t 上运行 Expresso 自动化测试。但是一年中的每一次我都无法测试。

错误信息是这样的:

"Testing started at 09:46 AM ...
04/20 09:46:21: Launching 'ASyncSettingsTest' on OnePlus ONEPLUS A6010.
Running tests
$ adb shell am instrument -w -r -e debug false -e class 'com.declaree.declaree.ASyncSettingsTest' com.demo.test/androidx.test.runner.AndroidJUnitRunner
Timed out waiting for process (com.demo) to appear on oneplus-oneplus_a6010-21663687."
Run Code Online (Sandbox Code Playgroud)

它适用于模拟器和其他制造设备,如像素、moto、三星。

我在开发人员选项中也没有找到类似的东西。

为了运行测试,我必须自己打开应用程序然后它才能运行。

仅供参考:重启、重置、擦除缓存不起作用。

我在 Android Studio 3.6.2 中工作

有人有任何解决方案吗?提前致谢。

android automated-tests android-espresso oneplus6t

2
推荐指数
1
解决办法
149
查看次数