@@ -44,11 +44,26 @@ class Devices {
44
44
private static final String ADB_DEVICES_ERROR =
45
45
"Received unfamiliar output from “adb devices”.\n " +
46
46
"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." ;
47
60
48
61
private static final Devices INSTANCE = new Devices ();
49
62
50
63
private static final String BT_DEBUG_PORT = "4444" ;
51
64
65
+ private boolean showPermissionsErrorMessage = true ;
66
+
52
67
private AndroidSDK sdk ;
53
68
54
69
private Device selectedDevice ;
@@ -364,6 +379,9 @@ public List<String> list() {
364
379
final String [] fields = line .split ("\t " );
365
380
if (fields [1 ].equals ("device" )) {
366
381
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 ;
367
385
}
368
386
}
369
387
}
0 commit comments