使用库项目在Android项目中找不到资源

时间:2011-02-22 15:28:30

标签: android maven-2 project maven-plugin

我们正在使用Maven-Android-Plugin来编译使用图书馆计划的Android项目。

因为插件不支持Library项目类型的包,我们正在使用插件的this modification

编译主项目时我们收到此错误:

[INFO] /home/win1frogtek/androidSDK/platform-tools/aapt [package, -m, -J, /home/win1frogtek/workspaceBranch/conoceTuTienda/target/generated-sources/gen, -M, /home/win1frogtek/workspaceBranch/conoceTuTienda/target/generated-sources/apklibs/libtek/AndroidManifest.xml, -S, /home/win1frogtek/workspaceBranch/conoceTuTienda/res, -S, /home/win1frogtek/workspaceBranch/conoceTuTienda/target/generated-sources/apklibs/libtek/res, --auto-add-overlay, -A, /home/win1frogtek/workspaceBranch/conoceTuTienda/assets, -I, /home/win1frogtek/androidSDK/platforms/android-4/android.jar]
[INFO] /home/win1frogtek/workspaceBranch/conoceTuTienda/res/layout/screen_play_home.xml:72: error: No resource identifier found for attribute 'maxPoints' in package 'org.frogtek.conoceTuTienda'
[ERROR] Error when generating sources.
org.apache.maven.plugin.MojoExecutionException: 
    at com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.generateRForManifest(GenerateSourcesMojo.java:455)
    at com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.generateApklibR(GenerateSourcesMojo.java:410)
    at com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.execute(GenerateSourcesMojo.java:135)
    at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
    at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
    at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
    at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: com.jayway.maven.plugins.android.ExecutionException: ANDROID-040-001: Could not execute: Command = /bin/sh -c cd /home/win1frogtek/workspaceBranch/conoceTuTienda && /home/win1frogtek/androidSDK/platform-tools/aapt package -m -J /home/win1frogtek/workspaceBranch/conoceTuTienda/target/generated-sources/gen -M /home/win1frogtek/workspaceBranch/conoceTuTienda/target/generated-sources/apklibs/libtek/AndroidManifest.xml -S /home/win1frogtek/workspaceBranch/conoceTuTienda/res -S /home/win1frogtek/workspaceBranch/conoceTuTienda/target/generated-sources/apklibs/libtek/res --auto-add-overlay -A /home/win1frogtek/workspaceBranch/conoceTuTienda/assets -I /home/win1frogtek/androidSDK/platforms/android-4/android.jar, Result = 1
    at com.jayway.maven.plugins.android.CommandExecutor$Factory$1.executeCommand(CommandExecutor.java:186)
    at com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.generateRForManifest(GenerateSourcesMojo.java:453)
    ... 21 more

我们正在使用自定义小部件,如下所示:

  • 主项目中的attrs.xml

                      

  • 主项目中的任何布局......

    <org.frogtek.conoceTuTienda.widgets.MedalWidget android:id="@+id/ct_manejas_medal"
        android:layout_marginTop="200px" android:layout_marginLeft="25px"
        android:background="@drawable/ct_play_medal_empty" frogtek:maxPoints="4"
        android:layout_width="wrap_content" android:layout_height="wrap_content">
    </org.frogtek.conoceTuTienda.widgets.MedalWidget>
    

我做了一些测试和更改,显然是一个插件相关的问题,相同的代码没有依赖于apklib(图书馆Proejct的包类型)工作得很好。

有人可以帮我这个吗?一些解决方法或想法?

感谢您提供任何线索或帮助。

PD:我也会将此发布给插件的开发者组。

1 个答案:

答案 0 :(得分:2)

Maven Android插件为recently updated至2.9.0-beta-1,支持图书馆项目。尝试一下,看看它是否有帮助。