如何在ADT使用的资源在Android的库的依赖?如何在、资源、ADT、Android

2023-09-06 09:02:04 作者:叼着奶瓶逛青楼

我的开发环境:

ADT:22.3.0 Android的Maven的插件:3.8.2 行家:3.1.1

我开发使用Maven的结构和依赖关系如下一个谷歌地图Android应用:

I am developing a google map Android app with maven structure and dependencies as below:

<dependency>
  <groupId>com.google.android.gms</groupId>
  <artifactId>google-play-services</artifactId>
  <version>13.0.0</version>
  <type>apklib</type>
</dependency>

<dependency>
  <groupId>com.google.android.gms</groupId>
  <artifactId>google-play-services</artifactId>
  <version>13.0.0</version>
</dependency>

<dependency>
  <groupId>com.google.android.gms</groupId>
  <artifactId>play-services</artifactId>
  <version>4.0.30</version>
  <type>aar</type>
</dependency>

我试过APK和AAR类型,但我仍然无法在android系统的lib依赖使用的资源绘制,串等(R.drawable.poi,R.style.button_style1 ..)。我该如何处理呢?

I tried apk and aar type but I still can't use resource drawable, string etc (R.drawable.poi, R.style.button_style1..) in android lib dependency. How can I handle this?

推荐答案

一个类似的问题出现在我们的项目中更新 Android的Maven的插件从3.8.0版本后 3.8.2 ,Android的Maven的插件看起来bugy。

A similar problem appeared in our project after updating android-maven-plugin from version 3.8.0 to 3.8.2, android-maven-plugin looks bugy.

我们不得不退回到版本 3.8.0 。我建议你​​使用apklib做同样的AAR仅适用3.8.2自版本,如果你想使用 AAR 来等待后来的Andr​​oid-maven-版本插入。

We had to fallback to version 3.8.0. I recommend you to do the same using apklib as aar is only available since version 3.8.2 and in case you want to use aarto wait for later version of android-maven-plugin.

在细节,问题是在apklib的链接,引用的所有ressources(版式,图形...)似乎disaligned。例如,一个布局或绘制在显示,而不是其他。在布局访问缺少一个参考/ ID时,应用程序崩溃(参考并不present因为错误的布局加载)。

In details, the problem was in the linking of the apklib, all ressources (layouts, drawables...) referenced seemed to be disaligned. For example a layout or a drawable was displayed instead of another. Application was crashing when accessing to a missing reference/id in a layout (the reference was not present because the wrong layout was loaded).

请参阅问题的http:// code.google.com / p / Maven的Andr​​oid平台的插件/问题/细节?ID = 441