Repository navigation
Rush 2.1.0
Rush 2.1 makes every library private: renamed into the extension, Android libraries included, and shrunk with it. Extensions no longer clash with each other, with App Inventor's own libraries, or with Kodular's.
Highlights
- Private libraries by default. Every library the extension ships is renamed under
<package>.repacked: its code, and an AAR's resources, manifest, R classes and file name. Two extensions can ship different versions of the same library, and Media3 now works next to Texting (both bundle Guava) and on Kodular (which bundles RecyclerView). sharedis the opt-in for libraries whose objects pass between extensions. What a shared library uses is shared too.- Libraries with native code stay private. Native code finds a few classes by their original names, so only their packages keep them, listed under
original_namesinrush.yml. Rush reads the library's.sofiles and prints the lines to add. Firebase now ships with Kotlin private and works on Kodular, which bundles its own Kotlin; its AIX dropped from 7.8 MB to 2.0 MB. - Kotlin Multiplatform libraries build (#86): AARs without code ship without
classes.jar, and their-jvmand-androidartifacts count as the libraries App Inventor provides. When a library arrives in both its JVM and Android forms (Firebase's datastore), exclude one inrush.yml; resolving them as Gradle does is #87. - Extensions built for different
min_sdkwork in one app. D8 gives some desugared interfaces a field Android 7+ rejects, which crashed apps mixing an extension built for 23 (Media3) with one built for 24 (Firebase). Rush corrects that field until D8 is fixed. - Smaller extensions. R8 shrinks the extension and all its private libraries as one program, so code nothing uses is gone. Media3's AIX: 10.2 MB → 6.6 MB, or 5.0 MB with
--optimize. - Intent actions keep their value, so other apps and the system still reach the extension's services (Media3's
MediaSessionService). Names App Inventor's AndroidX also defines (AppCompat'sicon) stay one resource, as in any Android app. - Extension resources can use their libraries' resources (#85): a layout can show Media3's
@drawable/exo_icon_playor itsDefaultTimeBar, a style can extend a library's style orTheme.AppCompat, and Rush renames those references with private libraries. - Optimized builds resolve
ServiceLoaderlookups of private libraries, which App Inventor's apps can't do at runtime. - Android's default ProGuard rules apply to every R8 run: a Parcelable's
CREATORno longer disappears in optimized builds. - Clearer missing-class errors: when a library needs a newer version of one App Inventor provides, Rush names it and the rule to add. Code using the R classes App Inventor generates (
androidx.appcompat.R) builds.
Upgrading
rush upgradeFixed in 2.1.1: after upgrading from 2.0,
rushfailed withCould not find Rush data directory. Install 2.1.1 instead; its notes say how to upgrade a broken install.
Workflows that use shreyashsaitwal/rush-cli@v2 build with 2.1 from now on. Most projects build unchanged. Some need one change, and the build error says which:
-
An AAR with native code (WebRTC, Firebase's datastore, ML Kit) needs the packages its native code names listed. The error prints the lines to add to
rush.yml, or thesharedalternative:original_names: - org.jni_zero - org.webrtc - org.webrtc.audio
-
An AAR with assets or JARs in
libs/can't be renamed. The error names thesharedline to add. -
-repackageclassesinsrc/proguard-rules.pro: Rush applies it itself in optimized builds.rush migrateremoves it. -
Recent AndroidX libraries use annotations missing from App Inventor's AndroidX (
Missing class androidx.annotation.DoNotInline). They're only needed to compile. Add this line tosrc/proguard-rules.pro(new projects have it):-dontwarn androidx.annotation.** -
Libraries whose objects pass between extensions need
sharedin each extension. -
Extension resources can't use names starting with
<package>_repacked_, which Rush gives private libraries' resources.
The first rush deps sync (or build) after upgrading downloads the resources of App Inventor's AndroidX once, from the project's repositories; builds then run offline.
The first time an extension is rebuilt with private libraries, the classes and resources of its libraries change names. An app updated to that version can lose what it stored under the old names: jobs scheduled with a library's component, widgets, or data serialized with class names. Note it in the extension's release notes if it applies.
See Dependencies for how libraries are shipped.
Also
- Firebase and ML Kit find their components when private: class names in every manifest attribute are renamed with their library, prefixed meta-data names (
com.google.firebase.components:<registrar>) included. - Class names in private libraries' resources (Material's bottom-sheet behavior, fragments, menus) are renamed with them.
- Optimized builds no longer leave classes R8 renamed in place outside the extension's package.
- Private AARs without resources join the extension's code; AARs left without code ship without
classes.jar. - Raw resources ship byte for byte, and resource XML Rush can't read fails with the file's name.
- Downloads land in the local Maven repository atomically, so an interrupted one can't leave a broken file.
- Projects resolve their dependencies again once after upgrading Rush.
- A relocated library is no longer dropped from its users' dependencies.
- The missing-class help names the exact classes and the rules to add.
Known limitation: when two extensions in one app ship androidx.startup, only one extension's initializers run (#88); this predates 2.1.