I am trying to develop a clean build system to create a new app with a custom package name from an existing source tree. I'm almost there, but the AIDL interfaces are giving me fits.
Say for the sake of argument that my project's package name is: com.android.project.my And I want to build it as a new app with the name: com.android.project.new.my Here's what I have so far. I have created a bash script that changes the package name by doing the following: 1) It goes through all of the source files and changes the package name in the "package" statement at the top. So in each .java file, the line: package com.android.project.my; becomes: package com.android.project.new.my; 2) It goes into ant.properties and changes the definition of application.namespace. So that goes from: application.namespace=com.android.project.my to: application.namespace=com.android.project.new.my I then have the following under the "code-gen" target in build.xml: <exec executable="${aapt}" failonerror="true"> <arg value="package" /> <arg value="-f" /> <arg value="-M" /> <arg path="AndroidManifest.xml" /> <arg value="-A" /> <arg path="assets" /> <arg value="-I" /> <arg path="${android.jar}" /> <arg value="-m" /> <arg value="-J" /> <arg path="${gen.absolute.dir}" /> <arg value="-F" /> <arg path="${out.absolute.dir}/${resource.package.file.name}" /> <arg value="-S" /> <arg path="res" /> <arg value="--custom-package" /> <arg value="${application.namespace}" /> <arg value="--rename-manifest-package" /> <arg value="${application.namespace}" /> </exec> Which picks up the application.namespace value in ant.properties and tells aapt to put R.java under that path in "gen/", and also sets the apk's package name to my new package name. 3) Finally, it goes into AndroidManifest.xml and changes: package="com.android.project.my" to: package="com.android.project.new.my" That should do it. I should then be able to build the app using and and have it produce a new app from the same codebase with the package name "com.android.project.new.my". And it would work, except for one problem: the aidl compiler chokes. Because in addition to my java source files, I have a few aidl interface files in the source path. And the aidl compiler apparently just ignores the package name in those files and assumes that the package name should match the source path. If I try to compile one of my .aidl files with the modified package name at the top, I get the following error: src/com/android/project/my/IMyAidlInterface.aidl:3 interface IMyAidlInterface should be declared in a file called src/com/android/project/new/my/IMyAidlInterface.aidl. IOW, the aidl compiler seems hard-coded to expect the path for the .aidl file to match the package name declared at the top of the file. I've been looking at the command-line options for aidl, and I don't see anything to allow it to search a custom path for the file. Is there any way around this? Of course, I can manually copy the .aidl files into the expected path, but that's a pretty sloppy solution. -- 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