Butterknife: Butterknife 10.0.0 and Feature plugin do not work

Created on 28 Jan 2019  路  16Comments  路  Source: JakeWharton/butterknife

I mentioned it here: https://github.com/JakeWharton/butterknife/pull/1402 but MR is already closed.

In project with com.android.feature, the location of R.txt is a bit different, what leads to an error

> java.io.FileNotFoundException: .../my_app/features/{module}/build/intermediates/symbols/feature/debug/R.txt (No such file or directory)

It seems that Gradle Plugin 3.3 puts this file into:
.../my_app/features/{module}/build/intermediates/symbols/debug/R.txt
(no /feature/ part)

Help Wanted bug

All 16 comments

@frogermcs can you be more specific ? We are using gradle 3.3 and BK 10 and we have no such issue..

Are you using the feature plugin?

Yes we use apply plugin: 'com.android.feature' instead of library.

Sorry I wasn't replying to you. That was in the original report and is presumably the source of the trouble.

Duplicate of #1451

I think you have that backwards

After several tests, it turned out that this error occurs when the R2 file generation is used in the baseFeature and in an instant app feature at the same time.
I ll advice to move all the UI codebase which needs the R2 class file from the the baseFeature to the specific module (Instant app feature) you are using.
Hope this ll help.

Hey, while it can be great workaround, it's not that simple in our case. The multimodule architecture becomes pretty complex and there are UI components modules reused in higher level ones.

Anyway it doesn't come from the butterknife plugin, if there is a failure it s because the file is not created previously :
/build/intermediates/symbols/feature/debug/R.txt (No such file or directory)
This file is not generated by butterKnife, so it's in feature or baseFeature that there is an issue.

This file is generated in other directory like I mentioned in first message.

Gets this one:

* What went wrong:
Execution failed for task ':features:transaction:generateDebugFeatureR2'.
> java.io.FileNotFoundException: ...dev/jenkins/workspace/d-app_feature_migrate_AS_33-LM7AGHCBO6KD7O3WL344QWYUEFXRSWGFGB6I23T74ZK4WV7FCPVA/features/transaction/build/intermediates/symbols/feature/debug/R.txt (No such file or directory)

While R.txt is there, but in different dir:

.../features/transaction/build/intermediates/symbols/debug/R.txt

.../features/transaction/build/intermediates/symbols/debug/R.txt

this one contains the res id and layout of the baseFeature with all the resource of the dependecies.

java.io.FileNotFoundException: ...dev/jenkins/workspace/d-app_feature_migrate_AS_33-LM7AGHCBO6KD7O3WL344QWYUEFXRSWGFGB6I23T74ZK4WV7FCPVA/features/transaction/build/intermediates/symbols/feature/debug/R.txt
this one should contains the id and layout of the res of the feature only.

Use only the symbol/debug/R.txt ll not resolve the issue.

Ahh I see...

Also I recreated this problem in much simpler project.

Here's the branch with code: https://github.com/frogermcs/MultiModuleGithubClient/tree/update_to_AS_3.3
And output from the build: https://travis-ci.com/frogermcs/MultiModuleGithubClient/jobs/179287644

Interesting fact is that in this chain of features:
repositories -> repository -> base
only the middle one doesn't have /symbols/feature/debug/R.txt 馃

Early tests of the fix in gradle plugin 3.5.0 alpha12 show that it may be fixed now. :)

Working code:
https://github.com/frogermcs/MultiModuleGithubClient/tree/update_to_AS_3.3

Working build process:
https://travis-ci.com/frogermcs/MultiModuleGithubClient/builds/109270546

Great! I'm going to preemptively close. Let me know if anything changes in the future.

Early tests of the fix in gradle plugin 3.5.0 alpha12 show that it may be fixed now. :)

Working code:
https://github.com/frogermcs/MultiModuleGithubClient/tree/update_to_AS_3.3

Working build process:
https://travis-ci.com/frogermcs/MultiModuleGithubClient/builds/109270546

So exactly which was the solution? I don麓t have the plugin and I'm able to use your project. This is what I have; however, my projects fail when R2 is not found.

dependencies {
        classpath 'com.android.tools.build:gradle:3.4.1'
        classpath 'com.jakewharton:butterknife-gradle-plugin:10.1.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }

In the sub-project I'm using apply plugin: 'com.android.dynamic-feature', maybe that's my issue.
Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shehabic-work picture shehabic-work  路  3Comments

alejandro-pnz picture alejandro-pnz  路  3Comments

ZakTaccardi picture ZakTaccardi  路  3Comments

Pitel picture Pitel  路  3Comments

Yousha picture Yousha  路  3Comments