Descargo de responsabilidad: Conozco los conceptos básicos de la firma de un APK y tengo un problema con solo uno de mis proyectos y solo cuando firmo con Microsoft Windows como el SO.¿Qué tipo de obstáculos existen para la firma de la APK de Android?
Estoy construyendo mi APK con Maven y firme con la experta-jarsigner-plugin:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
<executions>
<execution>
<id>signing</id>
<goals>
<goal>sign</goal>
</goals>
<phase>package</phase>
<inherited>true</inherited>
<configuration>
<archive>target/${project.build.finalName}.apk</archive>
<sigfile>CERT</sigfile>
<keystore>${env.HOME}/.keystore</keystore>
<storepass>${env.KEY_STOREPASS}</storepass>
<keypass>${env.KEY_KEYPASS}</keypass>
<alias>${env.KEY_ALIAS}</alias>
</configuration>
</execution>
</executions>
</plugin>
Ahora con uno de mis proyectos me sale el siguiente error al intentar instalar e iniciar la aplicación:
1360 KB/s (2057872 bytes in 1.477s)
pkg: /data/local/tmp/FX-602P-Droid-5.0.0.apk
Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES]
como dije en la primera frase: funciona bien al firmar con Mac OS X. Sólo se produce un error cuando se utiliza Windows 7 a firmar.
Usando --debug
al llamar Maven veo que el jarsigner se llama bien y reportes ningún error:
[INFO]
[INFO] --- maven-jarsigner-plugin:1.2:sign (signing) @ FX-602P-Droid ---
[DEBUG] org.apache.maven.plugins:maven-jarsigner-plugin:jar:1.2:
[DEBUG] org.apache.maven:maven-plugin-api:jar:2.0.6:compile
[DEBUG] org.apache.maven:maven-project:jar:2.0.6:compile
[DEBUG] org.apache.maven:maven-settings:jar:2.0.6:compile
[DEBUG] org.apache.maven:maven-profile:jar:2.0.6:compile
[DEBUG] org.apache.maven:maven-model:jar:2.0.6:compile
[DEBUG] org.apache.maven:maven-artifact-manager:jar:2.0.6:compile
[DEBUG] org.apache.maven:maven-repository-metadata:jar:2.0.6:compile
[DEBUG] org.apache.maven:maven-plugin-registry:jar:2.0.6:compile
[DEBUG] org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile
[DEBUG] junit:junit:jar:3.8.1:compile
[DEBUG] classworlds:classworlds:jar:1.1-alpha-2:compile
[DEBUG] org.apache.maven:maven-artifact:jar:2.0.6:compile
[DEBUG] org.codehaus.plexus:plexus-utils:jar:1.5.15:compile
[DEBUG] Created new class realm plugin>org.apache.maven.plugins:maven-jarsigner-plugin:1.2
[DEBUG] Importing foreign packages into class realm plugin>org.apache.maven.plugins:maven-jarsigner-plugin:1.2
[DEBUG] Imported: < project>net.sourceforge.uiq3:FX-602P-Droid:5.0.0
[DEBUG] Populating class realm plugin>org.apache.maven.plugins:maven-jarsigner-plugin:1.2
[DEBUG] Included: org.apache.maven.plugins:maven-jarsigner-plugin:jar:1.2
[DEBUG] Included: junit:junit:jar:3.8.1
[DEBUG] Included: org.codehaus.plexus:plexus-utils:jar:1.5.15
[DEBUG] Excluded: org.apache.maven:maven-plugin-api:jar:2.0.6
[DEBUG] Excluded: org.apache.maven:maven-project:jar:2.0.6
[DEBUG] Excluded: org.apache.maven:maven-settings:jar:2.0.6
[DEBUG] Excluded: org.apache.maven:maven-profile:jar:2.0.6
[DEBUG] Excluded: org.apache.maven:maven-model:jar:2.0.6
[DEBUG] Excluded: org.apache.maven:maven-artifact-manager:jar:2.0.6
[DEBUG] Excluded: org.apache.maven:maven-repository-metadata:jar:2.0.6
[DEBUG] Excluded: org.apache.maven:maven-plugin-registry:jar:2.0.6
[DEBUG] Excluded: org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1
[DEBUG] Excluded: classworlds:classworlds:jar:1.1-alpha-2
[DEBUG] Excluded: org.apache.maven:maven-artifact:jar:2.0.6
[DEBUG] Configuring mojo org.apache.maven.plugins:maven-jarsigner-plugin:1.2:sign from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-jarsigner-plugin:1.
2, parent: [email protected]]
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-jarsigner-plugin:1.2:sign' with basic configurator -->
[DEBUG] (f) alias = krischik
[DEBUG] (f) archive = C:\Work\uiq3\Java\FX-602P-Droid\target\FX-602P-Droid-5.0.0.apk
[DEBUG] (f) arguments = []
[DEBUG] (f) keypass = Atlan.
[DEBUG] (f) keystore = C:\Users\martin.krischik/.keystore
[DEBUG] (f) processAttachedArtifacts = true
[DEBUG] (f) processMainArtifact = true
[DEBUG] (f) project = MavenProject: net.sourceforge.uiq3:FX-602P-Droid:5.0.0 @ C:\Work\uiq3\Java\FX-602P-Droid\pom.xml
[DEBUG] (f) removeExistingSignatures = false
[DEBUG] (f) sigfile = CERT
[DEBUG] (f) skip = false
[DEBUG] (f) storepass = !AtlanRhodan!
[DEBUG] (f) verbose = false
[DEBUG] -- end configuration --
[DEBUG] Verarbeite C:\Work\uiq3\Java\FX-602P-Droid\target\FX-602P-Droid-5.0.0.apk
[DEBUG] 'cmd.exe /X /C "C:\opt\Java\jdk\1.7.0\bin\jarsigner.exe -keystore C:\Users\martin.krischik/.keystore -storepass '*****' -keypass '*****' -sigfile CERT C:\Work\u
iq3\Java\FX-602P-Droid\target\FX-602P-Droid-5.0.0.apk krischik"'
[INFO] 1 Archiv(e) verarbeitet
[INFO]
¿Qué otra cosa podría haber ido mal?
PD: acabo de notar C:\opt\Java\jdk\1.7.0\bin\jarsigner.exe
- ¿Ha habido un cambio en el jarsigner de 1.6 a 1.7? ¿Y por qué usaría Maven el firmante 1.7 para un proyecto de 1.6?
** Actualización: ** De hecho, es un problema con el jarsigner. El uso del 1.6 jar-signer desde la línea de comandos funciona como se esperaba. - Entonces, esto se convierte en una pregunta maven: ¿cómo especificar qué jarsigner usar en maven? – Martin
** Actualización: ** El 1.7 jarsigner usa un algoritmo diferente que es incompatible con Android. – Martin
Esto se rastrea como un error aquí http://code.google.com/p/android/issues/detail?id=19567 –