I'd recommend using the "preBuild" task instead if you don't need it to be 
variant specific, which removes the need for the afterEvaluate.

I suspect the issue is just timing, if your afterEvaluate happens before 
the android gradle plugin's then there will be issues, and the order is not 
guaranteed. I'd suggest looking at using TaskCollection.whenTaskAdded for 
that purpose. Note that these task names are not a supported API so might 
break between versions.

On Tuesday, 27 September 2016 14:03:53 UTC+1, Maxim Khitrov wrote:
>
> Anyone? I have the exact same problem with this configuration in 
> another project: 
>
> afterEvaluate { 
>     compileDebugNdk.dependsOn compileDebugNdkCustom 
>     compileReleaseNdk.dependsOn compileReleaseNdkCustom 
> } 
>
> All of these tasks are still listed if I run `gradle tasks --all`, but 
> they are not defined in afterEvaluate stage as of v2.2.0. Would really 
> appreciate some help with this. 
>
> On Fri, Sep 23, 2016 at 8:12 AM, Maxim Khitrov <m...@mxcrypt.com 
> <javascript:>> wrote: 
> > I have the following block in my build.gradle to generate Java sources 
> > with the protobuf compiler: 
> > 
> > afterEvaluate { 
> >     generateDebugSources.dependsOn compileProtobuf 
> >     generateReleaseSources.dependsOn compileProtobuf 
> > } 
> > 
> > After switching from plugin v2.1.3 to v2.2.0, I get the following 
> > error when I try to run the project in Android Studio 2.2: 
> > 
> > "A problem occurred configuring root project 'android'. 
> >> Could not get unknown property 'generateReleaseSources' for root 
> project 'android' of type org.gradle.api.Project." 
> > 
> > I can't replicate this when running gradlew from the command line, but 
> > going back to v2.1.3 resolves the problem in Android Studio. 
> > 
> > Is there some other method I should use to run my compileProtobuf task 
> > before generateDebugSources and generateReleaseSources? 
> > 
> > -Max 
>

-- 
You received this message because you are subscribed to the Google Groups 
"adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adt-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to