Home > Mobile >  Android run Java main function to generate dex file
Android run Java main function to generate dex file

Time:03-07

To realize a small program: through the Android run Java code (including a main function) to generate a classes. Dex file, and then through the

The adb shell app_process -- Djava. Class. Path=/data/local/TMP/classes. Dex/data/local/TMP com. Example. XXXX. Main operating

Similar to the open source scrcpy server implementation,

This program can be enumerated the current mobile phone installed app information so, like this:

PackageManager PackageManager=getPackageManager ();
List InfoList=packageManager. GetInstalledPackages (0);

But in the main function can't get a context object, saw scrcpy server USES reflection mechanism, but how to obtain the PackageManager object??
  • Related