We do send the package rename option to aapt, to always create the R class in the same package name, even though the app itself (and it's resource pool) use the customized name, in your case customized with .debug.
If you want to be able to configure the package name of the R class through build.gradle in order to enforce that it matches the package name of the app/resources then you will NOT be able to share codes between the variants (at least code that access Android resources). This would basically break the compilation of your debug app. On Mon, Feb 10, 2014 at 2:14 PM, Michael Barany <[email protected]>wrote: > so then does it make sense to pass along the package rename to aapt by > default? > > Or at least is there a way for me currently to configure that aapt option > in my build.gradle for debug builds? > > > On Monday, February 10, 2014 4:58:38 PM UTC-5, Xavier Ducrohet wrote: > >> They make the assumption that the package name of the app is the same as >> the R class. This really is not correct. While the previous build system >> somewhat implied this, aapt always had the feature to generate the R class >> in a different package. >> >> Thinking about it there really is no current way to query the app for the >> package of the R class. It'd have to be provided to the library. >> >> >> On Mon, Feb 10, 2014 at 1:46 PM, Michael Barany <[email protected]>wrote: >> >>> yes, exactly. I can submit them a PR if there is a better way to do it. >>> here is the code: >>> https://github.com/sephiroth74/HorizontalVariableListView/ >>> blob/master/library/src/it/sephiroth/android/library/ >>> widget/AbsHListView.java#L5794 >>> >>> >>> On Monday, February 10, 2014 4:37:35 PM UTC-5, Xavier Ducrohet wrote: >>> >>>> The R class is meant to be generated in the package name declared in >>>> your main manifest, only. This is the only way to share code between >>>> different variants that use different package names. >>>> >>>> Is your library trying to access a resource from your app through >>>> reflection? >>>> >>>> >>>> >>>> On Mon, Feb 10, 2014 at 8:08 AM, Michael Barany >>>> <[email protected]>wrote: >>>> >>>>> I'm renaming my debug build with the following: >>>>>> >>>>>> packageNameSuffix ".debug" >>>>> >>>>> >>>>> My R.java class does not contain ".debug" in it's package. >>>>> >>>>> Some issues I'm seeing are that my libraries are all trying to refer >>>>> to to the R class with the original package name. >>>>> >>>>> Primarily, one of my libraries is trying to access the class context. >>>>> getPackageName() + *".R$styleable"* and failing. >>>>> >>>>> another issue I see with the GMS lib among others is bad links in the >>>>> comments of the R.java file. And Android Studio even higlights it as a bad >>>>> link >>>>> >>>>> This symbol is the offset where the {@link com.michaelbarany.android. >>>>>> debug.R.attr#cameraBearing} attribute's value can be found in the >>>>>> {@link #MapAttrs} array. >>>>> >>>>> >>>>> So back to the original question, is R.java supposed to be renamed to >>>>> ".debug" as well? >>>>> It seems like it should be. >>>>> >>>>> 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. >>>>> >>>> >>>> >>>> >>>> -- >>>> 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. >>> >> >> >> >> -- >> 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. > -- 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.
