Re: Android library projects and applicationid
Put the value of your ContentProvider authority in a resource-string. In your library, give it an empty or dummy value.j In the app that uses your library, redefine that resource-string with proper value. On Tuesday, March 31, 2015 at 6:59:57 PM UTC-4, Pascal Welsch wrote: > > I have the same problem Imran described. My ContentProvider in the library > depends on the applicationId of the product flavor > > On Monday, February 23, 2015 at 4:29:01 PM UTC+1, Imran Mohammed wrote: >> >> How can I get the applicationId of the application in a library? >> >> context.getPackageName() will give the right applicationId. >> I need to set the authority of a content provider to match with the >> applications Id of the application. >> >> Thanks. >> Imran >> >> On Thursday, December 4, 2014 at 10:28:53 AM UTC+5:30, Xavier Ducrohet >> wrote: >>> >>> A library package can only have the package name declared in its >>> manifest. It's a limitation due to how the R class of the library is not >>> packaged in its classes.jar and instead created by the consuming app. >>> >>> Since the consuming app uses the library's manifest's package to >>> generate the R class there's no way in the library to have a different >>> package name for different variants (since in an app project, all variants >>> use the original manifest package name for the R class and overrides the >>> package name only in the packaged manifest) >>> >>> If you need to provide different libraries with different packages, you >>> should use different modules. >>> >>> On Wed, Dec 3, 2014 at 7:05 PM, Kevin Kovach wrote: >>> I see in the release notes for version 1.0.0-rc1 of the gradle plugin that "Setting applicationId(Suffix) in a Library project will now properly fail.", but I do not see anything indicating an alternative. How are we supposed to be setting the package name in library projects? Thanks. - Kevin -- 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+u...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. >>> >>> >>> >>> -- >>> 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 adt-dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Android library projects and applicationid
I have the same problem Imran described. My ContentProvider in the library depends on the applicationId of the product flavor On Monday, February 23, 2015 at 4:29:01 PM UTC+1, Imran Mohammed wrote: > > How can I get the applicationId of the application in a library? > > context.getPackageName() will give the right applicationId. > I need to set the authority of a content provider to match with the > applications Id of the application. > > Thanks. > Imran > > On Thursday, December 4, 2014 at 10:28:53 AM UTC+5:30, Xavier Ducrohet > wrote: >> >> A library package can only have the package name declared in its >> manifest. It's a limitation due to how the R class of the library is not >> packaged in its classes.jar and instead created by the consuming app. >> >> Since the consuming app uses the library's manifest's package to generate >> the R class there's no way in the library to have a different package name >> for different variants (since in an app project, all variants use the >> original manifest package name for the R class and overrides the package >> name only in the packaged manifest) >> >> If you need to provide different libraries with different packages, you >> should use different modules. >> >> On Wed, Dec 3, 2014 at 7:05 PM, Kevin Kovach wrote: >> >>> I see in the release notes for version 1.0.0-rc1 of the gradle plugin >>> that "Setting applicationId(Suffix) in a Library project will now properly >>> fail.", but I do not see anything indicating an alternative. How are we >>> supposed to be setting the package name in library projects? Thanks. >>> >>> - Kevin >>> >>> -- >>> 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+u...@googlegroups.com. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> >> >> -- >> 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 adt-dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Android library projects and applicationid
The easiest is to define a placeholder called "mainApplicationId" and do not set it when building the library. The placeholder will remain unchanged since there is no value provided. Once you build the application, set the placeholder to a the applicationId and it will be replaced in the resulting merged AndroidManifest.xml We might look into not providing an automatic "applicationId" binding when building library in the future which will allow you to just use ${applicationId} everywhere but it's not implemented yet. Jerome On Mon Feb 23 2015 at 4:11:40 PM Imran Mohammed wrote: > How can I get the applicationId of the application in a library? > > context.getPackageName() will give the right applicationId. > I need to set the authority of a content provider to match with the > applications Id of the application. > > Thanks. > Imran > > > On Thursday, December 4, 2014 at 10:28:53 AM UTC+5:30, Xavier Ducrohet > wrote: > >> A library package can only have the package name declared in its >> manifest. It's a limitation due to how the R class of the library is not >> packaged in its classes.jar and instead created by the consuming app. >> >> Since the consuming app uses the library's manifest's package to generate >> the R class there's no way in the library to have a different package name >> for different variants (since in an app project, all variants use the >> original manifest package name for the R class and overrides the package >> name only in the packaged manifest) >> >> If you need to provide different libraries with different packages, you >> should use different modules. >> > On Wed, Dec 3, 2014 at 7:05 PM, Kevin Kovach wrote: >> > I see in the release notes for version 1.0.0-rc1 of the gradle plugin that >>> "Setting applicationId(Suffix) in a Library project will now properly >>> fail.", but I do not see anything indicating an alternative. How are we >>> supposed to be setting the package name in library projects? Thanks. >>> >>> - Kevin >>> >> -- >>> 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+u...@googlegroups.com. >> >> >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> >> >> -- >> 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 adt-dev+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- 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.
Re: Android library projects and applicationid
How can I get the applicationId of the application in a library? context.getPackageName() will give the right applicationId. I need to set the authority of a content provider to match with the applications Id of the application. Thanks. Imran On Thursday, December 4, 2014 at 10:28:53 AM UTC+5:30, Xavier Ducrohet wrote: > > A library package can only have the package name declared in its manifest. > It's a limitation due to how the R class of the library is not packaged in > its classes.jar and instead created by the consuming app. > > Since the consuming app uses the library's manifest's package to generate > the R class there's no way in the library to have a different package name > for different variants (since in an app project, all variants use the > original manifest package name for the R class and overrides the package > name only in the packaged manifest) > > If you need to provide different libraries with different packages, you > should use different modules. > > On Wed, Dec 3, 2014 at 7:05 PM, Kevin Kovach > wrote: > >> I see in the release notes for version 1.0.0-rc1 of the gradle plugin >> that "Setting applicationId(Suffix) in a Library project will now properly >> fail.", but I do not see anything indicating an alternative. How are we >> supposed to be setting the package name in library projects? Thanks. >> >> - Kevin >> >> -- >> 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+u...@googlegroups.com . >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > 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 adt-dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Android library projects and applicationid
A library package can only have the package name declared in its manifest. It's a limitation due to how the R class of the library is not packaged in its classes.jar and instead created by the consuming app. Since the consuming app uses the library's manifest's package to generate the R class there's no way in the library to have a different package name for different variants (since in an app project, all variants use the original manifest package name for the R class and overrides the package name only in the packaged manifest) If you need to provide different libraries with different packages, you should use different modules. On Wed, Dec 3, 2014 at 7:05 PM, Kevin Kovach wrote: > I see in the release notes for version 1.0.0-rc1 of the gradle plugin that > "Setting applicationId(Suffix) in a Library project will now properly > fail.", but I do not see anything indicating an alternative. How are we > supposed to be setting the package name in library projects? Thanks. > > - Kevin > > -- > 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. > -- 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 adt-dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.