Re: [android-developers] Re: how to distribute a Library Project WITHOUT source code (as jar file) as some sort of SDK?
On Sun, Jan 20, 2013 at 1:42 PM, Joe Bowbeer wrote: > The feature that we're awaiting is the .aar binary packaging for libraries, Which hopefully will be ready by next International Talk Like a Pirate Day. :-) -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training in NYC: http://marakana.com/training/android/ -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: how to distribute a Library Project WITHOUT source code (as jar file) as some sort of SDK?
I mean... JARs are already binary code already. Kris On Sun, Jan 20, 2013 at 1:42 PM, Joe Bowbeer wrote: > The feature that we're awaiting is the .aar binary packaging for libraries, > to be provided by the new build system: > > http://tools.android.com/tech-docs/new-build-system > > --Joe > > > On Sun, Jan 20, 2013 at 9:55 AM, Mark Murphy > wrote: >> >> On Sun, Jan 20, 2013 at 12:42 PM, iDeveloper >> wrote: >> > Any news on this issue ? >> >> Well, so long as the JAR does not contain an R class, you should be >> OK, if that's what you mean. The Google Play Services library project >> is distributed with a JAR instead of source code, and it does not >> contain an R class. >> >> -- >> Mark Murphy (a Commons Guy) >> http://commonsware.com | http://github.com/commonsguy >> http://commonsware.com/blog | http://twitter.com/commonsguy >> >> Android Training in NYC: http://marakana.com/training/android/ >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Android Developers" group. >> To post to this group, send email to android-developers@googlegroups.com >> To unsubscribe from this group, send email to >> android-developers+unsubscr...@googlegroups.com >> For more options, visit this group at >> http://groups.google.com/group/android-developers?hl=en > > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: how to distribute a Library Project WITHOUT source code (as jar file) as some sort of SDK?
The feature that we're awaiting is the .aar binary packaging for libraries, to be provided by the new build system: http://tools.android.com/tech-docs/new-build-system --Joe On Sun, Jan 20, 2013 at 9:55 AM, Mark Murphy wrote: > On Sun, Jan 20, 2013 at 12:42 PM, iDeveloper > wrote: > > Any news on this issue ? > > Well, so long as the JAR does not contain an R class, you should be > OK, if that's what you mean. The Google Play Services library project > is distributed with a JAR instead of source code, and it does not > contain an R class. > > -- > Mark Murphy (a Commons Guy) > http://commonsware.com | http://github.com/commonsguy > http://commonsware.com/blog | http://twitter.com/commonsguy > > Android Training in NYC: http://marakana.com/training/android/ > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: how to distribute a Library Project WITHOUT source code (as jar file) as some sort of SDK?
On Sun, Jan 20, 2013 at 12:42 PM, iDeveloper wrote: > Any news on this issue ? Well, so long as the JAR does not contain an R class, you should be OK, if that's what you mean. The Google Play Services library project is distributed with a JAR instead of source code, and it does not contain an R class. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training in NYC: http://marakana.com/training/android/ -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: how to distribute a Library Project WITHOUT source code (as jar file) as some sort of SDK?
Hi Mark, Any news on this issue ? Thanks, Dani On Monday, January 30, 2012 5:10:56 PM UTC+2, Mark Murphy (a Commons Guy) wrote: > > On Sun, Jan 29, 2012 at 9:37 PM, Doug > > wrote: > > On Jan 26, 2:33 pm, Mark Murphy wrote: > >> True, though I'm a bit hesitant to rely upon that behavior until they > >> release the full library-project-as-distributable-JAR support. > > > > Why is this? You're basically just depending on the R symbols being > > defined in a class that's not in the library jar file but instead is > > elsewhere in the classpath of the VM. > > And, until the library JAR file supports redistribution, I have no way > of being assured whether the JAR contains an R.class or not. Clearly > an R.java was needed at compile time of the library JAR, otherwise the > code would not compile and there would be no class files to put in the > JAR. In principle, that R.class could be in the JAR, thereby causing > problems when there is a conflicting R.class in the host project. > > This is one of those things that may well work with the tools as they > stand, but with a fuller solution hopefully coming out soon, I'm not > exactly rushing to fuss with it. Now, if there are rumblings that > redistributable library project JARs are being postponed for whatever > reason, then my interest in your approach rises. > > Hence, my use of the term "hesitant". I'm not saying your approach is > wrong. > > -- > Mark Murphy (a Commons Guy) > http://commonsware.com | http://github.com/commonsguy > http://commonsware.com/blog | http://twitter.com/commonsguy > > _Android Programming Tutorials_ Version 4.1 Available! > > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: how to distribute a Library Project WITHOUT source code (as jar file) as some sort of SDK?
On Sun, Jan 29, 2012 at 9:37 PM, Doug wrote: > On Jan 26, 2:33 pm, Mark Murphy wrote: >> True, though I'm a bit hesitant to rely upon that behavior until they >> release the full library-project-as-distributable-JAR support. > > Why is this? You're basically just depending on the R symbols being > defined in a class that's not in the library jar file but instead is > elsewhere in the classpath of the VM. And, until the library JAR file supports redistribution, I have no way of being assured whether the JAR contains an R.class or not. Clearly an R.java was needed at compile time of the library JAR, otherwise the code would not compile and there would be no class files to put in the JAR. In principle, that R.class could be in the JAR, thereby causing problems when there is a conflicting R.class in the host project. This is one of those things that may well work with the tools as they stand, but with a fuller solution hopefully coming out soon, I'm not exactly rushing to fuss with it. Now, if there are rumblings that redistributable library project JARs are being postponed for whatever reason, then my interest in your approach rises. Hence, my use of the term "hesitant". I'm not saying your approach is wrong. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _Android Programming Tutorials_ Version 4.1 Available! -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: how to distribute a Library Project WITHOUT source code (as jar file) as some sort of SDK?
On Jan 26, 2:33 pm, Mark Murphy wrote: > True, though I'm a bit hesitant to rely upon that behavior until they > release the full library-project-as-distributable-JAR support. Why is this? You're basically just depending on the R symbols being defined in a class that's not in the library jar file but instead is elsewhere in the classpath of the VM. Typical shared library stuff. The host project will create and include that R class from the resources that are in your library project and everything is good. The user of your lib just can't be messing with the names of the resource files -- then there will be a problem. Granted, it would be much better if Google created a full library-as- JAR solution, making AAPT smart enough to grab resources out a jar instead of looking for them in the filesystem. But this should work as long as nothing is meddled with. Doug -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: how to distribute a Library Project WITHOUT source code (as jar file) as some sort of SDK?
Am 26.01.2012 23:33, schrieb Mark Murphy: > On Thu, Jan 26, 2012 at 5:25 PM, joebowbeer wrote: >> Mark Murphy writes: >> >>> You have to rewrite your [library] code to avoid using R. values, as they >>> will be wrong. >> >> The resource compiler was changed in r14 so that the identifiers in a >> library project's R.java are no longer declared "final". This prevents >> the constants from being inlined into library bytecode, and instead >> forces these references to be resolved at runtime. In theory this >> should allow your library to continue to use R. values. Though, as >> explained in the r14 change docs, you won't be able to use resource >> ids in switch statements. > > True, though I'm a bit hesitant to rely upon that behavior until they > release the full library-project-as-distributable-JAR support. it workes! i did it this way: 1. first thing is to have the full library-project. 2. then i copied the whole library-project. 3. in the copy, i removed the source code. 4. in the app-project i added the source-less-library-project as android library (to get the R class with all the ids, which really aren't "final", and the other resources) 5. in the app-project i added the .jar file with all the binary classes from the full library-project, which was generated automatically (or by running "Project/Clean...") by eclipse as external jar-file. 6. the app coming out of the app-project was fully working! so it seems, that you have to split up source code an resources from a library-project and add them separated (and on different places) from each other to the app-project. -- Rainer Klier Research & Development xyzmo SIGNificant Group | Austria | USA | Germany A-4052 Ansfelden, Haiderstraße 23 Tel.: +43 7229 88060-0, E-Mail: rainer.kl...@xyzmo.com -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: how to distribute a Library Project WITHOUT source code (as jar file) as some sort of SDK?
On Thu, Jan 26, 2012 at 5:25 PM, joebowbeer wrote: > Mark Murphy writes: > >> You have to rewrite your [library] code to avoid using R. values, as they >> will be wrong. > > The resource compiler was changed in r14 so that the identifiers in a > library project's R.java are no longer declared "final". This prevents > the constants from being inlined into library bytecode, and instead > forces these references to be resolved at runtime. In theory this > should allow your library to continue to use R. values. Though, as > explained in the r14 change docs, you won't be able to use resource > ids in switch statements. True, though I'm a bit hesitant to rely upon that behavior until they release the full library-project-as-distributable-JAR support. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training in DC: http://marakana.com/training/android/ -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: how to distribute a Library Project WITHOUT source code (as jar file) as some sort of SDK?
Mark Murphy writes: > You have to rewrite your [library] code to avoid using R. values, as they > will be wrong. The resource compiler was changed in r14 so that the identifiers in a library project's R.java are no longer declared "final". This prevents the constants from being inlined into library bytecode, and instead forces these references to be resolved at runtime. In theory this should allow your library to continue to use R. values. Though, as explained in the r14 change docs, you won't be able to use resource ids in switch statements. On Jan 26, 6:57 am, Mark Murphy wrote: > It is possible to create an Android library project that does not > include source code. The limitations are: > > -- You still have to ship the resources. > > -- You have to rewrite your code to avoid using R. values, as they > will be wrong. You will have to look up all resource IDs using > getResources().getIdentifier() and/or reflection. > > I have the instructions in _The Busy Coder's Guide to Advanced Android > Development_ (http://commonsware.com/AdvAndroid), though the > instructions are new enough that none of my free versions have them. > Quoting some of the instructions from the current edition: > > "You can create a binary-only library project via the following steps: > 1. Create an Android library project, with your source code and such – > this is your master project, from which you will create a version of > the library project for distribution > 2. Compile the Java source (e.g., ant compile) and turn it into a JAR file > 3. Create a distribution Android library project, with the same > resources as the master library project, but no source code > 4. Put the JAR file in the distribution Android library project's libs/ > directory > > The resulting distribution Android library project will have everything a > main project will need, just without the source code." > > Personally, I'd just wait a bit. I am hopeful that the official > support for library-projects-as-JARs will be available soonish. > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy > > Android Training in DC:http://marakana.com/training/android/ -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en