Re: [android-developers] Android library project with non-default bin directory
Thanks a lot for your suggestion, it seems to work. I've put it in custom_rules.xml. I had to wrap it in element as per this post http://stackoverflow.com/questions/8528373/android-custom-build-using-ant which results in a "Duplicated project name in import" warning. It nevertheless seems to build fine. On Sat, Feb 23, 2013 at 12:34 PM, Kostya Vasilyev wrote: > I've done this -- keeping ant builds completely separate from > Eclipse's -- by hacking on the project's and the SDK's build.xml > files. > > Not an ant expert either (last I used was some ten years ago), but it > wasn't too difficult either. > > The modification that deals with library references (in the > application project's build.xml) looks like this: > > > > > > location="../AquaCompat/ant/bin/classes.jar" /> > location="../AquaSupport/ant/bin/classes.jar" /> > location="../AquaMailUnlockerLibrary/ant/bin/classes.jar" /> > location="../LocalePlatform/ant/bin/classes.jar" /> > location="../AmbilWarna/ant/bin/classes.jar" /> > > > * -pre-compile: > project.all.jars.path="${toString:project.all.jars.path}" > > > Oh, and I already filed a feature request for this a little over a year > ago: > > https://code.google.com/p/android/issues/detail?id=23271 > > Maybe it'll be possible "out of the box" with the new Gradle-based > build system, who knows? > > -- K > > 2013/2/23 Latimerius : > > Hello, > > > > I posted this on SO the day before yesterday (*) but since there have > been > > no replies posting here, too: > > > > I have an Android project which uses an Android library project as a > > dependency. Building it with ant works fine, I'd just like to have the > > library project use a different bin directory. However, when I add > > > > out.dir=bin-ant > > > > to the library project's ant.properties file, the (normal) Android > project > > won't compile anymore, issuing "cannot find symbol" errors for symbols > > defined in the library. Admittedly, I'm not very experienced with Ant > but I > > guess this means ant didn't find library's classes.jar which is now > placed > > in bin-ant/, not bin/ . Does anybody happen to know how to tell ant > where > > to find the library's classes.jar? > > > > Thanks in advance! > > > > > > (*) > > > http://stackoverflow.com/questions/15012527/ant-wont-build-android-project-which-depends-on-library-project-with-non-defaul > > > > -- > > -- > > 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 unsubscribe from this group and stop receiving emails from it, send an > > email to android-developers+unsubscr...@googlegroups.com. > > For more options, visit https://groups.google.com/groups/opt_out. > > > > > > -- > -- > 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 unsubscribe from this group and stop receiving emails from it, send an > email to android-developers+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- -- 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 unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [android-developers] Android library project with non-default bin directory
I've done this -- keeping ant builds completely separate from Eclipse's -- by hacking on the project's and the SDK's build.xml files. Not an ant expert either (last I used was some ten years ago), but it wasn't too difficult either. The modification that deals with library references (in the application project's build.xml) looks like this: * -pre-compile: project.all.jars.path="${toString:project.all.jars.path}" Oh, and I already filed a feature request for this a little over a year ago: https://code.google.com/p/android/issues/detail?id=23271 Maybe it'll be possible "out of the box" with the new Gradle-based build system, who knows? -- K 2013/2/23 Latimerius : > Hello, > > I posted this on SO the day before yesterday (*) but since there have been > no replies posting here, too: > > I have an Android project which uses an Android library project as a > dependency. Building it with ant works fine, I'd just like to have the > library project use a different bin directory. However, when I add > > out.dir=bin-ant > > to the library project's ant.properties file, the (normal) Android project > won't compile anymore, issuing "cannot find symbol" errors for symbols > defined in the library. Admittedly, I'm not very experienced with Ant but I > guess this means ant didn't find library's classes.jar which is now placed > in bin-ant/, not bin/ . Does anybody happen to know how to tell ant where > to find the library's classes.jar? > > Thanks in advance! > > > (*) > http://stackoverflow.com/questions/15012527/ant-wont-build-android-project-which-depends-on-library-project-with-non-defaul > > -- > -- > 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 unsubscribe from this group and stop receiving emails from it, send an > email to android-developers+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > -- -- 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 unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Android library project with non-default bin directory
Hello, I posted this on SO the day before yesterday (*) but since there have been no replies posting here, too: I have an Android project which uses an Android library project as a dependency. Building it with ant works fine, I'd just like to have the library project use a different bin directory. However, when I add out.dir=bin-ant to the library project's ant.properties file, the (normal) Android project won't compile anymore, issuing "cannot find symbol" errors for symbols defined in the library. Admittedly, I'm not very experienced with Ant but I guess this means ant didn't find library's classes.jar which is now placed in bin-ant/, not bin/ . Does anybody happen to know how to tell ant where to find the library's classes.jar? Thanks in advance! (*) http://stackoverflow.com/questions/15012527/ant-wont-build-android-project-which-depends-on-library-project-with-non-defaul -- -- 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 unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [android-developers] Android Library Project Changes
On Fri, Mar 23, 2012 at 10:33 AM, Nikolay Elenkov wrote: > Library projects now (since ADT15?) produce a jar. Linked source > folders are now longer used, so there is no code merging. > Thanks Nikolay for confirming that. > Don't refer to A.java directly. Put an abstract class or interface > in the library project, different implementations in the app projects, > etc. > That is a good solution when there are few well separated classes. In my case there are many intricate dependencies which makes this cumbersome. I found a workaround. I moved the contents of the *src* folder in the Library project into a new folder called *libsrc* (some name different from src). I then link this folder into my dependent projects (Project -> Properties -> Java Build Path -> Source -> Link Source). So, Eclipse does the code merging now, instead of the Android SDK. Works like a charm and I didn't have to make any changes to the source code! Another benefit is that when I try to navigate to a class (with say Ctrl+T), I don't see duplicate classes from the Library project. Ditto for duplicate errors, search results, etc. The only hitch is I haven't figured out the Ant equivalent of this. (I may not need it anyway since the new SDK+ADT has good Proguard support). cheers, -- Harshad RJ http://lavadip.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] Android Library Project Changes
On Fri, Mar 23, 2012 at 1:50 PM, Harshad wrote: > > From what I understand, in the newer SDKs, the Library project needs to be > compilable by itself, while in earlier versions that was not necessary. In > earlier versions, the source code from the library projects was merged with > the final project and then compiled. Is that correct? Library projects now (since ADT15?) produce a jar. Linked source folders are now longer used, so there is no code merging. > > For example, if I have the following files: > Free Project / A.java > Pro Project / A.java > Library Project / B.java // Refers to A.java > Don't refer to A.java directly. Put an abstract class or interface in the library project, different implementations in the app projects, etc. > This used to work fine in earlier SDKs and allow me to keep common source > code between free and Pro versions in the Library Project. But this isn't > supported now. Is my understanding correct? If so, what are the best > practices for handling such a scenario? > > One idea is: add a dummy A.java to the Library Project so that the library > project compiles. I am hoping that the A.class from the Library Project will > get overridden by the A.class from the dependent projects. Could there be > problems with such an approach? You will probably get errors when converting to dex because of the duplicate classes. -- 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] Android Library Project Changes
Hi, I am trying to migrate to the newly released SDK and ADT 17 from my earlier setup of SDK 12. (I couldn't use the intermediate SDK releases because of some problems that were fixed only in SDK 17). One of the problems I am facing now is that Projects which use an Android Library Project are not building properly. >From what I understand, in the newer SDKs, the Library project needs to be compilable by itself, while in earlier versions that was not necessary. In earlier versions, the source code from the library projects was merged with the final project and then compiled. Is that correct? For example, if I have the following files: *Free Project / A.java* *Pro Project / A.java* *Library Project / B.java** // Refers to A.java* This used to work fine in earlier SDKs and allow me to keep common source code between free and Pro versions in the Library Project. But this isn't supported now. Is my understanding correct? If so, what are the best practices for handling such a scenario? One idea is: add a dummy A.java to the Library Project so that the library project compiles. I am hoping that the A.class from the Library Project will get overridden by the A.class from the dependent projects. Could there be problems with such an approach? thanks, Harshad -- 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] Android library project: how to overwrite an activity?
hi all, this is my situation: i have a library project, and a project referencing it. I know that is very simple to redefine any resource in my project, because in cases where a resource ID is defined in both the application and the library, the tools ensure that the resource declared in the application gets priority and that the resource in the library project is not compiled into the application .apk ( from android developers web site ). But: how can i do to redefine source (for example, override an activity) in my project? I have implemented some code samples, to better explain my problem: In my library project, i have two activities: *AndroidLibraryExampleActivity: package com.nolanofra.app.androidLibraryExample; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; public class AndroidLibraryExampleActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } public void onSecondActivityGo (View v) { Intent intent = new Intent(AndroidLibraryExampleActivity.this, SecondLibraryActivity.class); startActivity(intent); } ** and SecondLibraryActivity: ** package com.nolanofra.app.androidLibraryExample; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class SecondLibraryActivity extends Activity{ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.second_activity); TextView t = (TextView) findViewById(R.id.textView); t.setText("Hello, i'm second activity on library!!!"); } } ** Manifest of library project is: http://schemas.android.com/apk/res/android"; package="com.nolanofra.app.androidLibraryExample" android:versionCode="1" android:versionName="1.0"> * In my project referencing library, I want to redefine SecondLibraryActivity in order to change text displayed in text view, for example I would like to do some of this: package com.nolanofra.app.sampleProjectUsingLibrary; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; import com.nolanofra.app.androidLibraryExample.R; public class SecondLibraryActivity extends Activity{ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.second_activity); TextView t = (TextView) findViewById(R.id.textView); t.setText("Hello, i'm second activity on project!!!"); } } *** Android Manifest on project is: ** http://schemas.android.com/apk/res/android"; package="com.nolanofra.app.sampleProjectUsingLibrary" android:versionCode="1" android:versionName="1.0"> ** So, how can I do that ? Is it possible to overwrite, in my project, the activity declared in the library in order to change its behavior? Thanks -- 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] Android Library project and widget xml referes in AndroidManifest.xml
Hello, i'm using Android Project Library (http://goo.gl/7vvxI). In Android docs, it copys all items from android library project AndroidManifest.xml in application AndroidManifest.xml like in example, AndroidManifest.xml of library project ... ... ... ... so, AndroidManifest.xml of application must be ... ... ... ... So, if in library project i've a widget declaration, like below, how i can refer to widget xml in application AndroidManifest.xml? In library project in meta-data i refer to med_provider in xml folder. Do i need to copy med_provider.xml in xml folder of application? thanks. -- 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] Android library project symbolic link name
I think you don't have the same version of ADT on your different machines. We released 0.9.8* a few weeks ago which changed how we handle libraries in Eclipse. There's a migration document here: http://developer.android.com/guide/developing/eclipse-adt.html#libraryMigrating * actual current version is 0.9.9 I'd recommend upgrading all your machines to this version. On Sat, Oct 2, 2010 at 10:50 AM, Jeremy Statz wrote: > Is there any way to control the name of the link that Eclipse makes > when it integrates a library project? I have inconsistency going on > depending on the machine, and I don't understand why. > > The project structure is really simple, basically there's a library > called "_engine" and a set of other projects with varying names. The > _engine project is a library, and everything else uses it as such. I > have three machines, one is using WinXP, one using Win7 32-bit, and > one using Win7 x64. All of these are using Eclipse 3.5.2 and the same > directory structure on-disk. They have a few simple path settings to > ignore .svn subfolders and that's about it. > > On both the XP and Win7 32-bit machines, each of the projects ends up > with an _engine link underneath it in eclipse. The problem is, I'm > trying to get this onto the 64-bit machine now, and on that one I end > up with two links upon importing the project, one called _engine and > one called _engine_src. This means the project doesn't compile. Only > the _engine_src link seems to refresh, and if I remove the library and > re-add it that's the name I get. > > I can make this work by deleting the extra (_engine), but I don't > understand why it's doing this, and it means my project settings end > up different on the third machine. Does anyone know if there's > anything I can do to trouble-shoot this? > > -- > 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 > -- Xavier Ducrohet Android SDK Tech Lead Google Inc. Please do not send me questions directly. Thanks! -- 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] Android library project symbolic link name
Is there any way to control the name of the link that Eclipse makes when it integrates a library project? I have inconsistency going on depending on the machine, and I don't understand why. The project structure is really simple, basically there's a library called "_engine" and a set of other projects with varying names. The _engine project is a library, and everything else uses it as such. I have three machines, one is using WinXP, one using Win7 32-bit, and one using Win7 x64. All of these are using Eclipse 3.5.2 and the same directory structure on-disk. They have a few simple path settings to ignore .svn subfolders and that's about it. On both the XP and Win7 32-bit machines, each of the projects ends up with an _engine link underneath it in eclipse. The problem is, I'm trying to get this onto the 64-bit machine now, and on that one I end up with two links upon importing the project, one called _engine and one called _engine_src. This means the project doesn't compile. Only the _engine_src link seems to refresh, and if I remove the library and re-add it that's the name I get. I can make this work by deleting the extra (_engine), but I don't understand why it's doing this, and it means my project settings end up different on the third machine. Does anyone know if there's anything I can do to trouble-shoot this? -- 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] Android library project custom build
Hello all, I have a legacy application and need to split it into a library project (common code) and two application projects (paid and free applications). I don't use Eclipse for development, and also don't use Ant builds provided (generated) by Android SDK (there are several reasons for that), but use our custom build files instead. I need to modify my Ant builds to make them build my applications projects that refer my library project. I looked into sample application and Ant builds shipped with SDK, but didn't understand how it is done. I saw that library project contains "libs" directory and "default.properties" file with "android.library" property set to "true". I saw that applications project contains "default.properties" file with "android.library.reference.X" property set to library project directory value. But I didn't find any reference to these properties in the Ant builds (project Ant build file, and Ant builds shipped with SDK). Just placing these files into application/library project directories doesn't help, i.e. SDK tools doesn't interpret them. My guess is that this is performed by com.android.ant.SetupTask, but I'd like to know how it is performed. My build is set of targets that call (using exec) Android SDK tools: appt, dx, apkbuilder and so on. So I'd like to know which command line parameters I need to use to make, lets say, appt tool to merge resources? Thank you in advance. -- Best regards, Andriy. -- 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] Android Library Project
On Sat, May 22, 2010 at 2:49 AM, Mark Carter wrote: > Great to see the new Android Library Project feature in ADT 0.9.7. > > http://developer.android.com/guide/developing/eclipse-adt.html#libraryProject > > However, some things aren't clear to me yet: > > 1. In the library project, what does versionCode, versionName, > packageName now mean? I assume nothing??? Yes, nothing. The manifest for the library is not used besides looking at the package name for the library. > 2. The docs state that activities, services etc need to be declared in > the library project and also the app project. So doesn't this just > result in a load of duplication? What if the activity is declared > slightly differently in one to the other? They actually don't need to be declared in the library (yet). We only recommend you put them in the library manifest as a reference so that you can easily copy-paste them into the app projects that reference them. (In the future we will automatically merge the library manifests into the app manifests). > 3. It would have been incredibly useful to allow library projects to > reference each other. I'm curious as to why this is not possible... It was mainly that we didn't have time. We need to figure out the order of the resources (as you may already have read, the priority order is important as resources could override each other). The question is what happens when a project depends on libraries A & B which both depend on library C. What's the library priority order? A, B, C or A, C, B? > 4. If an app references both resources and code in a library project, > then that library project needs to be added as both a library and a > project in the app's build path (in eclipse at least) - why is this? hmm no you should not have too. Adding the library as a project dependence (in project properties under Android) should bring the source code of the library into the main project. > 5. I'm considering subclassing library project activities/services in > my app project. Is there any reason not to do this? Since the library project is compiled inside the app project, there's no reason this won't work. Xav -- Xavier Ducrohet Android SDK Tech Lead Google Inc. Please do not send me questions directly. Thanks! -- 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] Android Library Project
Great to see the new Android Library Project feature in ADT 0.9.7. http://developer.android.com/guide/developing/eclipse-adt.html#libraryProject However, some things aren't clear to me yet: 1. In the library project, what does versionCode, versionName, packageName now mean? I assume nothing??? 2. The docs state that activities, services etc need to be declared in the library project and also the app project. So doesn't this just result in a load of duplication? What if the activity is declared slightly differently in one to the other? 3. It would have been incredibly useful to allow library projects to reference each other. I'm curious as to why this is not possible... 4. If an app references both resources and code in a library project, then that library project needs to be added as both a library and a project in the app's build path (in eclipse at least) - why is this? 5. I'm considering subclassing library project activities/services in my app project. Is there any reason not to do this? -- 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