3

I'm attempting to develop an Android application using the following:

Eclipse Luna 4.4.0 Latest ADT plugin (https://dl-ssl.google.com/android/eclipse/) Maven + android-maven-plugin 4.0.0-rc.2

in Eclipse IDE, everything works fine if the AndroidManifest.xml and res folder is located in the root of the android project. However, if these two are NOT located in the root of the android project, an error will show stating those files are missing.

is there a way, in ADT plugin to configure the location of AndroidManifest.xml and res folder? Basically, I want to move it to src/main directory.

Reason being, is because the android-maven-plugin ver 4.x requires that AndroidManifest.xml and res folder should be in src/main directory or else it wont build. is there a way also in android-maven-plugin 4.x++ to configure the location of AndroidManifest.xml and res folder?

Cœur
  • 37,241
  • 25
  • 195
  • 267
xtrycatchx
  • 354
  • 4
  • 10
  • Guys, please note we will [support non-ADT paths with android-maven-plugin 4.0.0](https://github.com/rgladwell/m2e-android/issues/266) soon in m2e-android (actually it already works if you explicitly declare the path in `androidManifestFile`). – WonderCsabo Dec 04 '14 at 22:29

2 Answers2

9

I found the answer.

Just in case somebody encounters the same concern, the solution actually is just a configuration in android-maven-plugin for <resourceDirectory/> and <androidManifestFile/>. Something like this:

<plugin>
  <groupId>com.simpligility.maven.plugins</groupId>
  <artifactId>android-maven-plugin</artifactId>
  <version>${android-plugin-version}</version>
  <extensions>true</extensions>
    <configuration>
      <sign><debug>both</debug></sign>
      <resourceDirectory>${basedir}/res</resourceDirectory>
      <androidManifestFile>${basedir}/AndroidManifest.xml</androidManifestFile>
    </configuration>
 </plugin>
rayryeng
  • 102,964
  • 22
  • 184
  • 193
xtrycatchx
  • 354
  • 4
  • 10
  • Nice one, I tried using the libraries 'standard location' by moving the AndroidManifest to /src/main which worked in maven but not in eclipse. Anyone know why they (android-maven-plugin) decided to drastically change the folder structure to one that's not supported by ADT? The android-maven-plugin, although useful, is one of the most unstable libraries I've used even the name of the library itself is perpetually in the state of being renamed to maven-android-plugin – alex.p Dec 03 '14 at 17:09
  • 3
    You'll also need to update the assets and native lib folder as well if you use this method (and are using assets/nativelibs) : `${basedir}/assets ${basedir}/libs` – alex.p Dec 03 '14 at 17:13
  • @alex.p ... the rename to android-maven-plugin was forced upon us by a naming convention from the Apache Software Foundation. The recent change to the new groupId was discussed and agreed upon in the mailinglist and allows us much better cooperation for development of the plugin. Feel free to help out... – Manfred Moser Dec 13 '14 at 02:46
  • @alex.p and in terms of directory structure. We adopted the directory structure of the Gradle plugin since it is much closer to the Maven directory structure anyway and it is one of the reasons why we change major version number to 4 following semantic versioning where API breakages force a major version change. – Manfred Moser Dec 13 '14 at 02:48
0

If you have folder structure in the old way, you can tell maven where to look. This is what worked for me(details here):

<plugin>
<groupId>com.simpligility.maven.plugins</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>...</version>
<extensions>true</extensions>
    <configuration>
        ...
        <resourceDirectory>${project.basedir}/res</resourceDirectory>
        <androidManifestFile>${project.basedir}/AndroidManifest.xml</androidManifestFile>
        <assetsDirectory>${project.basedir}/assets</assetsDirectory> 
        <genDirectory>${project.basedir}/gen</genDirectory>
        <nativeLibrariesDirectory>${project.basedir}/lib</nativeLibrariesDirectory>
    </configuration>
</plugin>
Caner
  • 57,267
  • 35
  • 174
  • 180