Search This Blog

03 June 2013

Unable to open MTP device '[usb:003,021]'

Recently I upgraded my Samsung Galaxy Note to JellyBean. Around the same time, I also upgraded both the desktop and laptop to Raring Ringtail.  When connecting the device to the dev boxes, the laptop continued to work. The desktop however would give me a never ending loop of popups like this one:
Unable to open MTP device '[usb:003,021]'

While trying to resolve it, I found this fix about the ASUS Transformer...

I followed the same instructions with a few slight tweaks...

/etc/udev/rules.d/51-android.rules:
# MTP Settings added by Malachi
# From dmesg:
# [  166.765498] usb 3-4: reset high-speed USB device number 20 using ehci-pci
# [  166.845468] usb 3-4: USB disconnect, device number 20
# [  167.084889] usb 3-4: new high-speed USB device number 21 using ehci-pci
# [  167.219607] usb 3-4: New USB device found, idVendor=04e8, idProduct=6860
# [  167.219609] usb 3-4: New USB device strings: Mfr=2, Product=3, SerialNumber=4
# [  167.219611] usb 3-4: Product: SAMSUNG-SGH-I717
# [  167.219613] usb 3-4: Manufacturer: samsung
# [  167.219614] usb 3-4: SerialNumber: 2a4c2c04
ENV{ID_MODEL}=="SAMSUNG-SGH-I717", ENV{ID_MODEL_ID}=="6860", ACTION=="add", RUN+="/usr/bin/sudo -b -u malachi /usr/bin/go-mtpfs -allow-other=true /media/SGH-I717"
ENV{ID_MODEL}=="SAMSUNG-SGH-I717", ENV{ID_MODEL_ID}=="6860", ACTION=="remove", RUN+="/bin/umount /media/SGH-I717"

in /etc/fstab:
DeviceFs(SAMSUNG-SGH-I717)    /media/SGH-I717   fuse.DeviceFs(SAMSUNG-SGH-I717)    allow_other,rw,user,noauto    0    0

Now, when I connect, I get about 50 popups but then ADB works again.

22 May 2013

Android Studio desktop entry

I've been using IntelliJ for my Android development from the beginning.  The new from #io13 that they were switching to an IntelliJ-based IDE was awesome.  Of course, I had to download it and try it out.

First thing to note is that although the Ultimate edition of IntelliJ is supposed to have the same support; the two are not exactly the same.  Creating a new project in Android Studio has a different wizard (at least today).

I installed Android Studio in /usr/local/android-studio.  Upon launching Android Studio, I decided to try to do the "Configure | Create desktop entry".

This unfortunately caused an exception:

[  10724]   WARN - tions.CreateDesktopEntryAction - Unable to locate suitable startup script in '/usr/local/android-studio/bin'. java.lang.RuntimeException: Unable to locate suitable startup script in '/usr/local/android-studio/bin'. at com.intellij.ide.actions.CreateDesktopEntryAction.prepare(CreateDesktopEntryAction.java:148) at com.intellij.ide.actions.CreateDesktopEntryAction.createDesktopEntry(CreateDesktopEntryAction.java:99) at com.intellij.ide.actions.CreateDesktopEntryAction$1.run(CreateDesktopEntryAction.java:82) at com.intellij.openapi.progress.impl.ProgressManagerImpl$TaskRunnable.run(ProgressManagerImpl.java:493) at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:185) at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:226) at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:175) at com.intellij.openapi.progress.impl.ProgressManagerImpl$8.run(ProgressManagerImpl.java:400) at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:458) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:722) at com.intellij.openapi.application.impl.ApplicationImpl$1$1.run(ApplicationImpl.java:154)

The solution is just to create the desktop entry manually. Create the file ~/.local/share/applications/android-studio.desktop:


[Desktop Entry]
Version=1.0
Comment=Develop Android with pleasure!
Terminal=false
Name=Android Studio
Exec="/usr/local/android-studio/bin/studio.sh" %f
Type=Application
Icon=/usr/local/android-studio/bin/idea.png
Categories=Development;IDE;
StartupNotify=true
StartupWMClass=jetbrains-idea


That's it. Depending on your OS version and window manager, you may need to restart X and/or log out.

09 May 2013

Upgrading the Galaxy Note to Jelly Bean

I received an SMS from AT&T today telling me that I could upgrade to JB using KIES. Enough acronyms for you?

Rebooting into Windows so that I could launch Kies....
Starting Kies, it detected that it was out of date and updated.
Afterwards, plugging in the phone, it detected the firmware was out of date and tried to update.
That's where things got redundant.  I got in an infinite loop that kept stopping at:


Now, don't get me wrong. My first thought was maybe I was down to 100MB internal storage again. I do tend to install a couple hundred apps.

But, now according to the file manager:

So what's going on?

After a few attempts, I went to Settings | Storage | Unmount SD Card

After that Kies was able to upgrade the device.

24 March 2013

ia32-libs

Android is full of 32-bit tools and dependencies.
Running on x64 can be problematic unless you install ia32-libs.
Unfortunately, Ubuntu has been having issues installing it lately.

After 2 days, I finally found the solution here:

sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install ia32-libs

After that, everything installs fine.

13 May 2012

LMDE upgrade broke me

While not strictly an Android issue, I figured I would post this here since it it related to my previously mentioned build box.

Every time LMDE upgrades, it breaks my packages.  At the very least, it breaks the nvidia driver (I should probably switch to source-based) but this last time, it auto uninstalled almost everything NVidia/Gnome/X11/Mate/Cinnamon/etc.

You might be asking, "Why didn't you read the release notes that said to not upgrade yet?"

Well, to be honest, I was used to the simplicity of the daily non-breaking Ubuntu updates.  This new Debian tri-weekly breaking rolling update is a new beast to get used to. I put rolling update in italic because I don't understand how updating more packages less often is 'rolling'.

Anyways, I spent the last 3 days trying to fix my box.  It would boot fine - into a command line... but I really prefer to use Firefox/Chrome/Opera over links to do my web searching.

I am sure these instructions are not the correct way to do things.  You might even say it could be a bad idea to get into someones head.  But since that was the only thing I tried that allowed me to start booting into X again, here we go.

STEP 1:
First off, I determined something I thought should be installed.  I don't know what the process in my head is for that, other than just selecting some random names I thought out to be there.  For example 'gdm'.

STEP 2:
Secondly, I need to find out the correct name for it. IE: it's 'gdm3' not 'gdm'. For this, I did:
apt search gdm
and found the one that looked right (in this case 'gdm3').

STEP 3:
Then, I needed to know whether it was actually installed yet or not -- and at which revision. For that I did:
apt-cache policy gdm3

This showed that it was not currently installed!  Well that doesn't sound right.

STEP 4:
If step 3 showed the correct (updated) candidate:
apt install gdm3
If it fails to install, it might list some unmet dependency.  If so, I start over at STEP 3 (or STEP 2 if that doesn't work) using that dependency as the new name to test.

STEP 5:
If STEP 3 showed the wrong (or no) candidate, I looked at the numbers [priority] at the beginning of each URL.  It might show something like '500' for the one you want to install but '*** 700' for the one you have installed or it wants installed.  Look at the URL for the one with the higher unwanted priority.

STEP 6:
edit /etc/apt/sources.list and comment out the URL from STEP 5
apt update
apt dist-upgrade
Go to STEP 3.


Like I said, these are probably not a good template to follow; however, next time instead of wasting 3 days trying to fix an upgrade I'll start here.

14 April 2012

Unknown Host Exception

I spent an hour trying to figure out why my little 1-page test app was throwing an UnknownHostException but the browser was working. To make matters worse, there was a red herring in that I could not ping from adb shell.

Turns out it was a stupid ommission. If you are having this problem, don't forget to add this to your AndroidManifest:

<uses-permission android:name="android.permission.INTERNET"/>

20 March 2012

Modify the emulator system.img

As a followup to my earlier post, I thought I would show how to modify the system.img the emulator is using.

This assumes that you are building Android and want to use some of the generated APKs inside the stock emulator.  That isn't the only scenario, but it's the one I am covering here.

First, we need to determine where the images are being loaded from. In this case my AVD is called "ics".
malachi@onyx:~/work/redo_system$ grep sysdir ~/.android/avd/ics.avd/config.ini
image.sysdir.2=system-images/android-14/armeabi-v7a/
image.sysdir.1=add-ons/addon-google_apis-google_inc_-14/images/armeabi-v7a/

Let's grab a local copy of those files
malachi@onyx:~/work/redo_system$ cp $ANDROID_HOME/add-ons/addon-google_apis-google_inc_-14/images/armeabi-v7a/* .

This time around, we are interested in the system.img. Let's unpack it.
malachi@onyx:~/work/redo_system$ mkdir unpacked
malachi@onyx:~/work/redo_system$ cd unpacked/
malachi@onyx:~/work/redo_system/unpacked$ unyaffs ../system.img
end of image

Replace a couple apps
malachi@onyx:~/work/redo_system/unpacked$ cd app
malachi@onyx:~/work/redo_system/unpacked/app$ cp ~/work/ics/out/target/product/SomeProduct/system/app/Contacts.apk .
malachi@onyx:~/work/redo_system/unpacked/app$ cp ~/work/ics/out/target/product/SomeProduct/system/app/ContactsProvider.apk .

Repack the system.img
malachi@onyx:~/work/redo_system/unpacked/app$ cd ../..
malachi@onyx:~/work/redo_system$ rm system.img
malachi@onyx:~/work/redo_system$ ~/work/ics/out/host/linux-x86/bin/mkyaffs2image unpacked system.img

Point our AVD to our new images
malachi@onyx:~/work/redo_system$ nano ~/.android/avd/ics.avd/config.ini
image.sysdir.2=system-images/android-14/armeabi-v7a/
image.sysdir.1=/home/malachi/work/redo_system/

The old userdata may not be compatible with your new apps. Make sure to use -wipe-data:

malachi@onyx:~/work/redo_system$ emulator -avd ics -show-kernel -scale 0.70 -memory 1024 -logcat 'dalvikvm:S,StrictMode:S,*:D' -partition-size 1024 -wipe-data

You are now running a slightly modified emulator...