Noticed we should just use BarcodeFormat constants in the client for simplicity
[zxing.git] / android / build.xml
index 8afd48b..5892b8c 100644 (file)
@@ -130,8 +130,9 @@ limitations under the License.
 
   <!-- rules -->
 
-  <!-- Create the output directories if they don't exist yet. -->
-  <target name="dirs">
+  <!-- Create the output directories if they don't exist yet. All builds do a clean first
+  to prevent stale resources and to make ProGuard happy. -->
+  <target name="dirs" depends="clean">
     <echo>Creating output directories if needed...</echo>
     <mkdir dir="${resource-folder}" />
     <mkdir dir="${external-libs-folder}" />
@@ -185,8 +186,12 @@ limitations under the License.
       </classpath>
     </javac>
 
-    <!-- Optimize with ProGuard -->
     <unzip src="../core/core.jar" dest="${out-classes}" overwrite="true"/>
+
+    <antcall target="optimize"/>
+  </target>
+
+  <target name="optimize" unless="no-optimize">
     <mkdir dir="optimized"/>
     <property name="libraryjars.path" refid="android.target.classpath"/>
     <java jar="${WTK-home}/bin/proguard.jar" fork="true" failonerror="true">
@@ -196,9 +201,11 @@ limitations under the License.
       <arg value="-libraryjars ${libraryjars.path}"/>
       <arg value="-keep class com.google.zxing.client.android.*Activity"/>
       <arg value="-keep class com.google.zxing.client.android.ViewfinderView { public * ; }"/>
-      <arg value="-keep class com.google.zxing.client.android.SearchBookContents* { public * ; }"/>
+      <arg value="-keep class com.google.zxing.client.android.book.SearchBookContents* { public * ; }"/>
+      <!-- This works around some strange Android/ProGuard problem verifying MaskUtil -->
+      <arg value="-keep class com.google.zxing.qrcode.encoder.MaskUtil { public * ; }"/>
       <arg value="-target 5"/>
-      <arg value="-optimizationpasses 9"/>
+      <arg value="-optimizationpasses 4"/>
       <arg value="-dontshrink"/>
       <arg value="-dontobfuscate"/>
       <arg value="-dontskipnonpubliclibraryclasses"/>