Update to the latest version of AndroidStudio (>3.2) DDMS [Android Device Monitor] can not be found. DDMS [Android Device Monitor] can only be found in SDK directory. So I wrote a plug-in to quickly launch the Android Device Monitor

Source code and use

Development tool: IntelliJ IDEA

Github address: https://github.com/hi-dhl/DeviceMonitorPlugin

The plug-in download address: https://github.com/hi-dhl/DeviceMonitorPlugin/releases/download/1.0/DeviceMonitorPlugin.jar

Installation method:

  • Open the AndroidStudio
  • Select Preference -> Plugins-> Install plugin from disk
  • Select the downloaded plugin [DevicemonitorPlugin.jar] -> restart AndroidStudio

How to start:

  • Open the AndroidStudio
  • Menu bar Tools -> Click DeviceMonitor

PS: Although Google has deleted the AdnroidStudio startup entry, the local SDK still exists. The plug-in dynamically obtains the local SDK path to start AndroidDeviceMonitor. Due to different computer performance, the startup speed will be different

Why did Google drop Android Device Monitor

Android Developers official website of the original link

Android Device Monitor is an Android application debugging and analysis tool that provides a UI tool, but most components have been deprecated in Android Studio 3.1 and will be removed in Android Studio 3.2. New tools to help developers debug and analyze Android apps are available here

Plug-in core code

public class Monitor extends AnAction {

    @Override
    public void actionPerformed(AnActionEvent anActionEvent) {

        try {

            Project project = anActionEvent.getData(PlatformDataKeys.PROJECT);

            String os = AndroidUtils.getPlatformName();
            String sdkPath = AndroidUtils.getApkLocalProperties(project);
            if (os.toLowerCase().startsWith("win")) {
                sdkPath += File.separator + "tools" + File.separator + "monitor.bat";
            } else {
                sdkPath += File.separator + "tools" + File.separator + "monitor";
            }

            Runtime.getRuntime().exec(sdkPath);
        } catch (Exception e) {

        }

    }
}
Copy the code
/** * Dynamically obtain the path of the local Android SDK ** @param project * @return
 */
public static String getApkLocalProperties(Project project) {

    String sdkPath = "";

    try {

        String path = project.getBasePath() + File.separator + "local.properties";

        Properties properties = new Properties();
        InputStream inputStream = new FileInputStream(path);
        properties.load(inputStream);

        sdkPath = properties.getProperty("sdk.dir");
    } catch (Exception e) {

    }
    return sdkPath;
}
Copy the code

Github address: https://github.com/hi-dhl/DeviceMonitorPlugin

conclusion

Dedicated to sharing a series of Android system source code, reverse analysis, algorithm, translation, Jetpack source code related articles, if you like this article welcome Star to study together, looking forward to growing with you

The article lists

Android 10 source code series

  • How is APK generated
  • APK installation process
  • 0xA03 Android 10 source code analysis: APK loading process of resource loading
  • Android 10 source code: APK
  • Dialog loading and drawing process and use in Kotlin, DataBinding
  • WindowManager View binding and architecture

Android Apps

  • How to get video screenshots efficiently
  • How to package Kotlin + Android Databinding in your project
  • [Google engineers] just released a new Fragment feature, “New ways to transfer Data between Fragments” and source code analysis
  • [2.4K Start] Drop Dagger to Koin
  • [5K +] Kotlin’s performance optimization stuff
  • How does FragmentFactory elegantly use Koin and source code analysis
  • Decrypt RxJava’s exception handling mechanism

Tool series

  • Shortcuts to AndroidStudio that few people know
  • Shortcuts to AndroidStudio that few people know
  • All you need to know about ADB commands
  • 10 minutes introduction to Shell scripting

The reverse series

  • Dynamically debug APP based on Smali file Android Studio
  • The Android Device Monitor tool cannot be found in Android Studio 3.2