That worth publishing at undeadly.org, I think 16.02.2012 4:57 POLXZOWATELX "frantisek holop" <min...@obiit.org> NAPISAL:
> hi there, > > i wanted to try at least a "hello world" on android. > so i installed some linux on a usb stick to use as a > "mobile development environment". it went rather well, > using the official hello world tutorial, eclipse and ADT. > > but eclipse is not my thing really and as many components > needed for android development run on openbsd, and there > is linux emulation (must be on for this) i started > wondering how far could i get on openbsd before using > linux as a crutch. > > turns out, looong way. > > the development flow is basically: write code, make apk, > install apk on phone/emulator, run apk, (get rich). > > > first things first, had to cheat to get the SDK. the > initial download android-sdk_r16-linux.tgz contains > only scaffolding to get the real thing. it is in java, > but unfortunately swt (part of eclipse) from ports is > too old and i couldnt use the GUI or install ADT (Android > Development Tools). > > TODO: try to update the eclipse port. > > but as i already had all of it on the linux stick, > i simply rsync-ed it over under ~/adroid-sdk > > $ ls -1 android-sdk > SDK Readme.txt > add-ons/ > docs/ > platform-tools/ > platforms/ > samples/ > sources/ > system-images/ > temp/ > tools/ > > $ sudo pkg_add jdk apache-ant > $ export > PATH=$PATH:/usr/local/jdk-1.7.0/bin:$HOME/android-sdk/tools:$HOME/adroid-sdk/ platform-tools > $ java -version > openjdk version "1.7.0" > OpenJDK Runtime Environment (build 1.7.0-b00) > OpenJDK Server VM (build 21.0-b17, mixed mode) > > apply the attached patch to dx. > > these are the API's i have installed using linux: > > $ android list target | grep ^id > id: 1 or "android-3" > id: 2 or "Google Inc.:Google APIs:3" > id: 3 or "android-7" > id: 4 or "Google Inc.:Google APIs:7" > id: 5 or "android-15" > id: 6 or "Google Inc.:Google APIs:15" > > i will use id 3 (Android 2.1.x Eclair) > HelloAndroid.java is also attached > > $ cd src/android/hello > ~/src/android/hello$ android create project -t 3 -n HelloPuffy -p . -k > com.puffy.hello -a HelloPuffy > ~/src/android/hello$ cp ~/HelloAndroid.java src/com/puffy/hello/ > ~/src/android/hello$ ant debug > > if i did not leave out something, the output should finish with: > > BUILD SUCCESSFUL > Total time: 7 seconds > > > for now i upload the apk files using ftp (swiftp on android). > http://obiit.org/f/hello.png > > obviously, this is a suboptimal solution, and there is the emulator... > let's see how far that goes. > > ~/src/android/hello$ android create avd -n puffy_avd -t 3 > Auto-selecting single ABI armeabi > Android 2.1 is a basic Android platform. > Do you wish to create a custom hardware profile [no] > Created AVD 'puffy_avd' based on Android 2.1, ARM (armeabi) processor, > with the following hardware config: > hw.lcd.density=240 > vm.heapSize=24 > > unfortunately 'emulator' uses /proc to determine > it's own path, so we need to trick it: > > ~/src/android/hello$ sudo ln -s ~/android-sdk/tools/emulator /proc/self/exe > ~/src/android/hello$ emulator -avd puffy_avd > emulator: ERROR: _camera_device_open: Cannot open camera device > '/dev/video0': No such device or address > emulator: warning: opening audio input failed > > emulator: WARNING: Unable to create sensors port: Connection refused > > > masaka! stupefaction > http://obiit.org/f/android-emulator-on-openbsd.jpg > http://obiit.org/f/android-emulator-on-openbsd2.jpg > > and its fast compared to the linux stick. just wow. > > > now the bad news. adb does not work. > i have asked about it some time ago on ports@ > as having a native adb just by itself would be > great to push apk's, shell, root, etc. > http://marc.info/?l=openbsd-misc&m=131809077812364&w=2 > some responses indicated it's already work in progress. > > TODO: get adb to work > adb source: https://github.com/android/platform_system_core > > > so this is it, perhaps because i started out with zero > expectations, this is a massive happy end. > > of course, hello world is just that. it remains > to be seen if more complicated projects can be > compiled. > > -f > -- > most days the only good thing on tv is the vase. > --- android-sdk/platform-tools/dx.orig Wed Feb 15 21:42:04 2012 > +++ android-sdk/platform-tools/dx Tue Feb 14 21:29:26 2012 > @@ -1,4 +1,4 @@ > -#!/bin/bash > +#!/bin/sh > # > # Copyright (C) 2007 The Android Open Source Project > # > @@ -56,6 +56,7 @@ > # By default, give dx a max heap size of 1 gig. This can be overridden > # by using a "-J" option (see below). > defaultMx="-Xmx1024M" > +defaultMx="-Xmx512M" > > # The following will extract any initial parameters of the form > # "-J<stuff>" from the command line and pass them to the Java > package com.puffy.hello; > > import android.app.Activity; > import android.os.Bundle; > import android.widget.TextView; > > public class HelloPuffy extends Activity > { > /** Called when the activity is first created. */ > @Override > public void onCreate(Bundle savedInstanceState) > { > super.onCreate(savedInstanceState); > setContentView(R.layout.main); > TextView tv = new TextView(this); > tv.setText("Android, meet Puffy"); > setContentView(tv); > } > }