Index: build/android/ant/sdk-targets.xml |
diff --git a/build/android/ant/sdk-targets.xml b/build/android/ant/sdk-targets.xml |
index 8f980b418d43b9f540a2772c18cd244618b4f380..59913e3b55c2a81f8d4056376cc368c816f2fef7 100644 |
--- a/build/android/ant/sdk-targets.xml |
+++ b/build/android/ant/sdk-targets.xml |
@@ -94,4 +94,54 @@ |
</if> |
</do-only-if-manifest-hasCode> |
</target> |
+ |
+ <!-- |
+ For debug builds, the Android SDK tools create a key in ~/.android and sign the build with it. |
+ This has caused all kinds of issues. Instead, the debug build should be signed with a key in |
+ build/android/ant. The SDK tools do not provide any support for overriding that behavior and so |
+ instead one must use the hack below. |
+ --> |
+ |
+ <!-- Disables automatic signing. --> |
+ <property name="build.is.signing.debug" value="false"/> |
+ |
+ <!-- TODO(cjhopman): Remove this property when all gyp files define the CHROMIUM_SRC property. --> |
+ <property name="CHROMIUM_SRC" value="${PRODUCT_DIR}/../.." /> |
+ |
+ <property name="key.store" value="${CHROMIUM_SRC}/build/android/ant/chromium-debug.keystore"/> |
+ <property name="key.store.password" value="chromium"/> |
+ <property name="key.alias" value="chromiumdebugkey"/> |
+ <property name="key.alias.password" value="chromium"/> |
+ |
+ <!-- SDK tools assume that out.packaged.file is signed and name it "...-unaligned" --> |
+ <property name="out.packaged.file" |
+ value="${out.dir}/${ant.project.name}-debug-unsigned.apk" /> |
+ <property name="out.unaligned.file" |
+ value="${out.dir}/${ant.project.name}-debug-unaligned.apk" /> |
+ |
+ <!-- By default, the SDK tools build only aligns the APK in the -do-debug target. --> |
+ <target name="-do-debug" |
+ depends="-set-debug-mode, -debug-obfuscation-check, -package, -post-package"> |
+ <!-- only create apk if *not* a library project --> |
+ <do-only-if-not-library elseText="Library project: do not create apk..." > |
+ <sequential> |
+ <!-- Signs the APK --> |
+ <echo level="info">Signing final apk...</echo> |
+ <signapk |
+ input="${out.packaged.file}" |
+ output="${out.unaligned.file}" |
+ keystore="${key.store}" |
+ storepass="${key.store.password}" |
+ alias="${key.alias}" |
+ keypass="${key.alias.password}"/> |
+ |
+ <!-- Zip aligns the APK --> |
+ <zipalign-helper |
+ in.package="${out.unaligned.file}" |
+ out.package="${out.final.file}" /> |
+ <echo level="info">Release Package: ${out.final.file}</echo> |
+ </sequential> |
+ </do-only-if-not-library> |
+ <record-build-info /> |
+ </target> |
</project> |