@@ -44,11 +44,26 @@ class Devices {
4444 private static final String ADB_DEVICES_ERROR =
4545 "Received unfamiliar output from “adb devices”.\n " +
4646 "The device list may have errors." ;
47+
48+ private static final String DEVICE_PERMISSIONS_URL =
49+ "https://developer.android.com/studio/run/device.html" ;
50+
51+ private static final String DEVICE_PERMISSIONS_TITLE =
52+ "Found devices with no permissions!" ;
53+
54+ private static final String DEVICE_PERMISSIONS_MESSAGE =
55+ "Make sure that the device has USB debugging enabled, and that the required " +
56+ "USB drivers are installed on Windows, and that permissions are properly configured on Linux. " +
57+ "Also, on Linux, don't set the USB configuration to \" charging\" while debugging.<br><br>" +
58+ "Read this guide on <a href=\" " + DEVICE_PERMISSIONS_URL + "\" >runnings apps on hardware device</a> " +
59+ "for more details." ;
4760
4861 private static final Devices INSTANCE = new Devices ();
4962
5063 private static final String BT_DEBUG_PORT = "4444" ;
5164
65+ private boolean showPermissionsErrorMessage = true ;
66+
5267 private AndroidSDK sdk ;
5368
5469 private Device selectedDevice ;
@@ -364,6 +379,9 @@ public List<String> list() {
364379 final String [] fields = line .split ("\t " );
365380 if (fields [1 ].equals ("device" )) {
366381 devices .add (fields [0 ]);
382+ } else if (fields [1 ].contains ("no permissions" ) && showPermissionsErrorMessage ) {
383+ AndroidUtil .showMessage (DEVICE_PERMISSIONS_TITLE , DEVICE_PERMISSIONS_MESSAGE );
384+ showPermissionsErrorMessage = false ;
367385 }
368386 }
369387 }
0 commit comments