2010-07-13 7 views
10

जाहिर है, मैं source.properties में source.dir प्रॉपर्टी का उपयोग कर स्रोत फ़ोल्डर निर्दिष्ट कर सकता हूं - लेकिन यदि मैं एकाधिक स्रोत फ़ोल्डर्स निर्दिष्ट करना चाहता हूं तो क्या होगा?एंड्रॉइड प्रोजेक्ट बनाने के लिए चींटी का उपयोग करते समय build.properties में एकाधिक स्रोत फ़ोल्डरों को कैसे निर्दिष्ट करें?

नीचे टिप्पणी build.xml एंड्रॉयड एसडीके उपकरण द्वारा उत्पन्न फ़ाइल से कर रहे हैं:

<!-- 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.dir 
     the name of the source directory. Default is 'src'. 
    out.dir 
     the name of the output directory. 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. 

    --> 

नोट: मैं में ग्रहण निर्माण के बारे में ध्यान न - स्वचालित चींटी का उपयोग कर बनाता है की स्थापना इम।

+0

कृपया स्पष्ट करें कि आप किस कार्य का उपयोग कर रहे हैं। जावैक कार्य source.dir प्रॉपर्टी का उपयोग नहीं करता है। –

+0

एसडीके के एंड्रॉइड सीएलआई उपकरण द्वारा उत्पन्न टिप्पणियों के अनुसार एंड्रॉइड परियोजनाओं के लिए, आप build.properties में source.dir निर्दिष्ट कर सकते हैं। मैं उपरोक्त प्रश्न को अद्यतन करता हूं और टिप्पणियों में पेस्ट करता हूं। – Eno

उत्तर

18

क्या आपने पथों को अलग करने के लिए कोलन का उपयोग करने का प्रयास किया था? मेरे build.properties इस तरह दिखता है:

source.dir=src:src2:src3:src4:src5 
+3

मुझे डर है कि पुस्तकालय बनाने के दौरान यह काम नहीं करता है। –

+1

@ AndreyRegentov - यहां एंड्रॉइड लाइब्रेरी प्रोजेक्ट http://stackoverflow.com/questions/14605899/how-to-specify-multiple-source-directory-for-android-library-project के लिए समाधान है –

0

(भारी अनुकूलित) build.xml मैं यहाँ है, कि अन्य मुद्दों के एक झुंड को हल करती है में, मैं सिर्फ अपनी एक्सएमएल में संकलन लक्ष्य को खींचने के लिए होने समाप्त हो गया और वहाँ एक से अधिक स्रोत पथ निर्दिष्ट। आप वही कर सकते हैं, बस अपने build.xml में सेटअप कार्य की परिभाषा के ऊपर नया लक्ष्य डालें। ध्यान दें कि एंड्रॉइड एसडीके में चारों ओर तैरने वाली कई फाइलें हैं जो सभी को अनुकूलित करने के लिए उपयोग की जाने वाली एक जैसी दिखती है, और उनमें से कुछ गलत होने लगते हैं या कम से कम नवीनतम टूल के साथ ठीक से काम नहीं करते हैं (इनमें से एक उपकरण/चींटी/main_rules.xml मेरे विंडोज एसडीके में काम नहीं कर रहा है)। मुझे विश्वास है कि आप जो चाहते हैं वह नवीनतम एसडीके में प्लेटफॉर्म/[प्लेटफार्म-न्यूमेर] /ant/ant_rules_r2.xml में है। किसी भी दर पर, कार्य नीचे दिए गए कार्य की तरह दिखता है, और आप इसे आसानी से अन्य स्रोत निर्देशिका जोड़ सकते हैं। मैंने यहां दूसरे जवाब की तरह कोलन से अलग करने की कोशिश नहीं की है, क्योंकि जैसा कि मैंने कहा था, हमारे build.xml को कई तरीकों से अनुकूलित किया जाना था। लेकिन मुझे पता है कि यह काम करेगा।

<!-- Compiles this project's .java files into .class files. --> 
<target name="compile" depends="-resource-src, -aidl" 
      description="Compiles project's .java files into .class files"> 
    <!-- If android rules are used for a test project, its classpath should include 
     tested project's location --> 
    <condition property="extensible.classpath" 
         value="${tested.project.absolute.dir}/bin/classes" else="."> 
     <isset property="tested.project.absolute.dir" /> 
    </condition> 
    <condition property="extensible.libs.classpath" 
         value="${tested.project.absolute.dir}/libs" else="./libs"> 
     <isset property="tested.project.absolute.dir" /> 
    </condition> 
    <javac encoding="ascii" target="1.5" debug="true" extdirs="" 
      destdir="${out.classes.absolute.dir}" 
      bootclasspathref="android.target.classpath" 
      verbose="${verbose}" classpath="${extensible.classpath}" 
      classpathref="android.libraries.jars"> 
     <src path="${source.absolute.dir}" /> 
     <src path="${gen.absolute.dir}" /> 
     <src refid="android.libraries.src" /> 
     <classpath> 
      <fileset dir="${external.libs.absolute.dir}" includes="*.jar" /> 
      <fileset dir="${extensible.libs.classpath}" includes="*.jar" /> 
     </classpath> 
    </javac> 
</target> 
संबंधित मुद्दे

 संबंधित मुद्दे