I think the issue is that we recently changed DEBUG to be non final in debug mode (to remove some unwanted warning in the IDE).
This means that while in release, all the constants get inlined in the code anyway so it's not strictly needed to include it. In debug mode though you really want it packaged. When using the library in another project you always (for now) use the release version so it's not really an issue (for now). When testing however you use the debug version and so you really want the Buildconfig class to be included. On Tue, Feb 4, 2014 at 11:01 AM, Avram Lyon <[email protected]> wrote: > Perhaps it is a related issue, but the we haven't had issues with > BuildConfig being missing from the the library project in normal usage (as > that issue seems to point to); it's specifically that BuildConfig with the > non-suffixed package name isn't generated / included for instrument tests. > > *Avram Lyon* > Android wrangler | Scopely, Inc. > > Refer The Smartest Person You Know And Pocket $5,000! > * Learn more: scopely.com/referrals > <http://www.scopely.com/referrals/?page=4>* > > > On Tue, Feb 4, 2014 at 10:53 AM, Xavier Ducrohet <[email protected]> wrote: > >> I want to fix this. it's being tracked at >> https://code.google.com/p/android/issues/detail?id=61151 >> >> However this is going to require that all library dependencies have their >> own package names. Back when we didn't allow this a lot of devs asked for >> this. I'm looking at the best way to slowly enforce this. >> >> >> On Tue, Feb 4, 2014 at 10:47 AM, Avram Lyon <[email protected]> wrote: >> >>> We are running into an issue where the BuildConfig.class for a library >>> project (package name com.example.core) isn't being included in the APK >>> used for connectedInstrumentTest. Our setup is that we have an Android >>> library project that uses some constants specified using >>> buildConfigField in its build.gradle. In normal usage by dependent >>> Android projects, the class in generated correctly and included in the APK. >>> When we run connectedInstrumentTest, our tests fail with >>> java.lang.NoClassDefFoundError: >>> com.example.core.BuildConfig; upon investigation we can see that the >>> dexer is being called with /projectRoot/build/classes/test/debug, which >>> includes com/example/core/test/BuildConfig.class but no >>> com/example/core/BuildConfig.class. >>> >>> In the past (Gradle 1.9, Gradle plugin 0.7), the non-modified package >>> would be used for the BuildConfig. >>> >>> Since people might want BuildConfig for the instrument test code as >>> well, the build system probably needs to include generated versions for >>> both the original package of the library project and the .test package >>> name. >>> >>> >>> *Avram Lyon* >>> Android wrangler | Scopely, Inc. >>> >>> Refer The Smartest Person You Know And Pocket $5,000! >>> * Learn more: scopely.com/referrals >>> <http://www.scopely.com/referrals/?page=4>* >>> >>> -- >>> 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. >>> >> >> >> >> -- >> 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. >> > > -- > 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. > -- 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.
