Error when running this with Gradle 7.0
cristan opened this issue · comments
When I run this plugin with Gradle 6.8.2 it runs fine, but when I run it with Gradle 7.0, I get the following error:
> Task :app:downloadLocaliseTranslations FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Some problems were found with the configuration of task ':app:downloadLocaliseTranslations' (type 'DownloadLocoTranslations').
- Type 'DownloadLocoTranslations' property 'exportUrl' is missing an input or output annotation.
Reason: A property without annotation isn't considered during up-to-date checking.
Possible solutions:
1. Add an input or output annotation.
2. Mark it as @Internal.
Please refer to https://docs.gradle.org/7.0/userguide/validation_problems.html#missing_annotation for more details about this problem.
A workaround is to not use this plugin until it's updated and define your own task instead:
task downloadLocaliseTranslations {
description 'Downloads all translation from localise'
ext.apiKey = 'my_key'
doLast {
def f = new File("${project.projectDir}/src/main/res/values/strings.xml")
// see https://localise.biz/api#!/export/exportLocale for the possible variables. For example: add &filter=android to only get translations tagged with "android"
def url = "https://localise.biz/api/export/locale/en.xml?format=android&key=${apiKey}"
new URL(url).withInputStream{ i -> f.withOutputStream{ it << i }}
}
}