Fixed
Status Update
Comments
uc...@google.com <uc...@google.com>
sp...@google.com <sp...@google.com>
sp...@google.com <sp...@google.com>
so...@google.com <so...@google.com> #2
this does what you want:
adb shell ls '"hello world"'
why two sets of quotes? because there are two shells. your local one, and the remote one. if you want the remote shell to pass a single argument to ls, you need to pay the local shell a pair of quotes so that it passes a single argument to the remote shell, and then another pair of quotes to the remote shell.
if you find this confusing, just "adb shell" lets you talk directly to the remote shell.
adb shell ls '"hello world"'
why two sets of quotes? because there are two shells. your local one, and the remote one. if you want the remote shell to pass a single argument to ls, you need to pay the local shell a pair of quotes so that it passes a single argument to the remote shell, and then another pair of quotes to the remote shell.
if you find this confusing, just "adb shell" lets you talk directly to the remote shell.
sp...@google.com <sp...@google.com> #3
Yuriy, "${buildDir}/generated/res" is present in AndroidModulePaths. Is it not expected?
so...@google.com <so...@google.com> #4
Since the directory was explicitly declared as a source folder I'd assume it is expected and I don't think that its name should make it generated. Someone can have a directory named generated
which is a regular source directory.
In some places we assume that all files in the project's build directory are generated. I think it is closer to be correct and if you wish you can exclude them using AndroidModel.isGenerated
.
However, I think that the the project Gradle configuration should be fixed in the first place. In Android there are APIs to register directories and tasks producing them as generated. See BaseVariant.registerGeneratedResFolders
and similar methods. These folders should not appear in AndroidModulePaths
.
sp...@google.com <sp...@google.com> #5
If the project Gradle configuration is incorrect, it should probably be flagged as such.
xa...@google.com <xa...@google.com> #6
Generated resource folder should be registered via our variant API. Without it, we don't handle additional res folder any differently than the default one, no matter where it is.
Try doing this:
FileCollection fc = project.files("${buildDir}/generated/res")
android {
applicationVariants.all { variant ->
variant.registerGeneratedResFolders(fc)
}
}
if you are running that script from a task you can add the task dependency to the file collection:
FileCollection fc = project.files("${buildDir}/generated/res").builtBy(myTask)
this will ensure that the task is called at the right time (if you are doing a manual dependsOn you can stop doing it)
Try doing this:
FileCollection fc = project.files("${buildDir}/generated/res")
android {
applicationVariants.all { variant ->
variant.registerGeneratedResFolders(fc)
}
}
if you are running that script from a task you can add the task dependency to the file collection:
FileCollection fc = project.files("${buildDir}/generated/res").builtBy(myTask)
this will ensure that the task is called at the right time (if you are doing a manual dependsOn you can stop doing it)
Description
Build #AI-191.8026.42.35.5977832, built on October 30, 2019
Version of Gradle Plugin: 3.5.2
Version of Gradle: 5.4.1
JRE: 1.8.0_202-release-1483-b49-5587405 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.15.1
I'm doing the following so that some resources added by a gradle script can be referenced in code:
sourceSets {
main.res.srcDirs = ['src/main/res', "${buildDir}/generated/res"]
}
This works normally, except when you right click on the drawable folder, and use the new Vector Asset or Image Asset tool. Resources created from this tool are placed in the `build/generated/res` folder instead of the `src/main/res` folder. The other new resource commands, e.g. new Drawable resource file, place their resources in the correct `src/main/res` folder.
Essentially, what this means is that you add a bunch of new vector drawables, edit them, etc, and then as soon as you hit build, they vanish as the build folder is cleaned. Really annoying and easy to lose a lot of work.
I've also tried the following:
sourceSets {
main.res.srcDirs = ["${buildDir}/generated/res", 'src/main/res']
}
This results in the opposite problem, where new Vector Assets and Image assets are placed in the `src/main/res` folder, but all other new resources get put in the build folder.