gpt4 book ai didi

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

转载 作者:太空狗 更新时间:2023-10-29 13:41:33 25 4
gpt4 key购买 nike

我们正在使用 Maven-Android-Plugin编译使用库项目的 Android 项目。

因为插件还不支持库项目类型的包,我们使用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(Library Proejct 的包类型)的相同代码工作得很好。

谁能帮我解决这个问题?一些解决方法或想法?

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

PD:我也会将其发布到插件的开发人员组。

最佳答案

Maven Android 插件是 recently updated到 2.9.0-beta-1,支持库项目。尝试一下,看看是否有帮助。

关于android - 使用库项目在 Android 项目中找不到资源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5080117/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com