2013-02-06 40 views
5

मैं वर्तमान में कुछ ऑटो ब्रांडिंग काम करने के लिए चींटी के साथ खेल रहा हूं। मैंने डिफ़ॉल्ट build.xml को संशोधित किया और अपना खुद का लक्ष्य सेट किया। मुझे क्या उम्मीद है कि क्या एंट स्क्रिप्ट में कोई तरीका है जो स्वचालित रूप से एपीके फ़ाइल का नाम बदलकर कुछ निश्चित नाम के साथ बना सकता है?ऑटो रीमिंग आउटपुट एपीके फ़ाइल में चींटी का उपयोग कैसे करें?

मैं वर्तमान में मेरे build.xml में इस चींटी लक्ष्य सेटअप है:

<target name="release-brandA" 
      depends="default, -set-release-mode, -release-obfuscation-check, -package, -post-package, -release-prompt-for-password, -release-nosign, -release-sign, -post-build" 
      description="Builds the application in release mode for brandA."> 
    <delete dir="${res}" /> 
    <copydir dest="${res}" src="${branding}/brandA" forceoverwrite="ture" /> 
    <replaceregexp flags="g" byline="false"> 
     <regexp pattern="import com.arthur.android(.*).R;"/> 
     <substitution expression="import com.arthur.android.brandA.R;"/> 
     <fileset dir="src" includes="**/*.java" /> 
    </replaceregexp> 
    <replaceregexp flags="g" byline="false"> 
     <regexp pattern="package=&quot;com.arthur.android(.*)&quot;" /> 
     <substitution expression="package=&quot;com.arthur.android.brandA&quot;" /> 
     <fileset dir="" includes="AndroidManifest.xml" /> 
    </replaceregexp> 
</target> 

वहाँ एक रास्ता है कि मैं कुछ और कार्य जोड़ सकता है, यह बताने के लिए आउटपुट फ़ाइल सिर्फ brandA.apk तरह है?

धन्यवाद!

उत्तर

10

अंतिम apk फ़ाइल नाम वास्तव में 'out.final.file'

संपत्ति के द्वारा परिभाषित किया गया है तो आप एक नया टास्क कि इस गुण सेट बना सकते हैं:,

<target name="-set-out-final-file"> 
    <property name="out.final.file" location="${out.absolute.dir}/brandA.apk" /> 
</target> 

अंत में आप सिर्फ करने की जरूरत है डीबग या रिलीज लक्ष्यों को कॉल करने से पहले -set-out-final-file लक्ष्य का आह्वान करें।

अपने release-brandA कार्य का उपयोग करना, यह इस बन जाएगा:

<target name="release-brandA" 
     depends="default, -set-out-final-file, -set-release-mode, -release-obfuscation-check... 
+0

बिल्कुल मुझे क्या चाहिए! धन्यवाद! – Arthur0902

1

Here मैं और अधिक बेहतर विवरण और अधिक उपयुक्त तरीका रिहाई लक्ष्य ओवरराइड करने के लिए मिल गया।

अनुभाग देखें:

<target 
     name="release" 
     depends="custom-set-release-mode, android_rules.release" /> 
0

इसकी बहुत simple.Refer इस लिंक [1]: https://ant.apache.org/manual/running.html

तो उपरोक्त मामले में, हम इस तरह इसे चलाने के लिए की जरूरत है,

चींटी डीबग-Dout.final.file = brandA.apk

यह है।