3

Maven-Android-Plugin を使用して Android プロジェクトをビルドしようとしていました。しかし、それは次のエラーを出しています:

F:\Android\AsyncTaskSample>mvn clean install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building AsyncTaskSample 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ asynctasksample ---
[INFO] Deleting F:\Android\AsyncTaskSample\target
[INFO]
[INFO] --- android-maven-plugin:3.5.0:generate-sources (default-generate-sources) @ asynctasksample ---
[INFO] ANDROID-904-002: Found aidl files: Count = 0
[INFO] ANDROID-904-002: Found aidl files: Count = 0
[INFO] Manifest merging disabled. Using project manifest only
[INFO] E:\Nitin\Android-SDK\Android\android-sdk\platform-tools\aapt.exe [package, -m, -J, F:\Android\AsyncTaskSample\target\generated-sources\r, -M, F:\Android\AsyncTaskSample\AndroidManifest.xml, -S, F:\Android\AsyncTaskSample\res, --auto-add-overlay, -A, F:\Android\AsyncTaskSample\assets, -I, E:\Nitin\Android-SDK\Android\android-sdk\platforms\android-4\android.jar]
[INFO] F:\Android\AsyncTaskSample\res\values-v11\styles.xml:3: error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo.Light'.
[ERROR] Error when generating sources.
org.apache.maven.plugin.MojoExecutionException:
        at com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.generateR(GenerateSourcesMojo.java:468)
        at com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.execute(GenerateSourcesMojo.java:193)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: com.jayway.maven.plugins.android.ExecutionException: ANDROID-040-001: Could not execute: Command = cmd.exe /X /C "E:\Nitin\Android-SDK\Android\android-sdk\platform-tools\aapt.exe package -m -J F:\Android\AsyncTaskSample\target\generated-sources\r -M F:\Android\AsyncTaskSample\AndroidManifest.xml -S F:\Android\AsyncTaskSample\res --auto-add-overlay -A F:\Android\AsyncTaskSample\assets -I E:\Nitin\Android-SDK\Android\android-sdk\platforms\android-4\android.jar", Result = 1
        at com.jayway.maven.plugins.android.CommandExecutor$Factory$1.executeCommand(CommandExecutor.java:339)
        at com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.generateR(GenerateSourcesMojo.java:464)
        ... 22 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.427s
[INFO] Finished at: Wed Jan 09 16:58:50 IST 2013
[INFO] Final Memory: 6M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.5.0:generate-sources (default-generate-sources) on project asynctasksample: MojoExecutionException: ANDROID-040-001: Could not execute: Command = cmd.exe /X /C "E:\Nitin\Android-SDK\Android\android-sdk\platform-tools\aapt.exe package -m -J F:\Android\AsyncTaskSample\target\generated-sources\r -M F:\Android\AsyncTaskSample\AndroidManifest.xml -S F:\Android\AsyncTaskSample\res --auto-add-overlay -A F:\Android\AsyncTaskSample\assets -I E:\Nitin\Android-SDK\Android\android-sdk\platforms\android-4\and
roid.jar", Result = 1 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
F:\Android\AsyncTaskSample>

pom.xml の内容は次のとおりです。

<?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>com.example</groupId>
    <artifactId>asynctasksample</artifactId>
    <version>1.0</version>
    <packaging>apk</packaging>
    <name>AsyncTaskSample</name>

    <dependencies>
        <dependency>
            <groupId>com.google.android</groupId>
            <artifactId>android</artifactId>
            <version>1.6_r2</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
    <build>
        <finalName>${project.artifactId}</finalName>
        <sourceDirectory>src</sourceDirectory>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                    <artifactId>android-maven-plugin</artifactId>
                    <version>3.5.0</version>

                    <extensions>true</extensions>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <configuration>
                    <sdk>
                        <!-- platform or api level (api level 4 = platform 1.6)-->
                        <platform>4</platform>
                    </sdk>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

settings.xml ファイルの内容 @ "C:\Users\rsahu.m2" は次のとおりです。

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
            http://maven.apache.org/xsd/settings-1.0.0.xsd">
        <pluginGroups>
            <pluginGroup>com.jayway.maven.plugins.android.generation2</pluginGroup>
        </pluginGroups>
        <profiles>
            <profile>
                <id>android</id>
                <properties>
                    <android.sdk.path>
                        E:\Nitin\Android-SDK\Android\android-sdk
                    </android.sdk.path>
                </properties>
            </profile>
        </profiles>
        <activeProfiles>
            <!--make the profile active all the time -->
            <activeProfile>android</activeProfile>
        </activeProfiles>
    </settings>

上記のファイルの内容を調べることで、問題を解決できますか!!! 私にお知らせください。ありがとう。

4

1 に答える 1

4

Maven出力でこのエラーに気づきました

No resource found that matches the given name 'android:Theme.Holo.Light'

また、ターゲット Android OS を 1.6 として指定していることもpom.xml

<dependency>
    <groupId>com.google.android</groupId>
    <artifactId>android</artifactId>
    <version>1.6_r2</version>
    <scope>provided</scope>
</dependency>

テーマを次のようなものに変更する必要がありますandroid:Theme.Light

または、依存関係のターゲット Android バージョンをより高いバージョンに変更します。ホロは Android 4.0 (レベル 16) でのみ利用可能になりました

于 2013-01-09T11:44:29.703 に答える