support.v7.R in Library verwenden

  • Antworten:1
Barbaric Chicken
  • Forum-Beiträge: 66

12.09.2014, 11:19:30 via Website

Hallo,

ich stehe vor folgendem Problem:
Projekt 1:
Verwendet die support v7 library und greift über android.support.v7.appcompat.R.id auf eine ID zu. Funktioniert perfekt.
Projekt 2:
Nutzt Projekt 1 als Bibliothek.
Hier wird nun in Projekt 1 R von android.support.v7.appcomapt nicht mehr gefunden mit der Meldung cannot resolve R.
Als Lösung schlägt Android Studio vor R zu importieren, tu ich dies versucht er die id aus dem R von Projekt 1 zu laden was natürlich nicht funktioniert.

Gibt es hierfür eine Lösung? Wäre eine große Erleichterung.

Viele Grüße

Antworten
Pascal P.
  • Admin
  • Forum-Beiträge: 11.286

12.09.2014, 11:28:42 via Website

When you build an application that depends on a library project, the SDK tools compile the library into a temporary JAR file and uses it in the main project, then uses the result to generate the .apk. In cases where a resource ID is defined in both the application and the library, the tools ensure that the resource declared in the application gets priority and that the resource in the library project is not compiled into the application .apk. This gives your application the flexibility to either use or redefine any resource behaviors or values that are defined in any library.

Hoffe das hilft.

LG Pascal //It's not a bug, it's a feature. :) ;)

Antworten