Reputation: 9065
When I try compile a android project generated with this command:
mvn archetype:generate \
-DarchetypeArtifactId=android-quickstart \
-DarchetypeGroupId=de.akquinet.android.archetypes \
-DarchetypeVersion=1.0.11 \
-DgroupId=com.kleber \
-DartifactId=app2
which generates a project with this structure:
app2
-assets
-res
...
-layout
-menu
-values
...
-src
-main
-java
-com
-kleber
HelloAndroidActivity.java
AndroidManifest.xml
default.properties
pom.xml
I got this error:
[ERROR] Found files or folders in non-standard locations in the project!
[ERROR] ....This might be a side-effect of a migration to Android Maven Plugin 4+.
[ERROR] ....Please observe the warnings for specific files and folders above.
[ERROR] ....Ideally you should restructure your project.
[ERROR] ....Alternatively add explicit configuration overrides for files or folders.
[ERROR] ....Finally you could set failOnNonStandardStructure to false, potentially resulting in other failures.
I have this pom.xml
file:
<?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.kleber</groupId>
<artifactId>app2</artifactId>
<version>1.0</version>
<packaging>apk</packaging>
<name>app2</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<platform.version>4.1.1.4</platform.version>
<android.plugin.version>4.1.1</android.plugin.version>
<android.sdk.path>C:\Users\00940831503\AppData\Local\Android\Sdk</android.sdk.path>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>${platform.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<pluginManagement>
<plugins>
<plugin>
<!--<groupId>com.jayway.maven.plugins.android.generation2</groupId>-->
<groupId>com.simpligility.maven.plugins</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>${android.plugin.version}</version>
<extensions>true</extensions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>com.simpligility.maven.plugins</groupId>
<artifactId>android-maven-plugin</artifactId>
<configuration>
<sdk>
<platform>29</platform>
</sdk>
</configuration>
</plugin>
<!--<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<configuration>
<sdk>
<platform>29</platform>
</sdk>
</configuration>
</plugin>-->
</plugins>
</build>
</project>
What the correct project structure to compile the project without errors? Is there a maven archetype which generate the project with the correct structure already?
Upvotes: 2
Views: 109
Reputation: 5881
The Android Maven plugin expects AndroidManifest.xml
in src/main
rather than in the root.
Option 1: Move AndroidManifest.xml
to the location in which the plugin expects it, though this may have side effects in the IDE you’re using (Eclipse seems to fine with it, as far as I can tell).
Option 2: Tell the plugin where to look for the file by adding the following to the POM, at projects/build/plugins/plugin/configuration
:
<androidManifestFile>
${project.basedir}/AndroidManifest.xml
</androidManifestFile>
The same applies to resources if your project has them anywhere other than src/main/res
(old projects originally built for the Eclipse/ant toolchain have them under res
). The property for these is resourceDirectory
.
Upvotes: 0