2012-03-22 290 views
9

從「jarsigner -verify」的結果可以看出,我的APK確實已簽名,而且我仍然會安裝「Failure」。任何幫助將是偉大的!爲什麼adb因故障[INSTALL_PARSE_FAILED_NO_CERTIFICATES]失敗?

[email protected]:~/workspace/myapp$ ~/android-sdk-linux_15/platform-tools/adb install target/myapp-aligned.apk 
3857 KB/s (352413 bytes in 0.089s) 
pkg: /data/local/tmp/myapp-aligned.apk 
Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES] 
[email protected]:~/workspace/OVIVO$ jarsigner -verify target/myapp-aligned.apk 
jar verified. 
[email protected]:~/workspace/myapp$ java -version 
java version "1.6.0_23" 
OpenJDK Runtime Environment (IcedTea6 1.11pre) (6b23~pre11-0ubuntu1.11.10.2) 
OpenJDK Server VM (build 20.0-b11, mixed mode) 
[email protected]:~/workspace/myapp$ 

我要建這個項目maven3,從行家日誌可以在下面看到,無法找到任何東西應該導致破簽字的步驟,。

[email protected]:~/workspace/myapp$ mvn3 clean install -Pmyapp,monkey 
[INFO] Scanning for projects... 
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for com.goldengekko.myapp.selfcare:myapp-selfcare:apk:1.11-SNAPSHOT 
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-resources-plugin is missing. @ line 166, column 12 
[WARNING] 'build.plugins.plugin.version' for org.codehaus.mojo:build-helper-maven-plugin is missing. @ line 213, column 12 
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build. 
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects. 
[WARNING] 
[INFO]                   
[INFO] ------------------------------------------------------------------------ 
[INFO] Building com.goldengekko.myapp.selfcare:myapp-selfcare 1.11-SNAPSHOT 
[INFO] ------------------------------------------------------------------------ 
Downloading: http://maven.goldengekko.com:8001/nexus/content/groups/public/org/apache/maven/plugins/maven-resources-plugin/maven-metadata.xml 
Downloaded: http://maven........maven-metadata.xml (704 B at 0.5 KB/sec) 
[INFO] 
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ myapp-selfcare --- 
[INFO] Deleting /home/carl-emil/workspace/myapp/target 
[INFO] 
[INFO] --- build-helper-maven-plugin:1.5:parse-version (parse-version) @ myapp-selfcare --- 
[INFO] 
[INFO] --- maven-resources-plugin:2.5:resources (default) @ myapp-selfcare --- 
[debug] execute contextualize 
[INFO] Using 'UTF-8' encoding to copy filtered resources. 
[INFO] Copying 62 resources to res 
[INFO] Copying 1 resource to res 
[INFO] Copying 1 resource to res/values/ 
[INFO] Copying 1 resource to /home/carl-emil/workspace/myapp/target/filtered-manifest 
[INFO] 
[INFO] --- android-maven-plugin:3.1.1:generate-sources (default-generate-sources) @ myapp-selfcare --- 
[DEBUG] Expanding: /home/carl-emil/.m2/repository/com/viewpagerindicator/library/2.2.3/library-2.2.3.apklib into /home/carl-emil/workspace/myapp/target/unpack/apklibs/com.viewpagerindicator_library_apklib_2.2.3 
[DEBUG] expand complete 
[INFO] ANDROID-904-002: Found aidl files: Count = 0 
[INFO] ANDROID-904-002: Found aidl files: Count = 0 
[INFO] ANDROID-904-002: Found aidl files: Count = 0 
[INFO] /home/carl-emil/android-sdk-linux_15/platform-tools/aapt [package, -m, -J, /home/carl-emil/workspace/myapp/target/generated-sources/r, -M, /home/carl-emil/workspace/myapp/target/filtered-manifest/AndroidManifest.xml, -S, /home/carl-emil/workspace/myapp/res, -S, /home/carl-emil/workspace/myapp/target/unpack/apklibs/com.viewpagerindicator_library_apklib_2.2.3/res, --auto-add-overlay, -A, /home/carl-emil/workspace/myapp/assets, -I, /home/carl-emil/android-sdk-linux_15/platforms/android-8/android.jar] 
[INFO] /home/carl-emil/android-sdk-linux_15/platform-tools/aapt [package, -m, -J, /home/carl-emil/workspace/myapp/target/generated-sources/r, --custom-package, com.viewpagerindicator, -M, /home/carl-emil/workspace/myapp/target/filtered-manifest/AndroidManifest.xml, -S, /home/carl-emil/workspace/myapp/res, -S, /home/carl-emil/workspace/myapp/target/unpack/apklibs/com.viewpagerindicator_library_apklib_2.2.3/res, --auto-add-overlay, -A, /home/carl-emil/workspace/myapp/assets, -A, /home/carl-emil/workspace/myapp/target/unpack/apklibs/com.viewpagerindicator_library_apklib_2.2.3/assets, -I, /home/carl-emil/android-sdk-linux_15/platforms/android-8/android.jar] 
[INFO] 
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ myapp-selfcare --- 
[debug] execute contextualize 
[INFO] Using 'UTF-8' encoding to copy filtered resources. 
[INFO] Copying 62 resources to res 
[INFO] Copying 1 resource to res 
[INFO] Copying 1 resource to res/values/ 
[INFO] Copying 1 resource to /home/carl-emil/workspace/myapp/target/filtered-manifest 
[INFO] skip non existing resourceDirectory /home/carl-emil/workspace/myapp/target/generated-sources/extracted-dependencies/src/main/resources 
[INFO] Copying 0 resource 
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ myapp-selfcare --- 
[INFO] Compiling 36 source files to /home/carl-emil/workspace/myapp/target/classes 
[INFO] 
[INFO] --- maven-antrun-plugin:1.6:run (FixManifest) @ myapp-selfcare --- 
[INFO] Executing tasks 

main: 
inotify_add_watch: No such file or directory 
[INFO] Executed tasks 
[INFO] 
[INFO] registerToSubTree : warning, failed to register /home/carl-emil/workspace/myapp/target/filtered-manifest/rep2865681923253179562.tmp :Error watching /home/carl-emil/workspace/myapp/target/filtered-manifest/rep2865681923253179562.tmp : No such file or directory--- android-maven-plugin:3.1.1:proguard (default-proguard) @ myapp-selfcare --- 

inotify_add_watch: No such file or directory 
registerToSubTree : warning, failed to register /home/carl-emil/workspace/myapp/target/filtered-manifest/rep244121430022461645.tmp :Error watching /home/carl-emil/workspace/myapp/target/filtered-manifest/rep244121430022461645.tmp : No such file or directory 
[INFO] 
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ myapp-selfcare --- 
[debug] execute contextualize 
[INFO] Using 'UTF-8' encoding to copy filtered resources. 
[INFO] skip non existing resourceDirectory /home/carl-emil/workspace/myapp/src/test/resources 
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ myapp-selfcare --- 
[INFO] No sources to compile 
[INFO] 
[INFO] --- maven-surefire-plugin:2.12:test (default-test) @ myapp-selfcare --- 
[INFO] No tests to run. 
[INFO] Surefire report directory: /home/carl-emil/workspace/myapp/target/surefire-reports 

------------------------------------------------------- 
T E S T S 
------------------------------------------------------- 

Results : 

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0 

[INFO] 
[INFO] --- android-maven-plugin:3.1.1:dex (default-dex) @ myapp-selfcare --- 
[INFO] /usr/lib/jvm/java-7-openjdk-i386/jre/bin/java [-Xmx1024M, -jar, /home/carl-emil/android-sdk-linux_15/platform-tools/lib/dx.jar, --dex, --output=/home/carl-emil/workspace/myapp/target/classes.dex, /home/carl-emil/.m2/repository/com/viewpagerindicator/library/2.2.3/library-2.2.3.apklib, /home/carl-emil/.m2/repository/android/support.v4/0.0.6/support.v4-0.0.6.jar, /home/carl-emil/.m2/repository/com/googlecode/androidannotations/androidannotations/2.4/androidannotations-2.4-api.jar, /home/carl-emil/workspace/myapp/target/classes, /home/carl-emil/.m2/repository/com/directionalviewpager/library/1.2.0/library-1.2.0.jar, /home/carl-emil/.m2/repository/com/google/code/gson/gson/1.6/gson-1.6.jar, /home/carl-emil/.m2/repository/com/sun/codemodel/codemodel/2.4.1/codemodel-2.4.1.jar] 
[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ myapp-selfcare --- 
[INFO] Building jar: /home/carl-emil/workspace/myapp/target/myapp-selfcare.jar 
[INFO] 
[INFO] --- android-maven-plugin:3.1.1:apk (default-apk) @ myapp-selfcare --- 
[INFO] Copying dependency assets files to combined assets directory. 
[INFO] Copying local assets files to combined assets directory. 
[INFO] /home/carl-emil/android-sdk-linux_15/platform-tools/aapt [package, -f, -M, /home/carl-emil/workspace/myapp/target/filtered-manifest/AndroidManifest.xml, -S, /home/carl-emil/workspace/myapp/res, -S, /home/carl-emil/workspace/myapp/target/unpack/apklibs/com.viewpagerindicator_library_apklib_2.2.3/res, --auto-add-overlay, -A, /home/carl-emil/workspace/myapp/target/generated-sources/combined-assets/assets, -I, /home/carl-emil/android-sdk-linux_15/platforms/android-8/android.jar, -F, /home/carl-emil/workspace/myapp/target/myapp-selfcare.ap_] 
[INFO] 
[INFO] --- maven-jarsigner-plugin:1.2:sign (signing) @ myapp-selfcare --- 
[INFO] 2 archive(s) processed 
[INFO] 
[INFO] --- android-maven-plugin:3.1.1:zipalign (alignApk) @ myapp-selfcare --- 
[INFO] Running command: /home/carl-emil/android-sdk-linux_15/tools/zipalign 
[INFO] with parameters: [-f, 4, /home/carl-emil/workspace/myapp/target/myapp-selfcare.apk, /home/carl-emil/workspace/myapp/target/myapp-selfcare-aligned.apk] 
[INFO] Attach /home/carl-emil/workspace/myapp/target/myapp-selfcare-aligned.apk to the project 
[INFO] 
[INFO] --- android-maven-plugin:3.1.1:internal-pre-integration-test (default-internal-pre-integration-test) @ myapp-selfcare --- 
[INFO] No InstrumentationRunner found - skipping tests 
[INFO] 
[INFO] --- android-maven-plugin:3.1.1:internal-integration-test (default-internal-integration-test) @ myapp-selfcare --- 
[INFO] No InstrumentationRunner found - skipping tests 
[INFO] 
[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ myapp-selfcare --- 
JNotifyAdapterLinux: warning, recieved event for an unregisted LinuxWD -1 ignoring... 
JNotifyAdapterLinux: warning, recieved event for an unregisted LinuxWD -1 ignoring... 
JNotifyAdapterLinux: warning, recieved event for an unregisted LinuxWD -1 ignoring... 
[INFO] Installing /home/carl-emil/workspace/myapp/target/myapp-selfcare.apk to /home/carl-emil/.m2/repository/com/goldengekko/myapp/selfcare/myapp-selfcare/1.11-SNAPSHOT/myapp-selfcare-1.11-SNAPSHOT.apk 
[INFO] Installing /home/carl-emil/workspace/myapp/pom.xml to /home/carl-emil/.m2/repository/com/goldengekko/myapp/selfcare/myapp-selfcare/1.11-SNAPSHOT/myapp-selfcare-1.11-SNAPSHOT.pom 
[INFO] Installing /home/carl-emil/workspace/myapp/target/myapp-selfcare.jar to /home/carl-emil/.m2/repository/com/goldengekko/myapp/selfcare/myapp-selfcare/1.11-SNAPSHOT/myapp-selfcare-1.11-SNAPSHOT.jar 
[INFO] Installing /home/carl-emil/workspace/myapp/target/myapp-selfcare-aligned.apk to /home/carl-emil/.m2/repository/com/goldengekko/myapp/selfcare/myapp-selfcare/1.11-SNAPSHOT/myapp-selfcare-1.11-SNAPSHOT-aligned.apk 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD SUCCESS 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 47.769s 
[INFO] Finished at: Fri Mar 23 08:59:37 UTC 2012 
[INFO] Final Memory: 13M/64M 
[INFO] ------------------------------------------------------------------------ 
+0

是的,只粘貼日誌簽名部分周圍的行。 – erbsman 2012-03-23 08:57:57

+0

現在我添加了maven的完整日誌。還有其他什麼是相關的,我應該在這裏添加以使我的問題更清晰?謝謝! – erbsman 2012-03-23 09:09:48

+0

Maven日誌對我來說看起來很正常。你是否推薦安裝到模擬器或真實設備? – yorkw 2012-03-23 10:13:24

回答

16

找到了!我是有這個問題,「蟻族」,這是由於在文檔中提到了這一點警告:

http://developer.android.com/guide/publishing/app-signing.html#signapp

Caution: As of JDK 7, the default signing algorithim has changed, requiring you to specify the signature and digest algorithims (-sigalg and -digestalg) when you sign an APK.

我有JDK 7,我不能爲你的OpenJDK的IcedTea說話,但它可能是同一個問題。你的Maven日誌沒有提供足夠的細節。在我的螞蟻的日誌,我用-v爲詳細,它顯示

$ ant -Dadb.device.arg=-d -v release install 
[signjar] Executing 'C:\Program Files\Java\jdk1.7.0_03\bin\jarsigner.exe' with arguments: 
[signjar] '-keystore' 
[signjar] 'C:\cygwin\home\Chloe\pairfinder\release.keystore' 
[signjar] '-signedjar' 
[signjar] 'C:\cygwin\home\Chloe\pairfinder\bin\PairFinder-release-unaligned.apk' 
[signjar] 'C:\cygwin\home\Chloe\pairfinder\bin\PairFinder-release-unsigned.apk' 
[signjar] 'mykey' 
[exec]  pkg: /data/local/tmp/PairFinder-release.apk 
[exec] Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES] 

我手動簽署的JAR和zipalign處理它,但它給了一個稍微不同的錯誤:

$ "$JAVA_HOME"/bin/jarsigner -sigalg MD5withRSA -digestalg SHA1 -keystore release.keystore -signedjar bin/PairFinder-release-unaligned.apk bin/PairFinder-release-unsigned.apk mykey 
$ zipalign -v -f 4 bin/PairFinder-release-unaligned.apk bin/PairFinder-release.apk 
$ adb -d install -r bin/PairFinder-release.apk 
     pkg: /data/local/tmp/PairFinder-release.apk 
Failure [INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES] 
641 KB/s (52620 bytes in 0.080s) 

我發現這裏回答。

How to deal with INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES without uninstallation

我只需要卸載它,然後它的工作!

$ adb -d uninstall com.kizbit.pairfinder 
Success 
$ adb -d install -r bin/PairFinder-release.apk 
     pkg: /data/local/tmp/PairFinder-release.apk 
Success 
641 KB/s (52620 bytes in 0.080s) 

現在我只需要修改build.xml以在簽名時使用這些選項!

確定這裏是:C:\ Program Files文件\的Java \ Android的SDK \工具\螞蟻\ build.xml文件

  <signjar 
        sigalg="MD5withRSA" 
        digestalg="SHA1" 
        jar="${out.packaged.file}" 
        signedjar="${out.unaligned.file}" 
        keystore="${key.store}" 
        storepass="${key.store.password}" 
        alias="${key.alias}" 
        keypass="${key.alias.password}" 
        verbose="${verbose}" /> 
+1

Thanx的幫助! – erbsman 2012-04-10 05:46:25

1

我建立使用MonoDevelop的調試[microsoft.net]配置應用程序。現在它工作正常。

2

至於建議至少螞蟻1.8.3 here使用,並把這個片段到你的Ant文件:

<presetdef name="signjar"> 
    <signjar sigalg="MD5withRSA" digestalg="SHA1" /> 
</presetdef> 
0

在我的情況,我可以建立和運行發佈版本,但得到的INSTALL_PARSE_FAILED_NO_CERTIFICATES錯誤嘗試時做一個調試版本。

解決方案是刪除我的debug.keystore文件,然後讓構建系統重新創建它。

0

對於其他遇到類似問題的人 - 我有同樣的錯誤,但它似乎不是簽名算法。我只需要使用Java 1.6中的jarsigner。我使用的簽名算法似乎對於兩個都是一樣的:dsaWithSHA1,但1.6工作,1.7不。