Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7894331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:22:07+00:00 2026-06-03T07:22:07+00:00

I have an android project with multiple build targets (using ant). For testing purposes,

  • 0

I have an android project with multiple build targets (using ant). For testing purposes, those build targets all have different package names (so my package name is com.mycompany.myapp for release build and com.mycompany.myapp.test for test build).

This works well for the most part, except for when it comes to custom xml namespaces in layout files.
So this:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:custom="http://schemas.android.com/apk/res/com.mycompany.myapp" />

will stop working as soon as package name is replaced with com.mycompany.myapp.test.
Because of that, I have to replace com.mycompany.myapp value each time during prebuilt. And since all this files should be in vcs, and should not conflict every time one person switches configuration and them merges, I had to move layout files into specific config folder, where they would look like:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:custom="http://schemas.android.com/apk/res/@CONFIG.PACKAGENAME@" />

Now this files are stored in vcs, and @CONFIG.PACKAGENAME@ is replaced during prebuilt and then the file is copied from ./config/file.xml to ./res/layout/file.xml.

This is extremely inconvinient and doesn’t really scale well (I can’t imagine mentioning every one of like 50 files in build script).

So my question is: is there a way to automatically use current package name in namespace declaration? Or at least modife layout files (or build files?) so that I wont have to replace com.mycompany.myapp every time I change package name.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T07:22:08+00:00Added an answer on June 3, 2026 at 7:22 am

    Turns out that there is a postfix for that: res-auto.

    So all you need to do is write

    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:custom="http://schemas.android.com/apk/res-auto" />
    

    This will automatically use current package name.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Android Project where I need to build multiple versions of the
I have an Android project that branched into three different applications, app-1 , app-2
I have an Android app project that contains all of my code. I've made
I have setup an android test project that runs junit tests. It's using two
I have a project that is just using Android 1.5 for programming, but with
I have a Android project which I'm building in Ant and I'm stuck on
I have an Android project where I need to build a client app to
I am using ANT to compile an Android app that I have built. It
I have an Android JNI project I'd like to compile with ndk-build . The
I have Android pet-project DroidIn which utilizes HttpClient 4 (built into Android) to do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.