how to let 'framework.jar' compile in front of 'android.jar' on Android Studio Arctic Fox

1.8k Views Asked by At

First, how to let the framework.jar compile in front of android.jar on Android-Studio-Arctic-Fox with gradle 7.0.2 and AGP-7.0.2 Second is let Editor first to import from the framework.jar to fix it not display RED(cannot find some method or field or class)

1

There are 1 best solutions below

2
On BEST ANSWER

It is currently not possible to override android.jar with classes from a custom jar - https://issuetracker.google.com/167750503. However, you could replace android.jar in the Android SDK with your own, and Android Studio and Android Gradle plugin will pick them up.

Alternatively, you can develop Sdk Add-on, and point your users to it. It will be automatically handled by Android Studio. Here is an example of how to build one.