2013-06-11 7 views
2

Мы модифицировали сборщик андроидов. Файл build.xml выглядит следующим образом в настоящее время:Модифицированный андроид с градиентом

<?xml version="1.0" encoding="UTF-8"?> 

<!-- This is a modified version of the "dex-helper" macro. It added the "input-dir" and 
    "output-dex-file" required attributes. 
    Configurable macro, which allows to pass as parameters input directory, 
    output directory, output dex filename and external libraries to dex (optional) --> 
<macrodef name="dex-helper-mod"> 
    <attribute name="input-dir" /> 
    <attribute name="output-dex-file" /> 
    <element name="external-libs" optional="yes" /> 
    <element name="extra-parameters" optional="yes" /> 
    <attribute name="nolocals" default="false" /> 
    <sequential> 

     <property name="out.dex.input.absolute.dir" value="${out.classes.absolute.dir}" /> 
     <!-- set the secondary dx input: the project (and library) jar files 
      This has been disabled in order to avoid redundant class definitions in the plugin and the core app 
     <if> 
      <condition> 
       <isreference refid="out.dex.jar.input.ref" /> 
      </condition> 
      <else> 
       <path id="out.dex.jar.input.ref"> 
        <path refid="project.all.jars.path" /> 
       </path> 
      </else> 
     </if> --> 

     <echo>Converting compiled files and external libraries into @{output-dex-file}...</echo> 
     <dex executable="${dx}" output="@{output-dex-file}" nolocals="@{nolocals}" verbose="${verbose}"> 
      <path path="@{input-dir}" /> 
      <!-- <path refid="out.dex.jar.input.ref" /> --> 
      <external-libs /> 
     </dex> 
    </sequential> 
</macrodef> 

<!-- This is a modified version of "-dex" target taken from $SDK/tools/ant/main_rules.xml --> 
<!-- Converts this project's .class files into .dex files --> 
<target name="-dex" depends="-compile, -post-compile, -obfuscate" unless="do.not.compile"> 
    <if condition="${manifest.hasCode}"> 
     <then> 

      <mkdir dir="${out.classes.absolute.dir}" /> 

      <copy todir="${out.classes.absolute.dir}"> 
       <fileset dir="${out.classes.absolute.dir}"> 

       </fileset> 
      </copy> 


      <dex-helper-mod input-dir="${out.classes.absolute.dir}" output-dex-file="${out.absolute.dir}/${dex.file.name}" /> 
     </then> 
     <else> 
      <echo>hasCode = false. Skipping...</echo> 
     </else> 
    </if> 
</target> 

<!-- version-tag: custom --> 
<import file="${sdk.dir}/tools/ant/build.xml" /> 

Теперь мы переносим наши построения логики Gradle. Возможно ли изменить конструкцию градиента, как указано выше?

+0

Я не уверен, что делать изменения. Это поможет, если вы просто скажете нам, чего вы пытаетесь достичь. –

+0

@Xav Я считаю, что endian говорит об этом http://android-developers.blogspot.pt/2011/07/custom-class-loading-in-dalvik.html, которого я также пытаюсь достичь с помощью Gradle. –

+0

Если кому-то нужен «другой» ответ, возможно, это то, что вы ищете: http://stackoverflow.com/q/18174022/40480 –

ответ

1

После Gradle код помогает миграции из муравьиного сценария:

android { 
    buildTypes { 
     // prevents dexing of lib classes 
     // replaces the modified ant script 
     applicationVariants.each { variant -> 
      variant.dex.libraries = new ArrayList<?>() 
     } 
    } 
} 
+0

Реально ли это решает вашу проблему? Я думал, что вы используете этот файл сборки Ant для создания отдельных файлов .dex и выполняете загрузку пользовательских классов, например статью. Вы не? Я спрашиваю об этом, потому что я мог найти подходящий способ подражать всему скрипту в Gradle. У меня просто нет ответа, чтобы отправить ответ здесь. Вы заинтересованы или это действительно решит вашу проблему? –

+0

Этот скрипт действительно решает нашу проблему. – endian

Смежные вопросы