1*1b3f573fSAndroid Build Coastguard Worker# Ahead Of Time (AOT) compilation for the Java Virtual Machine (JVM)" 2*1b3f573fSAndroid Build Coastguard Worker 3*1b3f573fSAndroid Build Coastguard WorkerAhead Of Time (AOT) compilation build tools such as those provided by [GraalVM's `native-image`](https://www.graalvm.org/reference-manual/native-image/) can require some configuration when using protobuf. 4*1b3f573fSAndroid Build Coastguard WorkerProtobuf for the JVM uses reflection and some of its target classes are not possible to determine in advance. 5*1b3f573fSAndroid Build Coastguard WorkerHistorically, there were good reasons to use reflection based on APIs that were published effectively requiring them, and this situation is unlikely to change. 6*1b3f573fSAndroid Build Coastguard Worker 7*1b3f573fSAndroid Build Coastguard Worker[The Lite version of protobuf for the JVM](https://github.com/protocolbuffers/protobuf/blob/main/java/lite.md) 8*1b3f573fSAndroid Build Coastguard Workeravoids reflection and may be better suited for use with AOT compilation tooling. This Lite version was originally targeted for use on Android which has similar AOT compilation 9*1b3f573fSAndroid Build Coastguard Workergoals as GraalVM's native-image tool. 10*1b3f573fSAndroid Build Coastguard Worker 11*1b3f573fSAndroid Build Coastguard Worker## GraalVM native-image 12*1b3f573fSAndroid Build Coastguard Worker 13*1b3f573fSAndroid Build Coastguard WorkerThis section addresses GraalVM's `native-image` configuration specifically as this AOT compilation tool due to its popularity. The `native-image` tool can be configured 14*1b3f573fSAndroid Build Coastguard Workerwith respect to: the [Java Native Interface](https://en.wikipedia.org/wiki/Java_Native_Interface) (JNI), http proxying, reflection, and other resources. While these 15*1b3f573fSAndroid Build Coastguard Workerconsiderations can be manually declared as JSON files, we recommend that a JVM application is exercised along with 16*1b3f573fSAndroid Build Coastguard Worker[the assisted configuration agent](https://www.graalvm.org/reference-manual/native-image/BuildConfiguration/#assisted-configuration-of-native-image-builds). The agent 17*1b3f573fSAndroid Build Coastguard Workerwill generate files that you can then subsequently point at when invoking `native-image`. We recommend that the generated files are retained with a project's source 18*1b3f573fSAndroid Build Coastguard Workercode. 19