The sdk part referenced by the app runtime is provided by the sdk downloaded locally at compile time, or is it provided by the sdk in the runtime phone?

  android, question

For example, the Activity is referenced in the code. When I package and generate apk, this Activity is compiled by downloading the java file from my local sdk inside to apk inside, or will it be found from the sdk provided by the mobile phone, that is, the Framework layer, for app to use when apk is running?

I prefer the latter, but I don’t know what strong evidence to prove, ask for advice!

SDK is a class library file for your development. After APK is compiled and generated, it will run on the mobile phone in a virtual machine environment that depends on the mobile phone.
This process is the same as using JDK to develop applications, and then the compiler compiles your source files into class files, which are then processed by the java virtual machine ~ ~ ~

Library files provided by the system operating environment will not be packaged into APK