【问题标题】:How to convert below java build.gradle to android build.gradle如何将以下 java build.gradle 转换为 android build.gradle
【发布时间】:2019-11-01 04:31:12
【问题描述】:

想要将 reportPortal 集成到我的 Espresso 自动化中。 reportPortal 给出了以下 gradle 配置以添加到项目的 main build.gradle 中。问题是,只要 gradle 是基于 java 的,而我的项目是基于 android 的。

apply plugin: 'java'
sourceCompatibility = 1.8
targetCompatibility = 1.8

description = 'ReportPortal JUnit 4 example'

repositories {
    mavenLocal()
    mavenCentral()
    jcenter()
    maven { url 'https://jitpack.io' }
    maven { url "http://dl.bintray.com/epam/reportportal" }
}

dependencies {
    compile 'com.epam.reportportal:logger-java-log4j:4.0.1'
    compile 'com.epam.reportportal:agent-java-junit:4.1.10'
}

ext {
    junitFoundation = configurations.compile.resolvedConfiguration.resolvedArtifacts.find { it.name == 'junit-foundation' }
}

test.doFirst {
    jvmArgs "-javaagent:${junitFoundation.file}"
}

test {
//  debug true
    testLogging.showStandardStreams = true
}

我已经尝试过以下事情。

  • 我已将其删除,因为它要求提供 android 插件。
apply plugin: 'java'
sourceCompatibility = 1.8
targetCompatibility = 1.8
  • 我已将依赖项升级到
androidTestImplementation group: 'com.epam.reportportal', name: 'logger-java-log4j', version: '5.0.0-BETA-2'
androidTestImplementation group: 'com.epam.reportportal', name: 'agent-java-junit', version: '5.0.0-BETA-3'
  • 我将test 转换为testOptions

但它不起作用。需要帮助来修复它。

【问题讨论】:

  • 以下链接可能对您有所帮助。 Link
  • @DHAVALASODARIYA,谢谢,但帮助不大。

标签: android gradle build.gradle reportportal


【解决方案1】:

请尝试此解决方案

项目级 build.gradle

使用

maven { url "https://www.jitpack.io" }

而不是

maven { url "https://jitpack.io" }

【讨论】:

  • 这不会有任何区别
  • 错误部分不在您的解决方案中。它在“测试”模块中。
  • 但我不明白你的问题。你的问题在哪里?
猜你喜欢
  • 2020-06-06
  • 2023-02-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多