---
title: "How to Build APK and Install APK"
author: "sillycat"
date: "2013-11-06T05:22:29Z"
tags: []
categories: ["移动开发"]
slug: "how-to-build-apk-and-install-apk"
draft: false
lastmod: "2013-11-06T05:22:29Z"
id: 1971869
url: "https://sillycat.iteye.com/blog/1971869"
---

How to Build APK and Install APK

First thing, I upgrade my maven to the latest version, so I have problem to build the apk file.

**Error Message:**  
\[INFO] --- android-maven-plugin:3.6.0:generate-sources (default-generate-sources) @ google-play-services --- \[WARNING] Error injecting: com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo java.lang.NoClassDefFoundError: Lorg/sonatype/aether/RepositorySystem;        at java.lang.Class.getDeclaredFields0(Native Method)        at java.lang.Class.privateGetDeclaredFields(Class.java:2387)        at java.lang.Class.getDeclaredFields(Class.java:1796)        at com.google.inject.spi.InjectionPoint.getInjectionPoints(InjectionPoint.java:661)        at com.google.inject.spi.InjectionPoint.forInstanceMethodsAndFields(InjectionPoint.java:366)        at com.google.inject.internal.ConstructorBindingImpl.getInternalDependencies(ConstructorBindingImpl.java:165)        at com.google.inject.internal.InjectorImpl.getInternalDependencies(InjectorImpl.java:609)        at com.google.inject.internal.InjectorImpl.cleanup(InjectorImpl.java:565)  
        at com.google.inject.internal.InjectorImpl.initializeJitBinding(InjectorImpl.java:551)

**Solution:**  
The solution is that the latest version does not mean the best version. So I roll back my maven to 3.0.5 version. It works.

The I try the eclipse related tool to generate the apk file like this.  
\[Android Tool] —&gt; \[Export Signed Android Application]

But when I try to install the APK, I use command.  
adb install -r ./LocalpointTester\_Android.apk  
adb install ./LocalpointTester\_Android.apk

If I run the command without -r option, I got Error Message:  
Failure \[INSTALL\_FAILED\_ALREADY\_EXISTS]

If I run the command with -r option, I got Error Message:  
Failure \[INSTALL\_PARSE\_FAILED\_INCONSISTENT\_CERTIFICATES]

Because the signature is different from different developers. So I uninstall the app from the device- application manager.

It works fine then.

And the APK file is automatically generated under \[Project Name] —&gt; \[bin] directory.

Or we can generate from Menu \[ Build ] ——&gt; \[Generate Signed APK]

**References:**  
http://stackoverflow.com/questions/17293940/soap-enabler-maven-build-failure  
http://maven.apache.org/download.cgi