Android device showing offline with USB debugging

When I tried to run Android application in my mobile from Android Studio, I stuck with the error stating the application my Device was Offline.

When I run the command adb devices the error as follows

List of devices attached
00b445g34****** offline

To Enable the USB debugging option in Android device

1. Go to Settings, and select Applications > Development
2. Enable USB debugging
3. For Devices with Android KitKat and go to Settings > About devices > Tap 7 times on “Build Number”
4. Once Developer Option is enabled in the Settings, Enable USB debugging
5. Update the Android SDK Tools in Android SDK Manager
6. Traverse to \android-sdk\platform-tools and run adb devices
7. If still the problem exists restart the ADB server

adb kill-server
set ADB_TRACE=all
adb nodaemon server
adb devices

8. The ADB_TRACE will help you trace and resolving the issues like permission and others.
9. If still the problem exists kill the adb process killall adb in linuxoids and taskkill /IM adb.exe
10. Disconnect your mobile, Developer option > Revoke USB debugging authorizations (KitKat and above)
11. Restart your mobile and connect to PC. You will be asked to verify the RSA, do the same and add the device
12. Now try running adb devices, boom the device is online

List of devices attached
00b445g34****** device

The same scenario happened when I tried to run debug my AIR application in Flash developer, follow all the steps above in addition the next few steps too.

1. Copy the following files from \android-sdk\platform-tools aapt.exe, adb.exe, AdbWinApi.dll, AdbWinUsbApi.dll, dx.jar (dx.jar from lib folder)
2. Paste them into \lib\android\bin
3. Run the command adb version from the same folder in command prompt
4. Result should be as follows
Android Debug Bridge version 1.0.31
5. Version should be greater or equal to 1.0.31

Printing Complex Layouts in Adobe Flex – FlexPrintJob

I have come across a basic need for printing a complex layout in the Adobe Flex. After a long search i thought the following will be helpful to all if shared.

Requirements:

1. My layout has the following. Header (Fixed, to be shown in all page.), First Page Header (Displayed only in single page), DataGrid with data rolling out to more than one page, Fixed footer following the DataGrid and a Footer that come only in last page of the Printed output.
2. I am given only the outer most component object and list of all ids of the following components.
3. No server side support is available.

Problems:

1. My DataGrid is not accessible directly.
2. Complex layout and needed Paginationrn3. Fixed, floating header and footers.

Solution:

With reference to the Adobe Live docs, the solutions is almost near except to the complex structure.
rnI have created a Template that holds all the data to be iterated in the report. I contains the sections like Fixed Header, Floating Header, DataGrid, Fixed Footer, Floating Footer as follows.

1. PrintTemplate.mxml

<s:VGroup id="allPageHeader" width="100%" />
< s:VGroup id="firstPageHeader" width="100%" />
< mx:PrintDataGrid id="printDataGrid" width="100%" />
< s:VGroup id="allPageFooter" width="100%" />
< s:VGroup id="lastPagefooter" width="100%" />

2. PrintSample.mxml

protected function doPrint(outerGroup:DisplayObjectContainer, fixedHeaderIDs:ArrayCollection, floatHeaderIDs:ArrayCollection, dataGridId:String, floatFooterIDs:ArrayCollection , fixedFooterIDs:ArrayCollection):void{...}

Here we have to pass the list of IDs of the sections as we need to the doPrint method as follows.

doPrint(outerGroup, fixedHeaderIDs, floatHeaderIDs, dataGridId, fixedFooterIDs, floatFooterIDs);Completing the rendering the print object will be sent to printer and a popup will be shown.

Source Code: Printing in Adobe Flex

Update:

In the above example, if the Printout is taken with the printAsBitmap set to false, then there will be thick line under the header of the DataGrid ie, the PrintDataGrid. To solve this problem you have to use a Header Renderer and set a background color or Image for the header as follows.

<?xml version="1.0" encoding="utf-8"?>
< s:SparkSkin xmlns:fx="http:/s.adobe.com/mxml/2009" xmlns:s="library:/s.adobe.com/flex/spark" xmlns:mx="library:/s.adobe.com/flex/mx" > < s:Rect left="0" right="0" top="0"> < s:fill> < s:BitmapFill source="@Embed(''header.png'')"/> 
< /s:fill> < s:stroke> < s:SolidColorStroke color="grey" /> 
< /s:stroke> < /s:Rect>< /s:SparkSkin>

Save the file as SampleSkin and add this skin to the headerBackroundSkin property of PrintDataGrid in the PrintTemplate as follows.

<mx:PrintDataGrid id="printDataGrid" width="100%" headerBackgroundSkin="SampleSkin" />

This will resolve the issue and set a neat header to the DataGrid in the print.