Skip to content

Commit 88f76e3

Browse files
pekingmehunterstich
authored andcommitted
[Docs] Updated getting started page for new change in R files starting in 1.14.0.
Resolves #4817 PiperOrigin-RevId: 772935924
1 parent 827e440 commit 88f76e3

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

docs/getting-started.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ to find the latest version of the library.
5555
**Note:** In order to use the new `Material3` themes and component styles, you
5656
should depend on version `1.5.0` or later.
5757
58+
**Note:** In order to use the new `Material3Expressive` themes and component
59+
styles, you should depend on version `1.14.0` or later.
60+
5861
### New Namespace and AndroidX
5962
6063
If your app currently depends on the original Design Support Library, you can
@@ -71,6 +74,28 @@ the `com.android.support:design:28.0.0` dependency.
7174
**Note:** You should not use the `com.android.support` and
7275
`com.google.android.material` dependencies in your app at the same time.
7376
77+
### Non-Transitive R Classes (referencing library resources programmatically)
78+
79+
Starting with version `1.13.0-alpha12`, the Material library is built with AGP
80+
8.7.3 (or later) and `android.nonTransitiveRClass=true`, meaning
81+
[R classes are no longer transitive](https://developer.android.com/build/optimize-your-build#use-non-transitive-r-classes)
82+
and resources must be fully qualified with their library path when used
83+
programmatically.
84+
85+
For example, since `colorPrimary` is defined in the AppCompat library, you must
86+
refer to it as `androidx.appcompat.R.attr.colorPrimary` as opposed to
87+
`com.google.android.material.R.attr.colorPrimary` or `R.attr.colorPrimary`.
88+
89+
For a Material defined resource like `colorOnPrimary`, you must refer to it as
90+
`com.google.android.material.R.attr.colorOnPrimary`.
91+
92+
To opt out of this new behavior, set `android.nonTransitiveRClass=false` in your
93+
`gradle.properties` file. Then you can access any resource without a fully
94+
qualified path (i.e., simply `R.<resource-type>.<resource-name>`).
95+
96+
**Note:** This is relevant for all types of library resources, not just
97+
attribute references.
98+
7499
## 3. Android SDK compilation
75100
76101
In order to use the latest versions of Material Components for Android and the

0 commit comments

Comments
 (0)