Hi, thanks for fast response. I was wondering if it's really other classloader. Anyway, I will apply the code to cover without casting so in the future I won't get this problem.
There are some plugins for robolectric. This one uses Spock as base (not unit test) which in my opinion is huge step ahead when it comes to write unit test. Moreover my idea for this plugin is to make it work both from command line and Android Studio. Przemek W dniu wtorek, 21 stycznia 2014 18:24:59 UTC+1 użytkownik Xavier Ducrohet napisał: > > I'm not sure what's going on here. Right now all plugins are in the same > classloader so this should work. > > However, this *will* break later when Gradle makes all plugins use their > own classloader. Don't do this. Rely on the public API of the plugin > exposed through the DSL. > > Also, aren't there already a bunch of robolectric plugins for Gradle? It > seems everyone is doing the same things. > > > On Tue, Jan 21, 2014 at 3:06 AM, Przemek Jakubczyk > <[email protected]<javascript:> > > wrote: > >> Hi devs, >> >> I'm currently struggling with finishing plugin for gradle to run unit >> test using robolectric and groovy. You can check the webstie >> www.robospock.org. >> >> I'm having very weird problem with casting to AppPlugin. (source >> https://github.com/pjakubczyk/robospock-plugin/blob/master/robospock-plugin/src/main/groovy/org/robospock/RobospockPlugin.groovy >> ) >> >> I have following line of code: >> def appPlugin = androidProject.plugins["android"] >> >> but when I want to have non-dynamic version: >> AppPlugin appPlugin = androidProject.plugins["android"] >> >> I see such exception: >> Cannot cast object 'com.android.build.gradle.AppPlugin@7b3d09b1' with >> class 'com.android.build.gradle.AppPlugin' to class >> 'com.android.build.gradle.AppPlugin' >> >> Maybe you have any clue what is going on here? To be honest I don't need >> to remove 'def' word but it also return false on such statement >> androidProject.plugins["android"] instanceof AppPlugin ... >> >> Hope you have some ideas. >> >> Przemek >> >> -- >> 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 [email protected] <javascript:>. >> For more options, visit https://groups.google.com/groups/opt_out. >> > > > > -- > Xavier Ducrohet > Android SDK Tech Lead > Google Inc. > http://developer.android.com | http://tools.android.com > > Please do not send me questions directly. Thanks! > -- 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 [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
