Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.7 ignores renamed flavour output name #181

Closed
Bananeweizen opened this issue Jun 18, 2017 · 8 comments
Closed

0.7 ignores renamed flavour output name #181

Bananeweizen opened this issue Jun 18, 2017 · 8 comments

Comments

@Bananeweizen
Copy link

We rename the output file in one flavour, see lines 202 and following of this build script. This worked well up to 0.6.4. Since 0.7.0, the dexcount invocation looks for the original (non renamed) output file, thereby breaking the build:

* What went wrong:
A problem was found with the configuration of task ':main:countBasicDebugDexMethods'.
> File '/home/jenkins/slave/workspace/cgeo continuous integration/main/build/outputs/apk/cgeo-basic-debug.apk' specified for property 'inputFile' does not exist.
Bananeweizen added a commit to cgeo/cgeo that referenced this issue Jun 18, 2017
dexcount 0.7 cannot handle renamed variant output files.
KeepSafe/dexcount-gradle-plugin#181
@benjamin-bader
Copy link
Collaborator

Good to know - thanks for the report!

@vanniktech
Copy link
Contributor

You shouldn't do it like that. There's an archieveBasename property which you can use.

@benjamin-bader
Copy link
Collaborator

That's true, and the linked script will fail hard on upgrade to Android Studio 3, but in the meantime this is something we can likely fix very easily.

Be that as it may, archiveBasename (or whatever it's called) is definitely the right way forward.

@jp1017
Copy link

jp1017 commented Jun 19, 2017

same issue of 0.7.0 . 😭

@Bananeweizen
Copy link
Author

Can I really use archivesBasename to modify the output of a single build type (and not for all build types together)?

And why do you think that renaming the output will no longer work at all in android-gradle 3.0? Reading https://developer.android.com/studio/preview/features/new-android-plugin-migration.html#variant_api I would expect that our build script just needs to use all() instead of each(), since the given example is very similar to what we do. Or did I miss something here?

I will experiment a bit with the given example code and the 3.0 plugin, to maybe find a workaround on our side.

@benjamin-bader
Copy link
Collaborator

And why do you think that renaming the output will no longer work at all in android-gradle 3.0? Reading https://developer.android.com/studio/preview/features/new-android-plugin-migration.html#variant_api I would expect that our build script just needs to use all() instead of each(), since the given example is very similar to what we do. Or did I miss something here?

Because your script invokes output.outputFile, which (at least in alpha1 and alpha3) just throws a runtime exception. outputFileName is a separate property, though its name makes that fact easy to overlook.

I think I must have misunderstood your use case; I haven't ever tried that with archiveBasename. outputFileName, from the link you posted, seems like it would work.

benjamin-bader added a commit that referenced this issue Jun 20, 2017
This commit refactors the task into an abstract base and two concrete implementations, one for AGP 2 and one for AGP 3. This removes the dual-optional-input model. The legacy task is not incremental, and just holds a reference to the BaseVariantOutput, the way it used to. The modern task remains incremental.

Fixes #181
@benjamin-bader
Copy link
Collaborator

FYI, I've just released version 0.7.1, which fixes this issue.

@jp1017
Copy link

jp1017 commented Jun 23, 2017

@benjamin-bader great job, 0.7.1 works perfect. 👍 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants