Android + Maven"在'android'包中找不到属性'installLocation'的资源标识符"

Mik*_*son 9 android maven android-maven-plugin

为我的Android应用程序添加支持,我installLocation在我的IDE(IntelliJ)中将我的android级别从7提高到8.Android应用程序从IntelliJ构建良好.

我们虽然使用maven,但是从Maven开始无法编译.

[ERROR] C:\dev\svnlocal\5x\android\AndroidManifest.xml:3: error: No resource identifier found for attribute 'installLocation' in package 'android'
[ERROR] Error when generating sources.
Run Code Online (Sandbox Code Playgroud)

我还补充道

<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="8"/>
Run Code Online (Sandbox Code Playgroud)

我一直在

No resource identifier found for attribute 'installLocation' in package 'android'
Run Code Online (Sandbox Code Playgroud)

我改变了我的依赖性

<dependency>
  <groupId>android</groupId>
  <artifactId>android</artifactId>
  <version>2.1_r1</version>
  <scope>provided</scope>    
</dependency>
Run Code Online (Sandbox Code Playgroud)

<dependency>
  <groupId>com.google.android</groupId>
  <artifactId>android</artifactId>
  <version>2.2.1</version>
  <scope>provided</scope>    
</dependency>
Run Code Online (Sandbox Code Playgroud)

但我仍然收到此错误消息.

少了什么东西?

Mik*_*son 6

随着mvn package -X我可以看到它与编译android-sdk-windows/platforms/android-7,而不是android-8.

我终于追踪到了

<plugins>
  <plugin>
    <groupId>com.jayway.maven.plugins.android.generation2</groupId>
    <artifactId>maven-android-plugin</artifactId>
    ...
    <sdk>
      <platform>7</platform>
    </sdk>
Run Code Online (Sandbox Code Playgroud)

platform应该在哪里<platform>8</platform>


Nam*_* Vu 6

但是,构建目标需要更新到API级别8(Android 2.2),否则您将收到以下错误:

error: No resource identifier found for attribute ‘installLocation’ in package ‘android’

通过编辑项目属性来更改构建目标(在Eclipse中右键单击项目),然后选择至少具有API级别8的目标: