dnschneid / crouton

Chromium OS Universal Chroot Environment
https://goo.gl/fd3zc?si=1
BSD 3-Clause "New" or "Revised" License
8.57k stars 1.24k forks source link

Connecting Android Devices into xfce4 environment #171

Closed Redno-Pnomis closed 11 years ago

Redno-Pnomis commented 11 years ago

Running xfce4 using crouton, I am able to see the device listed as ??????? no permissions. After setting my android rules files, and restarting udev, still no joy. I figured it may be an issue with the permissions as the device is passed from ChromeOS to the xfce4 environment. Any ideas?

mafrosis commented 11 years ago

Hey there, I've been looking at getting a chromebook to do some Android dev whilst travelling. And word on getting adb working under xfce?

Redno-Pnomis commented 11 years ago

I have tried a lot of things that have been offered for solutions, but I am still plagued with ????? No Permissions.

mafrosis commented 11 years ago

Bah that's not good news. I'm going travelling in a couple weeks and hoped to drag a chromebook around with me for hacking.. Looks like there won't be much point! And I don't really have enough time to attempt to figure out the problem myself.

rminnich commented 11 years ago

I don't see how udev in the chroot can do anything but confuse the situation. It's a chroot, not a VM, devices are managed by chromeos, and adding in udev in the chroot can't end happily, at least I don't see how. You'll have chromeos and udev in hte chroot going to war.

ron

dnschneid commented 11 years ago

Actually, udev behaves perfectly nicely when run in the chroot, and most DEs use it to poll and monitor disk insertions/removals.

I've heard of plenty of people doing Android development in crouton, so it should be workable. Does it return ?????? no permissions even when run as root (sudo)?

mafrosis commented 11 years ago

@dnschneid That's good to hear! I'll pick up a Chromebook this week and report back on my success with adb devices

dnschneid commented 11 years ago

http://webiphany.com/2013/03/04/using-your-chromebook-as-your-full-time-no-compromises-android-dev-machine.html might be useful.

mafrosis commented 11 years ago

@dnschneid that looks to be a very useful link, thanks.

According to his notes, you can run crouton without X - which isn't something I've come across up until now. Is this in the notes/docs anywhere? As much as a DE has its place, I prefer a straight shell when I'm hacking.

Love the project name btw :)

dnschneid commented 11 years ago

Definitely! You can check the available targets with -t help; use cli-extra or just core and you won't even have X installed. Then you can just enter-chroot from as many crosh shells as you want, at the same time. You might find the Crosh Window extension useful if you need to pass through function keys and key combos.

mafrosis commented 11 years ago

Awesome. I took a quick peek at Crosh Window, and I may be getting the wrong idea here, but can I then have a crosh terminal window which is running crouton chroot, without switching full screen from ChromeOS? Or am I still using Ctrl+Alt+Forward/Back to switch between the two OSs?

Tbh, I could just stop asking questions and wait to play with it myself :)

dnschneid commented 11 years ago

Correct, you're staying in ChromeOS the entire time. Try it out :)

mafrosis commented 11 years ago

I've been unable to get Android SDK tools to work in a crouton chroot - specifically because of the ARM architecture! The blog post at webiphany suggests it's possible, but I can't see how. Running the android command results in this error:

> android
SWT folder '/home/mafro/android-sdk-linux/tools/lib/arm' does not exist.
Please export ANDROID_SWT to point to the folder containing swt.jar for your platform.
dnschneid commented 11 years ago

It's hard to tell if the webiphany blogger is using the ARM Chromebook or not, but it looks like there aren't any official SDK builds for ARM. There's a short, inconclusive thread about it, and it looks like Ubuntu has ARM builds of ADB in the repos as of Raring.

mafrosis commented 11 years ago

Thanks for the comments. Where did you find the ARM packages for Ubuntu? I didn't find any when I looked.. I thought I was going to have to build from source.. :/

dnschneid commented 11 years ago

I only noticed a package for ADB (not the whole SDK) in Raring, so that doesn't really help you if you need the full SDK.

mafrosis commented 11 years ago

Ah yes. I have seen mention of that elsewhere, but there's not much on it. I'll report back on how long it takes the Chromebook to build the whole SDK! (And if it even works)

dnschneid commented 11 years ago

Pave the way!

mangini commented 11 years ago

@mafrosis I've managed to get Android running in a Chrome Pixel using cli-extra. The error you've mentioned is because 'android' with no arguments tries to open a graphical tool. You can install and update SDKs using the command-line switches of it, like android update sdk -u --filter "android-17,sysimg-17,addon-google_apis-google-17,extra-google-google_play_services"

BTW, the only issue remaining is the udev permission. I can get it working by running sudo adb start-server before, so adb server runs as root, but it is a bit annoying. No matter what udev rules I set in chroot, it is not respected.

mangini commented 11 years ago

And I found the problem with udev: udev is mounting the device with permission for group 'usb' (id=85 in chronos root, non-existent in crouton chroot), despite what is set in rules.d. I've managed to get it working by creating a corresponding group in chroot (sudo groupadd -g 85 usb) and adding myself to it (sudo addgroup whoami usb) . There is probably an easier way to fix it, but I hope this helps until a better solution comes.

dnschneid commented 11 years ago

Yeah, the Chromium OS's udev handles all permissions. If it uses usb for a lot of things, we can add it as a valid group in crouton (we already do it for video and audio).

mangini commented 11 years ago

I've got a lot of requests from Android developers to develop on a Pixel, specially after I/O. If you don't foresee any collateral effect, I think it is a good idea. Thanks!

dnschneid commented 11 years ago

I think "plugdev" is the Ubuntu equivalent of the "usb" group (it doesn't matter if the name is the same between Chromium OS and crouton, as long as the gid is the same). Can anyone confirm this? If you look at the udev stuff that Android installs, does it associated the device with a specific group?

mangini commented 11 years ago

Yep, plugdev is the default in Ubuntu. Android doesn't set udev rules, the user needs to do it, and all examples on how to do it use plugdev. On Jun 18, 2013 5:41 PM, "David Schneider" notifications@github.com wrote:

I think "plugdev" is the Ubuntu equivalent of the "usb" group (it doesn't matter if the name is the same between Chromium OS and crouton, as long as the gid is the same). Can anyone confirm this? If you look at the udev stuff that Android installs, does it associated the device with a specific group?

— Reply to this email directly or view it on GitHubhttps://github.com/dnschneid/crouton/issues/171#issuecomment-19640196 .

mafrosis commented 11 years ago

Glad to hear others are getting it working - but I still see the same error message when I use the android command with update sdk -u --filter. This was actually what I had always been running; the parameter-less "android" in my previous comment was just for example.

@mangini the command you supplied works for you straight from the box with the android SDK?

dnschneid commented 11 years ago

@mafrosis, you still have the issue that you're on ARM (@mangini's on a Pixel, which is x86), so you'll still need to try your compile approach.

dnschneid commented 11 years ago

Fixed in master. Update your chroot! crouton will add the main user to the plugdev group automatically.

Redno-Pnomis commented 11 years ago

I can confirm @mangini suggestions. I have pushed my current work project from Android Studio to my device. Thanks for the insight.

mafrosis commented 11 years ago

Great thread guys. @dnschneid sorry for the brain fail there. I'll let you know when I have time to download the compile the source..