Is there a way to pass ant variables to java code (android)?

前端 未结 3 1236
滥情空心
滥情空心 2021-01-25 05:59

I like to include some build variables in my application. For example a buildnumber. Can I pass some variables from a ant build script to my Android application and use that var

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-25 06:27

    One thing you can do is to first use the "echo" task to create a properties file. That task supports variable substitution, so you can include all build variables. Then include that properties file in your application jar and use the Java Properties to read them.

    See:

    • http://ant.apache.org/manual/Tasks/echo.html
    • http://download.oracle.com/javase/6/docs/api/java/util/Properties.html

提交回复
热议问题