我正在尝试使用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.
更多推荐
发布评论