Search code examples
androidadtandroid-5.0-lollipopandroid-tv

Can't debug directly on ADT-1 Developer Kit


I"m working on an application for Android TV by ADT-1 Developer Kit. I can install the application from Eclipse. But I can't debug step by step directly. I run Debug but It doesn't go to any breakpoint. Even though I enabled USB Debugging.
A more weird thing is when I install application on ADT-1 Developer Kit, It doesn't start application automatically, although the application logo appears on TV UI.
This is the following Manifiest file:

<uses-sdk
        android:minSdkVersion="21"
        android:targetSdkVersion="21" />
<uses-feature
        android:name="android.hardware.touchscreen"
        android:required="false" />
    <uses-feature
        android:name="android.software.leanback"
        android:required="false" />

.....
<activity android:name="vng.zing.tv.activity.LoginActivity" >
    <intent-filter>
        android:name="android.intent.action.MAIN" />

        android:name="android.intent.category.LEANBACK_LAUNCHER" />
   </intent-filter>
</activity>

And It shows the log like below

Android Launch!
adb is running normally.
No Launcher activity found!
The launch will only sync the application package on the device!
Performing sync
Automatic Target Mode: Several compatible targets. Please select a target device.
Uploading Example.apk onto device 'ZW2Z142308EE'
Installing Example.apk...
Success!
\Example\bin\Example.apk installed on device

It doesn't find the Activity to start.

What should I do to solve the problem? Thanks


Solution

  • While I don't know the reasons behind this, restarting the ADB and/or restarting the IDE usually does the trick.

    If you're adb connect-ing to ADT-1, then do

    adb disconnect adt_addr:4321
    adb connect adt_addr:4321
    

    where adt_addr is obviously the IP address of your ADT-1.

    If none of the above is working, then it's probably something wrong with the workspace. Try the following:

    1. Uninstall the application
    2. Clean the workspace and rebuild the project
    3. Install the application again

    I also discovered a bug on ADB + Studio with Android TV: if you clear the logs via the Trash button, then the adb logcat breaks and you won't see any log. Performing a disconnect-reconnect brings back things to normal.