Ubuntu 64位下搭建ADT的种种问题

我使用的adt版本为 adt-bundle-linux-x86_64-20140702.zip

 

1. Eclipse启动时提示 adb 无法加载动态链接库 libstdc++.so.6 以及  libz.so.1

安装以下两个32位软件包即可: lib32stdc++6    lib32z1

 

2. Eclipse频繁崩溃

    修改eclipse所在目录下的eclipse.ini, 加入一行:

    -Dorg.eclipse.swt.browser.DefaultType=mozilla

3. adb无法找到接入的手机

   =====================以下引用自 http://www.cnblogs.com/sink_cup/archive/2011/10/31/ubuntu_x64_android_sdk_java.html 

lsusb

拔下手机再运行lsusb,少了一行,那个就是设备。

比如Bus 002 Device 003: ID 0bb4:0ccf High Tech Computer Corp.  表示HTC的厂商ID为0bb4

小米1S的 Bus 002 Device 007: ID 18d1:9025 Google Inc.,表示小米的厂商ID为18d1

锤子手机Smartisan T1是Bus 003 Device 019: ID 29a9:7019,表示锤子的厂商ID为29a9

按照厂商ID填写,比如锤子T1就写:

echo ‘0x29a9‘ | tee -a ~/.android/adb_usb.ini
echo ‘SUBSYSTEM=="usb", ATTR{idVendor}=="29a9", MODE="0666", GROUP="plugdev"‘ | sudo tee -a /etc/udev/rules.d/51-android.rules
sudo chmod a+r /etc/udev/rules.d/51-android.rules
sudo service udev restart
adb kill-server
adb start-server

把设备的“USB调试”关掉,拔下来,重新连上电脑,再打开“USB调试”。

adb devices

如果显示正常,即可。

========================引用结束

为了方便找出 vendorId/productId,我写了一段perl脚本来做这件事。 提示输入用户名之后,它会等待10秒钟时间,在此期间,如果你的手机原来是插入状态,那就拔出,如果没插入,那就插入。10秒钟过后,它就会帮你找出两个id,并告诉你应该如何修改文件

#!/usr/bin/perl

# This script is to enable adb debug on android devices

$hint = <<END;
	This script will help you find our the vendor id / product id
END

print "Enter your user name:";
$username = <STDIN>;

# Find out product id/vendor id
@aA = &getCmdOutput("lsusb");
print "\nIf your android was plugged in, unplug it now. If it‘s not, plug in it now. I‘ll wait for 10 seconds ...\n";
sleep 10;
@aB = &getCmdOutput("lsusb");

if( $#aA == $#aB || abs( $#aA- $#aB ) != 1 )
{
	die "You didn‘t make the plug/unplug work as I said. quit\n";
}

@smaller = ( $#aA> $#aB )? @aB: @aA;
@bigger = ( $#aA> $#aB )? @aA: @aB;

%map;
foreach $item( @smaller )
{
	$map{ $item } = 1;
}

$deviceInfo = "";
foreach $item( @bigger )
{
	if( not exists $map{ $item } )
	{
		$deviceInfo = $item;
		last;
	}
}

die "Failed to resolve device info\n" unless $deviceInfo ne "";

$deviceInfo =~ /(.*):(.*)/;
$vendorId  = $1;
$productId = $2;

$ruleFile =  ‘/etc/udev/rules.d/51-android.rules‘;
$adbFile = ‘/home/‘.$username.‘/.android/adb_usb.ini‘;

$content = <<END;
SUBSYSTEM=="usb", ATTR{idVendor}=="$vendorId",ATTR{idProduct}=="$productId",OWNER="$username", MODE="0666",GROUP="plugdev"
END

print "What you should add to $ruleFile :\n $content";

print "Please add this line to your /home/".$username.‘/android/adb_usb.ini‘." :\n";
print "$vendorId\n";
exit 0;


sub getCmdOutput
{
	my $command = $_[0];
	
	my @output;
	unless ( open CMD_PIPE, "-|" )
    {
        exec "$command";
        exit;
    }

    while ( <CMD_PIPE> )
    {
        chomp;
        if( /ID\s([a-f0-9]+):([a-f0-9]+)\s/ )
        {
			push @output, "$1:$2";
		}
    }
    @output;
 }

  

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。