Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Edit:</p> <p>My new way of doing this is to use my Eclipse plugin: <a href="https://github.com/banshee/AndroidProguardScala" rel="nofollow noreferrer">https://github.com/banshee/AndroidProguardScala</a> (the readme has instructions for installing and a pointer to a normal Eclipse update site).</p> <p>The old answer still works, but the new way is just better.</p> <p>[The old way] My approach:</p> <ul> <li>Use the normal Android/eclipse tools for creating a Java project.</li> <li>Add a second project containing the Scala code. That way I get to keep the generated code for future reference (I'm new at both Android and Scala). This project can reference android.jar.</li> <li>The scala project produces a jar file that's used in the java project</li> <li>Use proguard to strip the library. I believe this avoids the need for the scala-android.jar that was used in 2.7</li> </ul> <p>I haven't used this for anything more ambitious than hello, world though, so take it as more of a set of hints.</p> <p>In the scala project, I add a builder (Builder > New) that's just a shell script called pguard in the root directory of the project containing:</p> <pre><code>#!/bin/sh cd $1 PROGUARD=$HOME/dev/proguard/lib/proguard.jar LIBS= OUTPUT=lib/proguard.jar rm -f $OUTPUT AJAR=/Users/jamesmoore/dev/android-sdk-mac_86/platforms/android-7/android.jar # java -jar $PROGUARD -injars 'bin:lib/scala-library.jar(!META-INF/MANIFEST.MF,!library.properties)' -outjar $OUTPUT -libraryjars @proguard.txt java -Xmx1g -jar $PROGUARD -injars 'bin:lib/scala-library.jar(!META-INF/MANIFEST.MF,!library.properties)' -outjar $OUTPUT -libraryjars $AJAR @proguard.txt </code></pre> <p>The builder has Location set to:</p> <pre><code>${build_project}/pguard </code></pre> <p>And both working directory and arguments set to </p> <pre><code>${build_project} </code></pre> <p>Also in the root of the scala project, there's a proguard arguments file @proguard.txt:</p> <pre><code>-dontwarn -dontoptimize -dontobfuscate -dontskipnonpubliclibraryclasses -dontskipnonpubliclibraryclassmembers -keepattributes Exceptions,InnerClasses,Signature,Deprecated, SourceFile,LineNumberTable,*Annotation*,EnclosingMethod -keep public class com.banshee.** { public protected *; } </code></pre> <p>You'll want to change the -keep arguments to keep your own code, of course.</p> <p>In the java project, I add the jar file that's produced by the scala project (I use lib/proguard.jar in the script above).</p> <p>Don't add the scala project as a required project in the java project's build path, though. That will add the scala class files in addition to the jar file and confuse dex (since it'll get both the .class files and the same things in the jar). As far as I can tell, Eclipse will build everything in the workspace, so when you hit the go button, both projects get built.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload