Android编写行家? APK未知 [英] Android with maven? Apk unknown

查看:127
本文介绍了Android编写行家? APK未知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无法获取的Andr​​oid与Maven的工作。可能是什么问题(从Maven快速原型生成):

 < XML版本=1.0编码=UTF-8&GT?;
<项目的xmlns =htt​​p://maven.apache.org/POM/4.0.0的xmlns:XSI =htt​​p://www.w3.org/2001/XMLSchema-instance
         XSI:的schemaLocation =htt​​p://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    < modelVersion> 4.0.0< / modelVersion>
    <的groupId> ASD< /的groupId>
    < artifactId的> ASD< / artifactId的>
    <版> 0.0.1  - 快照 -  LT; /版本>
    <包装> APK< /包装>
    <名称>&ASD LT; /名称>

    <性状>
        < platform.version> 4.0.3< /platform.version>
    < /性状>

    <依赖>
        <依赖>
            <的groupId> com.google.android< /的groupId>
            < artifactId的>的android< / artifactId的>
            <版> $ {platform.version}< /版本>
            <范围>提供与LT; /范围>
        < /依赖性>
    < /依赖性>

    <建立>
        <插件>
            <插件>
                <的groupId> com.jayway.maven.plugins.android.generation2< /的groupId>
                < artifactId的> Android的行家,插件和LT; / artifactId的>
                <版> 3.2.0< /版本>
                <结构>
                    &LT; androidManifestFile&GT; $ {project.basedir} /AndroidManifest.xml</androidManifestFile>
                    &LT; assetsDirectory&GT; $ {project.basedir} /资产&LT; / assetsDirectory&GT;
                    &LT; resourceDirectory&GT; $ {project.basedir} / RES&LT; / resourceDirectory&GT;
                    &LT; nativeLibrariesDirectory&GT; $ {project.basedir} / src目录/主/本地&LT; / nativeLibrariesDirectory&GT;
                    &LT; SDK&GT;
                        &LT;平台&GT; 15℃; /平台&GT;
                    &LT; / SDK&GT;
                    &LT;仿真器&GT;
                        &LT; AVD&GT; Android4&LT; / AVD&GT;
                    &LT; /仿真器&GT;
                    &LT; undeployBeforeDeploy&GT;真&LT; / undeployBeforeDeploy&GT;
                &LT; /结构&gt;
                &LT;扩展&GT;真&LT; /扩展&GT;
            &LT; /插件&GT;

            &LT;插件&GT;
                &LT; artifactId的&GT; Maven的编译器插件&LT; / artifactId的&GT;
                &LT;版&GT; 2.3.2&LT; /版本&GT;
                &lt;结构&GT;
                    &lt;信源&GT; 1.6&LT; /源&GT;
                    &lt;目标&GT; 1.6&LT; /目标和GT;
                &LT; /结构&gt;
            &LT; /插件&GT;
        &LT; /插件&GT;
    &LT; /编译&GT;
&LT; /项目&GT;
 

信息为:

 项目生成错误:未知包装:APK
 

+

 项目生成错误:Unresolveable构建扩展:插件
com.jayway.maven.plugins.android.generation2:Android的Maven的插件:3.2.0或它的一个
依赖关系无法解析:无法收集依赖关系
com.jayway.maven.plugins.android.generation2:Android的Maven的插件:罐子:3.2.0()
 

解决方案

我目前使用我的项目的Andr​​oid Maven的插件3.1.1,并给它与3.2.0一个尝试,它看起来像Maven有一些麻烦下载所需一个依赖 艾玛 - 2.1.5320.jar 从Maven的中央仓库,但是,我已经厌倦了 MVN全新安装好几次,最后得到艾玛 - 2.1 .5320.jar下载。

尝试运行 MVN全新安装几次,如果仍然不能正常工作,请下载并手动安装,艾玛 - 2.1.5320.jar与源和javadoc的可在 Maven的中央仓库

  MVN安装:安装文件-Dfile =艾玛 -  2.1.5320.jar \
                     -Dsources =艾玛 -  2.1.5320,sources.jar \
                     -Djavadoc =艾玛 -  2.1.5320,javadoc.jar \
                     -DgroupId =艾玛\
                     -DartifactId =艾玛\
                     -Dversion = 2.1.5320 \
                     -Dpackaging =罐
 

您应该能够使用Android系统的maven-3.2.0插件现在,希望这有助于。

Cannot get Android to work with maven. What could be the problem (generated from maven quickstart archetype):

<?xml version="1.0" encoding="UTF-8"?>
<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>
    <groupId>asd</groupId>
    <artifactId>asd</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>apk</packaging>
    <name>asd</name>

    <properties>
        <platform.version>4.0.3</platform.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.google.android</groupId>
            <artifactId>android</artifactId>
            <version>${platform.version}</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <version>3.2.0</version>
                <configuration>
                    <androidManifestFile>${project.basedir}/AndroidManifest.xml</androidManifestFile>
                    <assetsDirectory>${project.basedir}/assets</assetsDirectory>
                    <resourceDirectory>${project.basedir}/res</resourceDirectory>
                    <nativeLibrariesDirectory>${project.basedir}/src/main/native</nativeLibrariesDirectory>
                    <sdk>
                        <platform>15</platform>
                    </sdk>
                    <emulator>
                        <avd>Android4</avd>
                    </emulator>
                    <undeployBeforeDeploy>true</undeployBeforeDeploy>
                </configuration>
                <extensions>true</extensions>
            </plugin>

            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

Leads to:

Project build error: Unknown packaging: apk

+

Project build error: Unresolveable build extension: Plugin 
com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.2.0 or one of its 
dependencies could not be resolved: Failed to collect dependencies for 
com.jayway.maven.plugins.android.generation2:android-maven-plugin:jar:3.2.0 ()

解决方案

I am currently using android-maven-plugin 3.1.1 for my project and give it a try with 3.2.0, It looks like Maven has some trouble downloading one of the required dependencies emma-2.1.5320.jar from Maven Central Repository, however, I have tired mvn clean install several times and finally get emma-2.1.5320.jar downloaded.

Try running mvn clean install several times, if it still doesn't work, download and install it manually, emma-2.1.5320.jar with source and javadoc are available on Maven Central Repository:

mvn install:install-file -Dfile=emma-2.1.5320.jar \
                     -Dsources=emma-2.1.5320-sources.jar \
                     -Djavadoc=emma-2.1.5320-javadoc.jar \
                     -DgroupId=emma \
                     -DartifactId=emma \
                     -Dversion=2.1.5320 \
                     -Dpackaging=jar

You should be able to use android-maven-plugin 3.2.0 now, hope this helps.

这篇关于Android编写行家? APK未知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆