IntelliJ 14.1.2中的Android Maven项目无法解析appcompat v7类

IntelliJ 14.1.2中的Android Maven项目无法解析appcompat v7类,android,maven,intellij-idea,Android,Maven,Intellij Idea,我有一个Maven Android项目,它带有传统的pom.xml,我在IntelliJ 14.1.2中打开了它。我已经使用helper实用程序安装了android的maven存储库。IntelliJ成功解析依赖项: 但是,我的解决方案既不构建也不检测v4或v7 appcompat类: Error:(9, 30) java: package android.support.v4.app does not exist Error:(7, 30) java: package android.sup

我有一个Maven Android项目,它带有传统的pom.xml,我在IntelliJ 14.1.2中打开了它。我已经使用helper实用程序安装了android的maven存储库。IntelliJ成功解析依赖项:

但是,我的解决方案既不构建也不检测v4或v7 appcompat类:

Error:(9, 30) java: package android.support.v4.app does not exist
Error:(7, 30) java: package android.support.v4.app does not exist

我错过了什么

这是我的

编辑: 若要复制,请克隆并尝试编译

我还向发布了一个关于此问题的问题

编辑2 我通过使用maven repo文件夹中的一些
apklib
工件,让它在我的工作计算机上工作。我不知道他们是怎么到那里的,所以这有点问题。另外,apklib在美国是不受欢迎的

<dependency>
    <groupId>android.support</groupId>
    <artifactId>compatibility-v7-appcompat</artifactId>
    <version>22.1.1</version>
    <type>apklib</type>
    <scope>compile</scope>
</dependency>
<dependency>
    <groupId>android.support</groupId>
    <artifactId>compatibility-v7-appcompat</artifactId>
    <version>22.1.1</version>
    <type>jar</type>
    <scope>compile</scope>
</dependency>

android.support

目录C:\Users\Frode\.m2\repository\com\android/s的输出

maven android sdk部署程序的
mvn install
输出:(失败是因为它很好。它试图安装一些API v15的东西,但我没有安装)

maven android sdk部署程序的
mvn安装-P5.0
输出:(成功)


v21/Android 5.0是我安装的最新SDK

pom中缺少一些元素:

  • apk
  • android maven插件的声明
  • 对android软件包的依赖性
请参阅完整的pom.xml:

    <groupId>test</groupId>
    <artifactId>test</artifactId>
    <version>1.0</version>
    <packaging>apk</packaging>

    <dependencies>
        <dependency>
            <groupId>com.android.support</groupId>
            <artifactId>support-v4</artifactId>
            <version>22.1.1</version>
            <scope>compile</scope>
            <type>aar</type>
        </dependency>
        <dependency>
            <groupId>com.android.support</groupId>
            <artifactId>appcompat-v7</artifactId>
            <version>22.1.1</version>
            <type>aar</type>
            <scope>compile</scope>
            <exclusions>
                <exclusion>
                    <groupId>com.android.support</groupId>
                    <artifactId>support-annotations</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>android</groupId>
            <artifactId>android</artifactId>
            <version>5.0.1_r2</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>com.simpligility.maven.plugins</groupId>
                    <artifactId>android-maven-plugin</artifactId>
                    <version>4.2.0</version>
                    <extensions>true</extensions>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>com.simpligility.maven.plugins</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <configuration>
                    <sdk>
                        <platform>21</platform>
                    </sdk>
                </configuration>
            </plugin>
        </plugins>
    </build>
测试
测试
1
apk
com.android.support
支持-v4
22.1.1
编译
aar
com.android.support
appcompat-v7
22.1.1
aar
编译
com.android.support
支持注释
安卓
安卓
5.0.1r2
假如
com.simpligility.maven.plugins
安卓maven插件
4.2.0
真的
com.simpligility.maven.plugins
安卓maven插件
21

尝试使用AppCompativeActivity也不起作用。根本不解析v4或v7命名空间中的任何类。就好像我没有将依赖项添加到pom.xml文件中一样,为什么不使用
Gradle
?当人们问Java问题时,你会问他们为什么不使用C?
Java
C
是完全不同的事情。但是
Gradle
Maven
是近亲。现在唯一没有编译的是
android:theme=“@android:style/theme.AppCompat”
。有小费吗?啊。。它必须是
android:theme=“@style/theme.AppCompat
简单。现在它可以工作了-谢谢!:-)
    <groupId>test</groupId>
    <artifactId>test</artifactId>
    <version>1.0</version>
    <packaging>apk</packaging>

    <dependencies>
        <dependency>
            <groupId>com.android.support</groupId>
            <artifactId>support-v4</artifactId>
            <version>22.1.1</version>
            <scope>compile</scope>
            <type>aar</type>
        </dependency>
        <dependency>
            <groupId>com.android.support</groupId>
            <artifactId>appcompat-v7</artifactId>
            <version>22.1.1</version>
            <type>aar</type>
            <scope>compile</scope>
            <exclusions>
                <exclusion>
                    <groupId>com.android.support</groupId>
                    <artifactId>support-annotations</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>android</groupId>
            <artifactId>android</artifactId>
            <version>5.0.1_r2</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>com.simpligility.maven.plugins</groupId>
                    <artifactId>android-maven-plugin</artifactId>
                    <version>4.2.0</version>
                    <extensions>true</extensions>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>com.simpligility.maven.plugins</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <configuration>
                    <sdk>
                        <platform>21</platform>
                    </sdk>
                </configuration>
            </plugin>
        </plugins>
    </build>