gpt4 book ai didi

android - maven-android-plugin 和 Android 测试项目提供 INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES

转载 作者:行者123 更新时间:2023-11-28 21:05:18 25 4
gpt4 key购买 nike

我正在尝试使用 maven-android-plugin 来启动 InstrumentationTestRunner 测试。

我创建了一个应用程序 com.my.app .
我创建了一个简单的 Android Test Project com.my.app.test2 .
我让 maven 使用 jarsigner 自动签署 apk。

对于 sining,我使用相同的 KeyStore。
无论如何,当我尝试通过执行 maven clean install 来执行测试项目时,出现以下错误

Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.6.0:internal-pre-integration-test (default-internal-pre-integration-test) on project eticapptest2: 42f7a71e823ebff9_samsung_GT-N7105 :   Install of D:\AndroidApp\com.my.app.test2\target\eticapptest2-1.0.0-SNAPSHOT.apk failed - [INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES

我试过的:

当我检查在 maven 运行期间生成和签名的 APK 时 - 我看到,两者(com.my.app.apk 和 com.my.app.test2.apk)都被正确签名。
证书是一样的。

错误的原因可能是什么?

我的 com.my.app POM


<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.my.app.apps</groupId>
<artifactId>root</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>

<properties>
<deivukeypass>APP_PASS_HERE</deivukeypass>
</properties>

<artifactId>eticapp</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>apk</packaging>
<name>eTicApp</name>

<dependencies>

<!-- Basic Android API + Compatibility -->
<dependency>
<groupId>android</groupId>
<artifactId>android</artifactId>
<version>4.2.2_r2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>android.support</groupId>
<artifactId>compatibility-v13</artifactId>
<version>18</version>
</dependency>

<!-- NeoReaderSDK (Barcode-Scanner) -->
<dependency>
<groupId>com.my.app.apps</groupId>
<artifactId>neoreadersdk</artifactId>
<version>${project.version}</version>
<type>apklib</type>
</dependency>

<!-- ADAC/Postbus-Ticket-Records und -Decoder -->
<dependency>
<groupId>com.my.app</groupId>
<artifactId>common-barcode-android</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>

<!-- Implementierung fur Logging (slf4j) -->
<!-- diese impl macht probleme und funktioniert zur zeit nicht??
Auskommentiert um den Fehler ersteinmal loszuwerden!
<dependency>
<groupId>com.github.tony19</groupId>
<artifactId>logback-android-classic</artifactId>
<version>1.0.10-2</version>
<exclusions>
<exclusion>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
</exclusion>
</exclusions>
</dependency> -->


<!-- ORMlite fur Android -->
<dependency>
<groupId>com.j256.ormlite</groupId>
<artifactId>ormlite-android</artifactId>
<version>4.46</version>
<exclusions>
<!-- Android-Artefakte haben bei uns andere Koordinaten -->
<exclusion>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- JSonPath is like xpath xml, but for JSON -->
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<version>0.8.1</version>
</dependency>

</dependencies>

<build>
<!-- Android-Standard-Verzeichnisstruktur verwenden -->
<sourceDirectory>src</sourceDirectory>

<plugins>



<!-- Maven plugin which is responsible for signing apks -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
<executions>
<execution>
<id>signing</id>
<goals>
<goal>sign</goal>
<goal>verify</goal>
</goals>
<phase>package</phase>
<inherited>true</inherited>
<configuration>
<removeExistingSignatures>true</removeExistingSignatures>
<archiveDirectory/>
<includes>
<include>${project.build.finalName}</include>
</includes>
<keystore>${basedir}/local/AndroidDeveloperCertificate.jks</keystore>
<alias>adtkey</alias>
<storepass>${deivukeypass}</storepass>
<keypass>${deivukeypass}</keypass>
<verbose>true</verbose>
<arguments>
<argument>-sigalg</argument><argument>MD5withRSA</argument>
<argument>-digestalg</argument><argument>SHA1</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>

<!-- Maven-Android-Plugin konfigurieren -->
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<sdk>
<platform>4.2.2</platform>
</sdk>
<undeployBeforeDeploy>true</undeployBeforeDeploy>
<sign>
<debug>false</debug>
</sign>
<zipalign>
<verbose>true</verbose>
<inputApk>${project.build.directory}/${project.artifactId}-${project.version}.apk</inputApk> <!-- target/eticapp-1.0.0-SNAPSHOT.apk -->
<outputApk>${project.build.directory}/${project.artifactId}-${project.version}-signed-aligned.apk</outputApk>
</zipalign>
</configuration>

<executions>
<execution>
<id>alignApk</id>
<phase>package</phase>
<goals>
<goal>zipalign</goal>
</goals>
</execution>
</executions>
</plugin>

</plugins>
</build>

<profiles>
<profile>
<!-- Profil fur Release-Versionen zum Setzen der Version -->
<id>setVisualVersion</id>
<build>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<manifest>
<versionName>${env.IVU-VERSION-MAJOR}.${env.IVU-VERSION-MINOR}.${env.IVU-VERSION-REVISION} ${env.IVU-VERSION-BUILD} Build-${buildNumber}</versionName>
<versionCode>${buildNumber}</versionCode>
</manifest>
</configuration>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>manifest-update</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>

我的 com.my.app.test2 POM


<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.my.app.apps</groupId>
<artifactId>root</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>

<artifactId>eticapptest2</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>apk</packaging>
<name>eTicApp - Test</name>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>4.1.1.4</version>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android-test</artifactId>
<version>4.1.1.4</version>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>4.1.1.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android-test</artifactId>
<version>4.1.1.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.my.app.apps</groupId>
<artifactId>eticapp</artifactId>
<version>1.0.0-SNAPSHOT</version>
<type>apk</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.my.app.apps</groupId>
<artifactId>eticapp</artifactId>
<version>1.0.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
<!-- Android-Standard-Verzeichnisstruktur verwenden -->
<sourceDirectory>src</sourceDirectory>

<plugins>
<!-- Maven-Android-Plugin konfigurieren -->
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<sdk>
<platform>4.2.2</platform>
</sdk>
<undeployBeforeDeploy>false</undeployBeforeDeploy>
<sign>
<debug>false</debug>
</sign>
<zipalign>
<verbose>true</verbose>
<inputApk>${project.build.directory}/${project.artifactId}-${project.version}.apk</inputApk> <!-- target/eticapp-1.0.0-SNAPSHOT.apk -->
<outputApk>${project.build.directory}/${project.artifactId}-${project.version}-signed-aligned.apk</outputApk>
</zipalign>
</configuration>

<executions>
<execution>
<id>alignApk</id>
<phase>package</phase>
<goals>
<goal>zipalign</goal>
</goals>
</execution>
</executions>
</plugin>


<!-- Maven plugin which is responsible for signing apks -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
<executions>
<execution>
<id>signing</id>
<goals>
<goal>sign</goal>
<goal>verify</goal>
</goals>
<phase>package</phase>
<inherited>true</inherited>
<configuration>
<removeExistingSignatures>true</removeExistingSignatures>
<archiveDirectory/>
<includes>
<include>${project.build.finalName}</include>
</includes>
<keystore>${basedir}/local/AndroidDeveloperCertificate.jks</keystore>
<alias>adtkey</alias>
<storepass>APP_PASS_HERE</storepass>
<keypass>APP_PASS_HERE</keypass>
<verbose>true</verbose>
<arguments>
<argument>-sigalg</argument><argument>MD5withRSA</argument>
<argument>-digestalg</argument><argument>SHA1</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>

</plugins>

</build>

</project>

最佳答案

INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES
该错误表明您安装了具有不同证书的应用程序版本。

运行前 mvn clean install ,卸载这两个应用程序:

  • adb uninstall com.my.app
  • adb uninstall com.my.app.test2
  • 关于android - maven-android-plugin 和 Android 测试项目提供 INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19142102/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com