android - 为 Facebook screenshot-tests-for-android 设置 gradle 插件的问题
问题描述
我需要为android实现屏幕截图测试。
我已按照https://facebook.github.io/screenshot-tests-for-android/#gradle-setup上的步骤操作,并在我的 gradle 文件中包含以下内容
buildscript {
// ...
dependencies {
// ...
classpath 'com.facebook.testing.screenshot:plugin:0.9.0'
}
}
apply plugin: 'com.facebook.testing.screenshot'
但是,我收到一个错误
评估根项目“app-android”时出现问题。无法应用插件 [id 'com.facebook.testing.screenshot'] 未找到名称为 'androidTestImplementation' 的配置。
我的 build.gradle 中有以下内容
androidTestImplementation 'androidx.test:core:1.1.0'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
androidTestImplementation 'androidx.multidex:multidex-instrumentation:2.0.0'
我找不到任何证据表明我需要其他任何东西。
我还在https://github.com/facebook/screenshot-tests-for-android上看到了
您需要 python-2.7 才能使 gradle 插件工作,我们还建议安装记录和验证屏幕截图所需的 python-pillow 库。
我已经安装了它,看到我有版本 2.7.16 我还安装了推荐的枕头(v6.0.0)
解决方案
您可能需要移动此行:
apply plugin: "com.facebook.testing.screenshot"
进入模块级别build.gradle
。它必须低于这一行:
apply plugin: "com.android.application"
因为那是它的androidTestImplementation
来源。
推荐阅读
- excel - Excel 我可以手动添加列以查询和保留行完整性-链接-当原始表行数更改时?
- kubernetes - 您与此站点的连接不安全(nginx 入口)
- javascript - 如何对按钮进行缩放效果?
- android - 非静态方法 filterdList(ArrayList
) 不能从静态上下文中引用 - java - 读取 Blob 文件而不将其保存为文件
- javascript - 使用 Fetch 返回的 Promise 不响应 .then()
- python - 根据 Python 中第二个列表中的值从第一个列表中复制项目
- php - 如何将默认子数组值应用于关联多维数组?
- node.js - 如何使用 gcloud compute nodejs 客户端分配 serviceAccount?
- jquery - 问题:打开后立即关闭窗口的Jquery打印