包括AAR lib编译错误:找不到资源标识符(Including AAR lib compile error: no resource identifier found)

编程入门 行业动态 更新时间:2024-10-28 11:28:04
包括AAR lib编译错误:找不到资源标识符(Including AAR lib compile error: no resource identifier found)

我正在尝试使用Android Studio创建自己的“lib”。 我已生成aar文件并将其包含在我的测试项目中。 在我的build.gradle中,我添加了:

repositories { flatDir { dirs 'libs' } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile(name:'mysdk_name', ext:'aar') }

在我的测试项目的清单中,我添加了工具:replace =“android:theme”。 我可以使用导入的aar中的类,但是当我编译项目时,我遇到了错误:

Error:(14) No resource identifier found for attribute 'fillColor' in package 'my_package_name' Error:(14) No resource identifier found for attribute 'pageColor' in package 'my_package_name'

等等。 这是来自.aar项目的代码,其中出现错误:

<com.viewpagerindicator.CirclePageIndicator android:id="@+id/tutorial_images_indicator" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_margin="@dimen/dimen_8" app:fillColor="@color/tutorial_pager_fill_color" app:pageColor="@color/tutorial_pager_page_color" app:radius="@dimen/dimen_4" app:strokeWidth="0dp"/>

我该怎么做才能解决这些错误?

编辑:我的主应用程序使用的外部模块中定义的属性。 我以为Android Studio会自动将该模块添加到生成的.aar中,但是我找不到.aar中的那个attrs。 所以我的问题是如何在.aar中包含多个模块?

I'm trying to make my own "lib" with Android Studio. I have generated aar file and included it to my test project. In my build.gradle I've added:

repositories { flatDir { dirs 'libs' } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile(name:'mysdk_name', ext:'aar') }

And in manifest of my test project I've added tools:replace="android:theme". I can use classes from imported aar, but when I compile my project I'm getting errors:

Error:(14) No resource identifier found for attribute 'fillColor' in package 'my_package_name' Error:(14) No resource identifier found for attribute 'pageColor' in package 'my_package_name'

And so on. Here is my code from .aar project where errors appears:

<com.viewpagerindicator.CirclePageIndicator android:id="@+id/tutorial_images_indicator" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_margin="@dimen/dimen_8" app:fillColor="@color/tutorial_pager_fill_color" app:pageColor="@color/tutorial_pager_page_color" app:radius="@dimen/dimen_4" app:strokeWidth="0dp"/>

What should I do to fix these errors?

Edit: That attibutes defined in external module that my main app uses. I thought Android Studio will automaticly add that module to generated .aar, but I can't find that attrs inside .aar. So my question is how to include more than one module to .aar ?

最满意答案

所以最后我想我明白了。 我的问题是我的.aar不包含来自外部模块的资源。 我用android-fat-aar脚本来解决这个问题。

So finally I think I figured it out. My problem was that my .aar doesn't include resources from external modules. I've used android-fat-aar script to solve this problem.

更多推荐

本文发布于:2023-08-04 15:49:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1417405.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:标识符   找不到   错误   资源   AAR

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!