Eclipse Luna,Android Maven无法识别xml修改

时间:2014-08-30 15:52:49

标签: android maven m2e eclipse-luna

自更新Luna以来,不再在Activity中的R-references中识别xml修改(例如,使用 findViewById )。这是某个错误还是错过了一些Eclipse配置。 要在Activity中查看R-references,我总是要Maven构建项目并执行Project-> Clean then。这非常烦人。这个问题与哪些想法有关? (在Eclipse项目设置中检查自动构建)

这些是已安装的软件及其版本:

Eclipse software and versions

这是我当前项目的示例pom:

<?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.mycompany</groupId>
    <artifactId>mygame</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>apk</packaging>
    <name>My Game</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <platform.version>4.4.2</platform.version>
        <android.version>19</android.version>
        <android.plugin.version>3.9.0-rc.2</android.plugin.version>
        <java.version>1.6</java.version>
        <android.sdk.path>/opt/android-sdk-linux</android.sdk.path>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <mockito.version>1.9.5</mockito.version>
        <jackson.version>1.9.13</jackson.version>
        <junit.version>4.8.2</junit.version>
        <hamcrest.version>1.3</hamcrest.version>
        <annotations.version>4.1.1.4</annotations.version>
        <supportv4.version>r13</supportv4.version>
    </properties>

    <dependencies>
        <!-- LInt Annotations -->
        <dependency>
            <groupId>com.google.android</groupId>
            <artifactId>annotations</artifactId>
            <version>${annotations.version}</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-mapper-asl</artifactId>
            <version>${jackson.version}</version>
        </dependency>

        <!-- Non Android Tests --><!-- hamcrest must be before JUnit due to build errors -->
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-all</artifactId>
            <version>${hamcrest.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <version>${mockito.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-api-mockito</artifactId>
            <version>1.5.1</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-module-junit4</artifactId>
            <version>1.5.1</version>
            <scope>test</scope>
        </dependency>

        <!-- JUnit has to be before Android, otherwise powermock causes a runtimeexception 
            "at junit.runner.version.id" -->
        <dependency>
            <groupId>com.google.android</groupId>
            <artifactId>android</artifactId>
            <version>${platform.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.android</groupId>
            <artifactId>support-v4</artifactId>
            <version>${supportv4.version}</version>
        </dependency>
        <dependency>
            <groupId>com.nineoldandroids</groupId>
            <artifactId>library</artifactId>
            <version>2.4.0</version>
        </dependency>

    </dependencies>

    <build>
        <outputDirectory>target/classes</outputDirectory>
        <testOutputDirectory>target/test-classes</testOutputDirectory>
        <plugins>
            <plugin>
                <artifactId>maven-jarsigner-plugin</artifactId>
                <version>1.2</version>
                <configuration>
                    <finalName>${project.artifactId}-${project.version}</finalName>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.5.1</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.5</version>
                <configuration>
                    <encoding>${project.build.sourceEncoding}</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <version>${android.plugin.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <androidManifestFile>${project.basedir}/AndroidManifest.xml</androidManifestFile>
                    <assetsDirectory>${project.basedir}/assets</assetsDirectory>
                    <resourceDirectory>${project.basedir}/res</resourceDirectory>
                    <nativeLibrariesDirectory>${project.basedir}/src/main/native</nativeLibrariesDirectory>
                    <genDirectory>${project.basedir}/gen</genDirectory>
                    <sdk>
                        <platform>${android.version}</platform>
                        <path>${android.sdk.path}</path>
                    </sdk>
                    <undeployBeforeDeploy>true</undeployBeforeDeploy>
                    <sign>
                        <debug>${debug}</debug>
                    </sign>
                </configuration>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
                <!--This plugin's configuration is used to store Eclipse m2e settings 
                    only. It has no influence on the Maven build itself. -->
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                                        <artifactId>android-maven-plugin</artifactId>
                                        <versionRange>[3.9.0-rc.2,)</versionRange>
                                        <goals>
                                            <goal>generate-sources</goal>
                                            <goal>proguard</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore></ignore>
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <profiles>
        <profile>
            <id>devel</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <debug>true</debug>
            </properties>
        </profile>

        <!-- release untested yet -->
        <profile>
            <id>release</id>
            <properties>
                <debug>false</debug>
            </properties>
            <activation>
                <property>
                    <name>performRelease</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-jarsigner-plugin</artifactId>
                        <version>1.2</version>
                        <executions>
                            <execution>
                                <id>signing</id>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <phase>package</phase>
                                <inherited>true</inherited>
                                <configuration>
                                    <archiveDirectory></archiveDirectory>
                                    <includes>
                                        <include>target/${project.artifactId}-${project.version}.apk</include>
                                    </includes>
                                    <keystore>path/to/keystore</keystore>
                                    <storepass>storepasword</storepass>
                                    <keypass>keypassword</keypass>
                                    <alias>key-alias</alias>
                                    <arguments>
                                        <argument>-sigalg</argument>
                                        <argument>MD5withRSA</argument>
                                        <argument>-digestalg</argument>
                                        <argument>SHA1</argument>
                                    </arguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                        <artifactId>android-maven-plugin</artifactId>
                        <inherited>true</inherited>
                        <configuration>
                            <zipalign>
                                <verbose>true</verbose>
                                <skip>false</skip>
                                <inputApk>${project.build.directory}/${project.artifactId}-${project.version}.apk</inputApk>
                                <outputApk>${project.build.directory}/${project.artifactId}-${project.version}-RELEASE.apk</outputApk>
                            </zipalign>

                        </configuration>
                        <executions>
                            <execution>
                                <id>zipalign</id>
                                <phase>install</phase>
                                <goals>
                                    <goal>zipalign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>

我认为我的other problem with Lint也与这个问题有关。

0 个答案:

没有答案