Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot add com.google.maps.android:android-maps-utils-apklib:0.4.2:apklib to the build #718

Closed
lyubomyr-shaydariv opened this issue Mar 2, 2016 · 0 comments

Comments

@lyubomyr-shaydariv
Copy link
Contributor

Hi,

Sorry if I'm asking a vague and very lengthy question, but I'm not sure if it's a real issue or a misconfiguration in my build. I'm trying to add the following dependency:

<dependency>
    <groupId>com.google.maps.android</groupId>
    <artifactId>android-maps-utils-apklib</artifactId>
    <version>0.4.2</version>
    <type>apklib</type>
</dependency>

And this is what I get during a regular mvn clean package command:

...\app-android\target\unpacked-libs\cgma_android-maps-utils-apklib_0.4.2\AndroidManifest.xml:7: error: Error: No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version').

The actual generated command is:

"C:\Program Files (x86)\Android\android-sdk\build-tools\23.0.1\aapt.exe"
    package
    --non-constant-id
    -m
    -J ...\app-android\target\generated-sources\r
    --custom-package com.google.maps.android
    -M ...\app-android\target\unpacked-libs\cgma_android-maps-utils-apklib_0.4.2\AndroidManifest.xml
    -S ...\app-android\target\unpacked-libs\cgma_android-maps-utils-apklib_0.4.2\res
    --auto-add-overlay -I "C:\Program Files (x86)\Android\android-sdk\platforms\android-15\android.jar"
    --output-text-symbols ...\app-android\target\unpacked-libs\cgma_android-maps-utils-apklib_0.4.2

failing at generateRForApkLibDependency()

at com.simpligility.maven.plugins.android.CommandExecutor$Factory$DefaultCommandExecutor.executeCommand(CommandExecutor.java:248)
at com.simpligility.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.generateRForApkLibDependency(GenerateSourcesMojo.java:1047)

If I add the missing resources manually, say:

<aaptExtraArgs>
    <!-- this is necessary to unpack com.google.maps.android:android-maps-utils-apklib:0.4.2:apklib -->
    <aaptExtraArg>-S</aaptExtraArg>
    <aaptExtraArg>${project.build.directory}/unpacked-libs/cgag_play-services_6.5.87/res</aaptExtraArg>
</aaptExtraArgs>

or

<resourceOverlayDirectories>
    <!-- this is necessary to unpack com.google.maps.android:android-maps-utils-apklib:0.4.2:apklib -->
    <resourceOverlayDirectory>${project.build.directory}/unpacked-libs/cgag_play-services_6.5.87/res</resourceOverlayDirectory>
</resourceOverlayDirectories>

I get a slightly different error:

\app-android\target\unpacked-libs\cgag_play-services_6.5.87\res\values\admob_ads_attrs.xml:10: error: Attribute "adSize" has already been defined
\app-android\target\unpacked-libs\cgag_play-services_6.5.87\res\values\admob_ads_attrs.xml:17: error: Attribute "adSizes" has already been defined
...

This happens because the resource gets into the generated command twice:

"C:\Program Files (x86)\Android\android-sdk\build-tools\23.0.1\aapt.exe"
    package
    -m
    -J ...\app-android\target\generated-sources\r
    -f
    --no-crunch -M ...\app-android\target\AndroidManifest.xml
    -S ...\app-android\src\main\android\res
    -S ...\app-android\target\unpacked-libs\cgma_android-maps-utils-apklib_0.4.2\res
    -S ...\app-android\target\unpacked-libs\cgag_play-services_6.5.87\res
    --auto-add-overlay
    -A ...\app-android\target\generated-sources\combined-assets
    -I "C:\Program Files (x86)\Android\android-sdk\platforms\android-15\android.jar"
    --output-text-symbols ...\app-android\target
    -S ...\app-android\target/unpacked-libs/cgag_play-services_6.5.87/res

(please note -S ...\app-android\target/unpacked-libs/cgag_play-services_6.5.87/res occurring two times). However, now it fails in another method, generateR():

at com.simpligility.maven.plugins.android.CommandExecutor$Factory$DefaultCommandExecutor.executeCommand(CommandExecutor.java:248)
at com.simpligility.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.generateR(GenerateSourcesMojo.java:895)

In short, specifying no additional dependency-related parameters does not add any mention to generated commands, but specifying any of <aaptExtraArgs> or <resourceOverlayDirectories> causes the dependency resources to occur twice.

Could you please confirm whether it works as expected, or I just do it totally wrong? Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant