2

http://maven-android-plugin-m2site.googlecode.com/svn/apk-mojo.html#apkMetaIncludes

追加のMETA-INFリソースをapkにパッケージ化するためのパターン。APKビルダーはこれらのリソースをフィルタリングし、apkに含めません。これにより、これらのリソースに依存する依存ライブラリの動作が悪くなります。たとえば、サービス検出が機能しません。このパターンを指定することで、Androidプラグインはこれらのリソースを最終的なapkに追加します。パターンはMETA-INFに関連しています。つまり、次のものを使用する必要があります。

<apkMetaIncludes>
    <metaInclude>services/**</metaInclude>
</apkMetaIncludes>

META-INFフォルダーはsrcフォルダーの下にあります

<?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>br.com.alpha9.teste</groupId>
    <artifactId>testemvn</artifactId>
    <version>1.0.0</version>
    <packaging>apk</packaging>
    <name>testemvn</name>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <version>3.5.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>
                        <path>/Applications/android-sdk-macosx</path>
                        <platform>13</platform>
                    </sdk>
                    <undeployBeforeDeploy>true</undeployBeforeDeploy>
                    <apkMetaIncludes>
                        <metaInclude>services/**</metaInclude>
                    </apkMetaIncludes>
                </configuration>
                <extensions>true</extensions>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>com.google.android</groupId>
            <artifactId>android</artifactId>
            <version>4.0.1.2</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
</project>

最後に、私のAPKにはサービスフォルダがありません!

4

1 に答える 1

2

これは実際にはjavadocでは間違っています。私はそれを修正します。それまでの間、これは機能するはずです

<configuration>
  <apk>
    <metaIncludes>
      <metaInclude>services/**</metaInclude>
    </metaIncludes>
  </apk>
</configuration>

もちろん、それが機能することのフィードバック/確認と、ドキュメントを更新するプルリクエストも歓迎します。

于 2013-02-26T23:41:37.190 に答える