I have other responsibilities than read the Google groups all day long.
That said, I've been looking for a work around.
Since you want to build aidl files as part of your build, but cannot have
your project use the project nature, you'll have to manually add a new
builder that does what you want (after you remove the nature and builders
from the .project as indicated in the message I linked)
Eclipse makes it easy if you have an Ant file. I've attached an Ant build
file which is basically a stripped down version of the Ant script used by
people who don't use Eclipse. It only contains the aidl target (and another
target making sure some folders exist)
Now, follow these steps:
- In eclipse, right click on your project with the aidl files and choose
"Properties", and then "Builders" on the left.
- Click New to add a builder, and choose the "Ant Builder" type.
- In the new window, give the builder a name ('aidl' for instance).
- In the "Main" tab
* For "Buildfile", put the attached file in the root of your project, and
choose "Browse Workspace" to select it. This will make sure the build file
path is relative to the workspace, and avoids having hard-coded path in your
.project file.
* For "Base Directory", choose "Browse Workspace" as well and choose your
project.
- In the "Refresh" tab
* You should probably set it to "refresh resources upon completion" to
make sure the aidl generated Java files are compiled by the JDT builder. I
would just select "The project containing the selected resource."
- In the target tab:
* Most cases should have "Default target selected". I had to change
Auto-Build to this as well (click Set Targets...). There's no Clean target
so don't have any for the Clean action (but do keep the default target for
After Clean).
- Click OK, and make sure your new builder is executing before the "Java
Builder".
Note that the Ant build file will require to know where the SDK is. This is
accomplished by a file called local.properties placed in the root of your
folder.
You can run the "android update project" command to generate it (see
http://developer.android.com/sdk/1.5_r1/upgrading.html#AntUsers for more
information)
If you use a source control system:
- do not submit local.properties as it contains a reference to your local
SDK installation. Each developers should make their own based on their SDK
installation folder.
- submit aild_build.xml
- inside your project you have a folder ".externalToolBuilders", with a
single file named after the name of the builder you added. If you used the
"Browse Workspace" options as I mentioned, it should not contain any
reference to local paths, and you must submit it in your source system (it's
required for the builder to run).
Now, I'll address the issue of why we removed this "feature".
To be honest, I think we underestimated the impact of this change. We didn't
remove it because we don't like you using it. We never actually intended for
it to work, and didn't think people would be using it (much), because, in
most cases, it doesn't work (resource ID collisions).
We added support for referenced project to make it easier to work with
external than using jar files, but we never expected that people would
actually use it to reference Android project. Most people I've talked to
didn't even realize the issue with resources IDs. It seems you are one of
the few who paid attention to it and made sure to make it work properly,
while still using complex features (like build aidl).
When we realized the problem (when we added support for running JUnit test
in a separate project), we remove it to prevent people from doing something
they shouldn't be, but also to make the JUnit feature properly work (you
don't want to have the code of the application you are testing inside your
instrumentation project).
We (now) completely realize we need to have a built-in way to support this,
and we'll add it to the next version. At this point however, we can't
provide a quick fix. Hopefully the work around (either the simple one as
linked in my previous message, or this one with the Ant build file) will
work for you until we provide a better mechanism.
Xav
On Tue, May 19, 2009 at 5:28 PM, Peter Jeffe <[email protected]> wrote:
>
> So no help here? This is very frustrating to say the least. I've
> spent all day trying to hack together a workaround for this, when I
> need to be working on my product instead. And I'm left with a hard-
> coded mess instead of a clean build process.
>
> What possible reason could there be for you to release these breaking
> changes without warning, and without even any workarounds to offer?
> If you didn't like the fact that people could shoot themselves in the
> foot with resource ID collisions you could give a warning or
> something--you don't need to just break all of us who need to build
> our products from separate Android projects.
>
> Can you tell me why this is not a serious problem that warrants an
> immediate fix?
>
> -- Peter
>
> >
>
--
Xavier Ducrohet
Android Developer Tools Engineer
Google Inc.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---
<?xml version="1.0" encoding="UTF-8"?>
<project name="android_rules" default="aidl">
<!-- The local.properties file is created and updated by the 'android' tool.
It contain the path to the SDK. It should *NOT* be checked in in Version
Control Systems. -->
<property file="local.properties"/>
<!-- The build.properties file can be created by you and is never touched
by the 'android' tool. This is the place to change some of the default property values
used by the Ant rules.
Here are some properties you may want to change/update:
application-package
the name of your application package as defined in the manifest. Used by the
'uninstall' rule.
source-folder
the name of the source folder. Default is 'src'.
out-folder
the name of the output folder. Default is 'bin'.
Properties related to the SDK location or the project target should be updated
using the 'android' tool with the 'update' action.
This file is an integral part of the build system for your application and
should be checked in in Version Control Systems.
-->
<property file="build.properties"/>
<!-- The default.properties file is created and updated by the 'android' tool, as well
as ADT.
This file is an integral part of the build system for your application and
should be checked in in Version Control Systems. -->
<property file="default.properties"/>
<!-- Custom Android task to deal with the project target, and import the proper rules.
This requires ant 1.6.0 or above. -->
<path id="android.antlibs">
<pathelement path="${sdk-location}/tools/lib/anttasks.jar" />
<pathelement path="${sdk-location}/tools/lib/sdklib.jar" />
<pathelement path="${sdk-location}/tools/lib/androidprefs.jar" />
<pathelement path="${sdk-location}/tools/lib/apkbuilder.jar" />
<pathelement path="${sdk-location}/tools/lib/jarutils.jar" />
</path>
<taskdef name="setup"
classname="com.android.ant.SetupTask"
classpathref="android.antlibs"/>
<!-- Execute the Android Setup task that will setup some properties specific to the target,
and import the rules files.
To customize the rules, copy/paste them below the task, and disable import by setting
the import attribute to false:
<setup import="false" />
This will ensure that the properties are setup correctly but that your customized
targets are used.
-->
<setup import="false"/>
<!-- Input directories -->
<property name="source-folder" value="src" />
<property name="gen-folder" value="gen" />
<!-- Output directories -->
<property name="out-folder" value="bin" />
<!-- Create the output directories if they don't exist yet. -->
<target name="dirs">
<echo>Creating output directories if needed...</echo>
<mkdir dir="${gen-folder}" />
<mkdir dir="${out-folder}" />
</target>
<!-- Generate java classes from .aidl files. -->
<target name="aidl" depends="dirs">
<echo>Compiling aidl files into Java classes...</echo>
<apply executable="${aidl}" failonerror="true">
<arg value="-p${android-aidl}" />
<arg value="-I${source-folder}" />
<arg value="-o${gen-folder}" />
<fileset dir="${source-folder}">
<include name="**/*.aidl"/>
</fileset>
</apply>
</target>
</project>