I am trying to run flashtool (flashing utility for android phones) in ubuntu. Already setup java and appropriate environment
On execution the following error comes up
rajeswar@WebE-PCl:~$ FlashTool/FlashTool
Not running as root but Sony/SonyEriccson Vendor ID found on your udev rules
if Flashing didn't work well, run flashtool as root
libusb.LibUsbException: Libusb not found. Minimum libusb version is 1.0.15. It can be downloaded on http://www.libusbx.org
at libusb.UsbSystem.initSystem(UsbSystem.java:28)
at libusb.UsbSystem.<init>(UsbSystem.java:15)
at linuxlib.JUsb.init(JUsb.java:21)
at gui.Main.initLinuxUsb(Main.java:47)
at gui.Main.main(Main.java:34)
So I downloaded the latest version from http://libusbx.org/, after extraction executed
./configure && sudo make && sudo make install && sudo ldconfig
.
It executed successfully & installed to /usr/local/lib/
.. But the error keeps coming..
This is output of sudo ldconfig -vp | grep usb
libusbmuxd.so.2 (libc6,x86-64) => /usr/lib/libusbmuxd.so.2
libusb-1.0.so.0 (libc6,x86-64) => /usr/local/lib/libusb-1.0.so.0
libusb-1.0.so.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libusb-1.0.so.0
libusb-1.0.so (libc6,x86-64) => /usr/local/lib/libusb-1.0.so
libusb-0.1.so.4 (libc6,x86-64) => /lib/x86_64-linux-gnu/libusb-0.1.so.4
libusb-0.1.so.4 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libusb-0.1.so.4
libgusb.so.2 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libgusb.so.2
Any idea how to fix it?
Below is content of flashtool launcher script
#!/bin/sh
export BASEDIR=$(dirname $0)
export system64=$(uname -m)
export OS=$(uname -s)
cd $BASEDIR
if test "$OS" = "Linux"
then
chmod 755 ./x10flasher_lib/adb.linux
chmod 755 ./x10flasher_lib/fastboot.linux
chmod 755 ./x10flasher_lib/unyaffs.linux
chmod 755 ./x10flasher_lib/bin2elf
chmod 755 ./x10flasher_lib/bin2sin
if [ "$(whoami)" != "root" ]
then
export HASRULES="false"
if test -d /etc/udev/rules.d
then
if grep -rl "0fce" /etc/udev/rules.d >/dev/null
then
export HASRULES="true"
fi
fi
if test "$HASRULES" = "true"
then
echo "Not running as root but Sony/SonyEriccson Vendor ID found on your udev rules"
echo "if Flashing didn't work well, run flashtool as root"
else
echo "Not running as root and there is no Sony/SonyEriccson Vendor ID on your udev rules"
echo "The user must be granted access to adb/flashmode/fastboot"
echo "If you are unsure what to do, run flashtool as root"
exit 1
fi
else
echo "Running as root."
fi
if test -z "${JAVA_HOME}"
then
if test "${system64}" = "x86_64"
then
export JAVA_HOME=./x10flasher_lib/linjre64
else
export JAVA_HOME=./x10flasher_lib/linjre32
fi
echo "JAVA_HOME not set. Using default value : ${JAVA_HOME}"
fi
if test -e ${JAVA_HOME}/bin/java
then
export LD_LIBRARY_PATH=./x10flasher_lib/linux/lib32
export LD_LIBRARY_PATH=./x10flasher_lib/linux/lib64:$LD_LIBRARY_PATH
ln -sf libusbx-1.0.so.0.1.0 ./x10flasher_lib/linux/lib32/libusbx-1.0.so
ln -sf libusbx-1.0.so.0.1.0 ./x10flasher_lib/linux/lib64/libusbx-1.0.so
ISJAVA6=$($JAVA_HOME/bin/java -version 2>&1|grep version|grep 1.6|wc -l)
ISJAVA7=$($JAVA_HOME/bin/java -version 2>&1|grep version|grep 1.7|wc -l)
ISJAVA64=$($JAVA_HOME/bin/java -version 2>&1|grep 64-Bit|wc -l)
if test $ISJAVA6 -gt 0 -o $ISJAVA7 -gt 0
then
if test $ISJAVA64 -gt 0
then
ln -sf swt64.jar ./x10flasher_lib/swtlin/swt.jar
else
ln -sf swt32.jar ./x10flasher_lib/swtlin/swt.jar
fi
$JAVA_HOME/bin/java -Xms128m -Xmx512m -Duser.country=US -Duser.language=en -jar x10flasher.jar
else
echo "Java version must be 1.6 or 1.7"
fi
else
echo "No Java in specified path in JAVA_HOME=${JAVA_HOME}"
echo "Set the variable to a valid Java installation"
fi
else
chmod 755 ./x10flasher_lib/adb.mac
chmod 755 ./x10flasher_lib/fastboot.mac
chmod 755 ./x10flasher_lib/unyaffs.mac
export DYLD_LIBRARY_PATH=./x10flasher_lib/mac/lib64:$DYLD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=./x10flasher_lib/mac/lib32:$DYLD_LIBRARY_PATH
ln -sf libusbx-1.0.0.dylib ./x10flasher_lib/mac/lib64/libusbx-1.0.dylib
ln -sf libusbx-1.0.0.dylib ./x10flasher_lib/mac/lib32/libusbx-1.0.dylib
ISJAVA6=$(java -version 2>&1|grep version|grep 1.6|wc -l)
ISJAVA7=$(java -version 2>&1|grep version|grep 1.7|wc -l)
ISJAVA64=$(java -version 2>&1|grep 64-Bit|wc -l)
if test $ISJAVA64 -gt 0
then
ln -sf swt64.jar ./x10flasher_lib/swtmac/swt.jar
else
ln -sf swt32.jar ./x10flasher_lib/swtmac/swt.jar
fi
if test $ISJAVA6 -gt 0 -o $ISJAVA7 -gt 0
then
java -XstartOnFirstThread -Xms128m -Xmx512m -Duser.country=US -Duser.language=en -jar x10flasher.jar
else
echo "Java version must be 1.6 or 1.7"
fi
fi
I think the problem lies in these lines
export LD_LIBRARY_PATH=./x10flasher_lib/linux/lib32
export LD_LIBRARY_PATH=./x10flasher_lib/linux/lib64:$LD_LIBRARY_PATH
ln -sf libusbx-1.0.so.0.1.0 ./x10flasher_lib/linux/lib32/libusbx-1.0.so
ln -sf libusbx-1.0.so.0.1.0 ./x10flasher_lib/linux/lib64/libusbx-1.0.so
Just found the solution. Adding it for any future reference
Copy
/usr/local/lib/libusb-1.0.so.0.1.0
toFlashTool/x10flasher_lib/linux/lib64
andFlashTool/x10flasher_lib/linux/lib32
.Search the following lines in Flashtool script
Change them to
Now run the flashtool, you will be good to go.
Note:
Who are getting
JAVA_HOME NOT SET
error before it, do the followingThis will set variable for all user
sudo gedit /etc/profile.d/java.sh
paste if you installed oracle jdk, change accordingly if you are using open jdk
Then in terminal run:
Source
If you get
cannot open shared library libncurses.so.5
after flashtool GUI comes up, install 32bit version of the librarysudo apt-get install lib32ncurses5
Source