Added a new blackbox test with extreme shadows and highlights. We do pretty poorly...
[zxing.git] / android / build.xml
index b036492..f7760de 100644 (file)
@@ -14,7 +14,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 -->
-<project name="BarcodeScanner" default="debug">
+<project name="BarcodeScanner" default="debug-optimized">
   <!-- SDK Locations -->
   <property file="../build.properties"/>
   <property name="sdk-folder" value="${android-home}"/>
@@ -149,7 +149,7 @@ limitations under the License.
   </target>
 
   <!-- Compile this project's .java files into .class files. -->
-  <target name="compile" depends="dirs, resource-src, aidl">
+  <target name="compile" depends="clean, dirs, resource-src, aidl">
     <javac encoding="ascii" target="1.5" debug="true" extdirs=""
            srcdir="."
            destdir="${outdir-classes}"
@@ -160,7 +160,7 @@ limitations under the License.
     </javac>
   </target>
 
-  <target name="compile-release" depends="dirs, resource-src, aidl">
+  <target name="compile-release" depends="clean, dirs, resource-src, aidl">
     <javac encoding="ascii" target="1.5" debug="off" extdirs=""
            srcdir="."
            destdir="${outdir-classes}"
@@ -171,6 +171,19 @@ limitations under the License.
     </javac>
   </target>
 
+  <!--
+  Getting an error like this?
+
+   [apply] UNEXPECTED TOP-LEVEL EXCEPTION:
+   [apply] com.android.dx.cf.code.SimException: local variable type
+   mismatch: attempt to set or access a value of type int using a local
+   variable of type com.google.zxing.qrcode.decoder.Version. This is
+   symptomatic of .class transformation tools that ignore local variable
+   information.
+
+  Build core/ with the 'build-no-debug' target. It's a long story.
+  -->
+
   <target name="optimize" depends="compile-release">
     <fail message="Please put proguard.jar in 'bin' under the WTK install directory">
       <condition>
@@ -188,11 +201,11 @@ limitations under the License.
       <arg value="-injars temp.jar"/>
       <arg value="-outjars temp-optimized.jar"/>
       <arg value="-libraryjars ${android-jar}"/>
-      <arg value="-keepattributes Exceptions,InnerClasses,Signature,!LocalVariableTable,!LocalVariableTypeTable"/>
       <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="-target 5"/>
       <arg value="-optimizationpasses 7"/>
-      <arg value="-allowaccessmodification"/>
       <arg value="-dontshrink"/>
       <arg value="-dontobfuscate"/>
       <arg value="-dontskipnonpubliclibraryclasses"/>
@@ -207,6 +220,7 @@ limitations under the License.
   <!-- Convert this project's .class files into .dex files. -->
   <target name="dex" depends="compile">
     <echo>Converting compiled files and external libraries into ${outdir}/${dex-file}...</echo>
+    <echo>NOTE: This will fail unless you built core with build-no-debug.</echo>
     <apply executable="${dx}" failonerror="true" parallel="true">
       <arg value="--dex" />
       <arg value="--output=${intermediate-dex-ospath}" />
@@ -217,6 +231,7 @@ limitations under the License.
 
   <target name="dex-optimized" depends="compile-release,optimize">
     <echo>Converting compiled files and external libraries into ${outdir}/${dex-file}...</echo>
+    <echo>NOTE: This will fail unless you built core with build-no-debug.</echo>      
     <apply executable="${dx}" failonerror="true" parallel="true">
       <arg value="--dex" />
       <arg value="--output=${intermediate-dex-ospath}" />
@@ -263,10 +278,7 @@ limitations under the License.
     </exec>
   </target>
 
-  <!-- Invoke the proper target depending on whether or not
-an assets directory is present. -->
-  <!-- TODO: find a nicer way to include the "-A ${asset-dir}" argument
-only when the assets dir exists. -->
+  <!-- Invoke the proper target depending on whether or not an assets directory is present. -->
   <target name="package-res">
     <available file="${asset-dir}" type="dir"
                property="res-target" value="and-assets" />
@@ -325,7 +337,7 @@ only when the assets dir exists. -->
   </target>
 
   <!-- Install the package on the default emulator -->
-  <target name="install" depends="debug">
+  <target name="install">
     <echo>Installing ${out-debug-package} onto default emulator...</echo>
     <exec executable="${adb}" failonerror="true">
       <arg value="install" />
@@ -333,7 +345,7 @@ only when the assets dir exists. -->
     </exec>
   </target>
 
-  <target name="reinstall" depends="debug">
+  <target name="reinstall">
     <echo>Installing ${out-debug-package} onto default emulator...</echo>
     <exec executable="${adb}" failonerror="true">
       <arg value="install" />