Android Studio on Windows - Following successful Gradle sync and build, I am unable to launch my application on my (rooted) Android Galaxy S3 and debug via USB. I have USB Debugging enabled on my device.
I am able to:
see my USB device in the Android DDMS window:
manually provision via adb, then connect via the debugger, using the same commands that come out of the debug window in Android Studio:
Cd "C:\Program Files (x86)\Android\android-studio\sdk\platform-tools"
adb -d shell
su
pm uninstall com.company.myapplication
ls -all /data/app | grep myapplication
pm install -r "/data/local/tmp/com.company.myapplication"
am start -n "com.company.myapplication/com.company.myapplication.MapsActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Following manual provisioning (see above), I can attach to the running process on my device, and debug (including hitting breakpoints):
Select my device from the "Choose Device" window when attempting to initiate USB debugging:
... following which I get the following output (and no activity on the Android device UI):
Waiting for device.
Target device: samsung-sgh_t999-6XXXXXX2
Uploading file
local path: D:\Data\XXXXXX\Sandpit\XXXXXX\MyApplication\app\build\outputs\apk\app-debug.apk
remote path: /data/local/tmp/com.company.myapplication
Installing com.company.myapplication
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/com.company.myapplication"`
Launching application: com.company.myapplication/com.company.myapplication.MapsActivity.
DEVICE SHELL COMMAND: am start -D -n "com.company.myapplication/com.company.myapplication.MapsActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Waiting for process: com.company.myapplication
In the case above, after checking files using the adb shell, I have noticed that the pm install
command works -- i.e. there's an updated file (based on timestamp) in location /data/local/tmp/com.company.myapplication
. However, the am start
doesn't work, as the .apk file under
I have tried:-
Media device (MTP)
, and also as Camera (PTP)
Settings -> Developer options -> Allow mock locations
)Adding android:debuggable="true"
to the Android Manifest XML (<appRoot>\MyApplication\app\src\main\AndroidManifest.xml
), despite IDE suggestion to the contrary:
Ensuring ADB Integration is enabled:
Toggling the ADB connection on the phone (Settings -> Developer Options -> USB Debugging check/uncheck/recheck, reconnect
)
C:\Program Files (x86)\Android\android-studio\sdk\platform-tools>adb wait-for-device
C:\Program Files (x86)\Android\android-studio\sdk\platform-tools>adb devices
List of devices attached
6XXXXXX2 device
C:\Program Files (x86)\Android\android-studio\sdk\platform-tools>adb root
C:\Program Files (x86)\Android\android-studio\sdk\platform-tools>adb kill-server
C:\Program Files (x86)\Android\android-studio\sdk\platform-tools>adb start-server
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
C:\Program Files (x86)\Android\android-studio\sdk\platform-tools>adb wait-for-device
C:\Program Files (x86)\Android\android-studio\sdk\platform-tools>adb devices
List of devices attached
6XXXXXX2 device
C:\Program Files (x86)\Android\android-studio\sdk\platform-tools>
Versions:-
OS is Windows 7 Enterprise SP1
What have I omitted? What else should I try?
Just to provide closure... I ended up dropping this device, and it wasn't worth repairing the screen, so this device no longer exists. My new device - also an S3 - works after being rooted.