欧美日韩国产一区二区在线观看,一区福利视频,一区二区欧美在线观看http://www.aygfsteel.com/TiGERTiAN/category/43645.html----TiGERTiANzh-cnSun, 23 Jan 2011 15:01:37 GMTSun, 23 Jan 2011 15:01:37 GMT6064位Ubuntu 10.10編譯Android 2.3.1源代碼http://www.aygfsteel.com/TiGERTiAN/archive/2011/01/23/343404.htmlTiGERTiANTiGERTiANSun, 23 Jan 2011 10:13:00 GMThttp://www.aygfsteel.com/TiGERTiAN/archive/2011/01/23/343404.htmlhttp://www.aygfsteel.com/TiGERTiAN/comments/343404.htmlhttp://www.aygfsteel.com/TiGERTiAN/archive/2011/01/23/343404.html#Feedback0http://www.aygfsteel.com/TiGERTiAN/comments/commentRss/343404.htmlhttp://www.aygfsteel.com/TiGERTiAN/services/trackbacks/343404.html1、在虛擬機上安裝64位Ubuntu 10.10,安裝完成后進行系統升級。
2、將源代碼拷貝進去或者下載下來。
3、sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl sun-java6-jdk zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z1-dev
4、所有都安裝完成后進行編譯。
. build/envsetup.sh
make -j4 PRODUCT-generic-eng

不要 choosecombo,否則會有很多莫名其妙的問題。

TiGERTiAN 2011-01-23 18:13 發表評論
]]>
Android 開發環境建立-gcc 的問題http://www.aygfsteel.com/TiGERTiAN/archive/2011/01/22/343372.htmlTiGERTiANTiGERTiANSat, 22 Jan 2011 05:19:00 GMThttp://www.aygfsteel.com/TiGERTiAN/archive/2011/01/22/343372.htmlhttp://www.aygfsteel.com/TiGERTiAN/comments/343372.htmlhttp://www.aygfsteel.com/TiGERTiAN/archive/2011/01/22/343372.html#Feedback0http://www.aygfsteel.com/TiGERTiAN/comments/commentRss/343372.htmlhttp://www.aygfsteel.com/TiGERTiAN/services/trackbacks/343372.html

漫長的編譯開始了,當然成功不會一蹴而就的,不出所料,錯誤出現了

ost C: adb <= system/core/adb/fdevent.c

 

host Executable: adb (out/host/linux-x86/obj/EXECUTABLES/adb_intermediates/adb)

 

out/host/linux-x86/obj/STATIC_LIBRARIES/libzipfile_intermediates/libzipfile.a(centraldir.o): In function `memset':

 

/usr/include/bits/string3.h:82: warning: memset used with constant zero length parameter; this could be due to transposed parameters

 

true

 

Install: out/host/linux-x86/bin/adb

 

host C++: atree <= build/tools/atree/atree.cpp

 

host C++: atree <= build/tools/atree/files.cpp

 

host C++: atree <= build/tools/atree/fs.cpp

 

host Executable: atree (out/host/linux-x86/obj/EXECUTABLES/atree_intermediates/atree)

 

true

 

Install: out/host/linux-x86/bin/atree

 

host C++: bb2sym <= development/emulator/qtools/bb2sym.cpp

 

host C++: bb2sym <= development/emulator/qtools/trace_reader.cpp

 

development/emulator/qtools/trace_reader.cpp: In function ‘char* ExtractDexPathFromMmap(const char*)’:

 

development/emulator/qtools/trace_reader.cpp:1012: error: invalid conversion from ‘const char*’ to ‘char*’

 

development/emulator/qtools/trace_reader.cpp:1015: error: invalid conversion from ‘const char*’ to ‘char*’

 

make: *** [out/host/linux-x86/obj/EXECUTABLES/bb2sym_intermediates/trace_reader.o] 錯誤 1

繼續求教于,Google和百度吧,原來是gcc版本的問題

$gcc --version

 

gcc (Ubuntu 4.4.1-4ubuntu9) 4.4.1

 

Copyright (C) 2009 Free Software Foundation, Inc.

 

This is free software; see the source for copying conditions.  There is NO

 

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 

 

研究了一下發現問題主要出在Ubuntu10.4預置了gcc的版本是4.4,該版本編譯時對語法要求比較高,因此無法編譯源代碼,解決方法就是將gcc-4.4降級成gcc-4.3

 

具體操作:

sudo apt-get remove gcc-4.4(卸載gcc-4.4)

sudo apt-get remove g++-4.4( 卸載g++-4.4)

sudo apt-get install gcc-4.3(安裝gcc-4.3)

sudo apt-get install g++-4.3(安裝g++-4.3)

 

安裝完4.3版本后,執行gcc --version后會發現版本仍然是4.4,因為gcc已經和4.4版本進行了鏈接,因此需要對gcc重新進行鏈接

 

具體操作:sudo ln -f /usr/bin/gcc-4.3 gcc

 

                    sudo ln -f/usr/bin/g++-4.3 g++

 

這樣就可以用4.3版本的gcc和g++將原來的覆蓋掉,重新進入android源碼目錄執行make就可以正常編譯~~



TiGERTiAN 2011-01-22 13:19 發表評論
]]>
64bit Linux下error: gnu/stubs-32.h: No such file or directory錯誤解決辦法http://www.aygfsteel.com/TiGERTiAN/archive/2011/01/22/343370.htmlTiGERTiANTiGERTiANSat, 22 Jan 2011 04:36:00 GMThttp://www.aygfsteel.com/TiGERTiAN/archive/2011/01/22/343370.htmlhttp://www.aygfsteel.com/TiGERTiAN/comments/343370.htmlhttp://www.aygfsteel.com/TiGERTiAN/archive/2011/01/22/343370.html#Feedback0http://www.aygfsteel.com/TiGERTiAN/comments/commentRss/343370.htmlhttp://www.aygfsteel.com/TiGERTiAN/services/trackbacks/343370.html

Q. I'm getting the following error while compiling application under CentOS / RHEL / Fedora Linux 64 bit edition:

/usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h:

No such file or directory

How do I fix this error?

A. You need to install the glibc-devel package. It contains the object files necessary for developing programs which use the standard C libraries (which are used by nearly all programs). If you are developing programs which will use the standard C libraries, your system needs to have these standard object files available in order to create the executables.

Install glibc-devel if you are going to develop programs which will use the standard C libraries.
apt-get install g++-multilib


 



TiGERTiAN 2011-01-22 12:36 發表評論
]]>
[解決辦法]development/simulator/app/DeviceManager.cpp:8: fatal error: wx/wxprec.h: No such file or directory (wx/setup.h: No such file or directory)http://www.aygfsteel.com/TiGERTiAN/archive/2011/01/20/343287.htmlTiGERTiANTiGERTiANThu, 20 Jan 2011 15:19:00 GMThttp://www.aygfsteel.com/TiGERTiAN/archive/2011/01/20/343287.htmlhttp://www.aygfsteel.com/TiGERTiAN/comments/343287.htmlhttp://www.aygfsteel.com/TiGERTiAN/archive/2011/01/20/343287.html#Feedback0http://www.aygfsteel.com/TiGERTiAN/comments/commentRss/343287.htmlhttp://www.aygfsteel.com/TiGERTiAN/services/trackbacks/343287.htmldevelopment/simulator/app/DeviceManager.cpp:8: fatal error: wx/wxprec.h: No such file or directory

1.tigertian@ubuntu:~/Developer/android_src$ apt-file search wxprec.h

wx2.4-headers: /usr/include/wx/wxprec.h

wx2.6-headers: /usr/include/wx-2.6/wx/wxprec.h

wx2.8-headers: /usr/include/wx-2.8/wx/wxprec.h

2.sudo apt-get install wx2.4
wx-config --cflags




TiGERTiAN 2011-01-20 23:19 發表評論
]]>
編譯Android 2.3源碼http://www.aygfsteel.com/TiGERTiAN/archive/2011/01/20/343283.htmlTiGERTiANTiGERTiANThu, 20 Jan 2011 14:24:00 GMThttp://www.aygfsteel.com/TiGERTiAN/archive/2011/01/20/343283.htmlhttp://www.aygfsteel.com/TiGERTiAN/comments/343283.htmlhttp://www.aygfsteel.com/TiGERTiAN/archive/2011/01/20/343283.html#Feedback0http://www.aygfsteel.com/TiGERTiAN/comments/commentRss/343283.htmlhttp://www.aygfsteel.com/TiGERTiAN/services/trackbacks/343283.html

前幾天下載了Android 2.3.1的源代碼并在Ubuntu 10.04(32位)上編譯通過。這篇文章簡要記錄了下載、編譯的過程。

關于搭建Android開發環境的文章已經有很多,本文只簡要介紹一下,做為備忘。

[ 編譯前的準備 ]

這一步安裝獲取源代碼以及編譯所需要的軟件,使用如下命令:

 $ sudo aptitude install git-core gnupg flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev java-common unixodbc 

另外,參考別人編譯Android 2.3的經驗,安裝了下列軟件包:

$ sudo apt-get install lib64z1-dev libc6-dev-amd64 g++-multilib lib64stdc++6 

注意:32 bit Required Packages 為

 git-core gnupg sun-java5-jdk flex bison gperf build-essential zip curl zlib1g-dev  libsdl-dev libesd0-dev libwxgtk2.6-dev libncurses5-dev  

而64 bit 下的  Required Packages 為 git-core gnupg flex bison gperf build-essential zip curl sun-java6-jdk zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z1-dev

雖然Android官方網站上講不支持Java 6,不過我使用Java 6也可以編譯通過,所以在這里Easwy安裝的是Java 6。首先去掉/etc/apt/sources.list中這兩行的注釋,使能Java 6源:

 

deb http://archive.canonical.com/ubuntu lucid partner
deb-src http://archive.canonical.com/ubuntu lucid partner 

然后安裝Java 6 JDK:

$ sudo aptitude install sun-java6-jdk 

接下來下載repo工具,這是Google提供的一個Python腳本,方便管理多個Git版本庫:

$ cd ~
$ mkdir bin
$ curl http://android.git.kernel.org/repo >~/bin/repo
$ chmod a+x ~/bin/repo 

記得把repo加到你的路徑中,方便以后使用。編輯~/.bashrc,加入下面一行:

PATH=$PATH:~/bin
export PATH 

然后用命令. ~/.bashrc,以后就可以直接使用repo命令了。

接下來獲取Android 2.3.1的源代碼:

$ mkdir mydroid
$ cd mydroid
$ repo init -u git://android.git.kernel.org/platform/manifest.git -b android-2.3.1_r1
$ repo sync 

[ 編譯Android ]

接下來開始編譯:

$ make -j`grep '^processor' /proc/cpuinfo | wc -l` 

上面的命令中,-j參數告訴make啟動多個并行任務進行編譯,在支持多核的CPU上能加快編譯速度。如果你知道你CPU是幾核的,可以直接把這部分替換成-j2(雙核)。

我在編譯的過程中遇到下面的錯誤:

************************************************************

You are attempting to build on a 32-bit system.

Only 64-bit build environments are supported beyond froyo/2.2.

************************************************************

這是因為在Makefile中檢測了CPU的字長。我直接把build/core/main.mk中下面的話注釋掉:

#ifneq (64,$(findstring 64,$(build_arch)))
#$(warning ************************************************************)
#$(warning You are attempting to build on a 32-bit system.)
#$(warning Only 64-bit build environments are supported beyond froyo/2.2.)
#$(warning ************************************************************)
#$(error stop)
#endif 

接下來又遇到下面的錯誤:

Docs droiddoc: out/target/common/docs/api-stubs

Could not load ‘clearsilver-jni’

java.library.path = out/host/linux-x86/lib

make: *** [out/target/common/docs/api-stubs-timestamp] Error 45

make: *** Waiting for unfinished jobs….

Could not load ‘clearsilver-jni’

java.library.path = out/host/linux-x86/lib

make: *** [out/target/common/docs/doc-comment-check-timestamp] Error 45

這是由于clearsilver在編譯時如果檢測到使用Java JDK 6,就使用64位編譯。要避開此錯誤,需要修改下面四個文件:

  • external/clearsilver/cgi/Android.mk
  • external/clearsilver/java-jni/Android.mk
  • external/clearsilver/util/Android.mk
  • external/clearsilver/cs/Android.mk

把這四個Makefile中的下列語句注掉即可:

# This forces a 64-bit build for Java6
# Comment by Easwy
# LOCAL_CFLAGS += -m64
# LOCAL_LDFLAGS += -m64 

然后在external/clearsilver目錄中執行一下make clean,然后回到項目根目錄,繼續make即可。

當編譯完成時,生成的image文件放在out/target/product/generic目錄中。

需要將gcc編譯環境設置為4.3版本,否則會出現const char* 到  char*無法轉換的問題。
http://www.aygfsteel.com/TiGERTiAN/archive/2011/01/22/343372.html



TiGERTiAN 2011-01-20 22:24 發表評論
]]>
Android源代碼編譯發生錯誤fatal error: alsa/asoundlib.h: No such file or directory解決辦法http://www.aygfsteel.com/TiGERTiAN/archive/2011/01/12/342810.htmlTiGERTiANTiGERTiANTue, 11 Jan 2011 23:59:00 GMThttp://www.aygfsteel.com/TiGERTiAN/archive/2011/01/12/342810.htmlhttp://www.aygfsteel.com/TiGERTiAN/comments/342810.htmlhttp://www.aygfsteel.com/TiGERTiAN/archive/2011/01/12/342810.html#Feedback0http://www.aygfsteel.com/TiGERTiAN/comments/commentRss/342810.htmlhttp://www.aygfsteel.com/TiGERTiAN/services/trackbacks/342810.html

錯誤:

development/simulator/wrapsim/DevAudio.c:11: fatal error: alsa/asoundlib.h: No such file or directory

compilation terminated.

make: *** [out/debug/host/linux-x86/pr/sim/obj/SHARED_LIBRARIES/libwrapsim_intermediates/DevAudio.o] Error 1

解決辦法:

apt-file search alsa/asoundlib.h
libasound2-dev: /usr/include/alsa/asoundlib.h

So that’s it, asoundlib.h is in the package libasound2-dev.

apt-file需要使用apt-get install apt-file安裝一下。

 



TiGERTiAN 2011-01-12 07:59 發表評論
]]>
Froyo build error (libGLES_android_intermediates/egl.o)http://www.aygfsteel.com/TiGERTiAN/archive/2011/01/11/342792.htmlTiGERTiANTiGERTiANTue, 11 Jan 2011 12:38:00 GMThttp://www.aygfsteel.com/TiGERTiAN/archive/2011/01/11/342792.htmlhttp://www.aygfsteel.com/TiGERTiAN/comments/342792.htmlhttp://www.aygfsteel.com/TiGERTiAN/archive/2011/01/11/342792.html#Feedback0http://www.aygfsteel.com/TiGERTiAN/comments/commentRss/342792.htmlhttp://www.aygfsteel.com/TiGERTiAN/services/trackbacks/342792.html make: *** [out/debug/host/linux-x86/pr/sim/obj/SHARED_LIBRARIES/
libGLES_android_intermediates/egl.o] Error 1

Solution:
in egl.cpp, at the line 554 :
const Region copyBack(Region::subtract(oldDirtyRegion, dirtyRegion));
just remove the 'const' and retry.


TiGERTiAN 2011-01-11 20:38 發表評論
]]>
Android Froyo基于32 bit Ubuntu 10.10編譯問題http://www.aygfsteel.com/TiGERTiAN/archive/2011/01/10/342732.htmlTiGERTiANTiGERTiANMon, 10 Jan 2011 13:32:00 GMThttp://www.aygfsteel.com/TiGERTiAN/archive/2011/01/10/342732.htmlhttp://www.aygfsteel.com/TiGERTiAN/comments/342732.htmlhttp://www.aygfsteel.com/TiGERTiAN/archive/2011/01/10/342732.html#Feedback0http://www.aygfsteel.com/TiGERTiAN/comments/commentRss/342732.htmlhttp://www.aygfsteel.com/TiGERTiAN/services/trackbacks/342732.html

 查找資料,確定下面的修改步驟(-表示刪除行,+表示添加行):

              1、修改build/core錄下的main.mk文件,修改策略為:
                       ifeq ($(BUILD_OS),linux) 
                        build_arch := $(shell uname -m) 
                       -ifneq (64,$(findstring 64,$(build_arch))) 
                       +ifneq (i686,$(findstring i686,$(build_arch))) 
                      $(warning ************************************************************) 
                      $(warning You are attempting to build on a 32-bit system.) 
                      $(warning Only 64-bit build environments are supported beyond froyo/2.2.)

              2、修改下列文件:
                       /external/clearsilver/cgi/Android.mk
                       /external/clearsilver/cs/Android.mk
                       /external/clearsilver/java-jni/Android.mk
                       /external/clearsilver/util/Android.mk
                     4個文件的修改策略相同,為:
                       # This forces a 64-bit build for Java6 
                        -LOCAL_CFLAGS += -m64 
                        -LOCAL_LDFLAGS += -m64 
                        +LOCAL_CFLAGS += -m32 
                        +LOCAL_LDFLAGS += -m32

        接下來的編譯可能會遇到很多因為缺少相應模塊而產生的錯誤,請首先安裝下列軟件模塊:

                        bison
                        sun-java6-jdk
                        g++ (build-essential)
                        zlib1g-dev
                        flex
                        libncurses-dev
                        gperf

然后,就是make之后漫長的等待...

 



TiGERTiAN 2011-01-10 21:32 發表評論
]]>
Building, running, and debugging Android sourcehttp://www.aygfsteel.com/TiGERTiAN/archive/2010/09/28/333206.htmlTiGERTiANTiGERTiANTue, 28 Sep 2010 03:25:00 GMThttp://www.aygfsteel.com/TiGERTiAN/archive/2010/09/28/333206.htmlhttp://www.aygfsteel.com/TiGERTiAN/comments/333206.htmlhttp://www.aygfsteel.com/TiGERTiAN/archive/2010/09/28/333206.html#Feedback0http://www.aygfsteel.com/TiGERTiAN/comments/commentRss/333206.htmlhttp://www.aygfsteel.com/TiGERTiAN/services/trackbacks/333206.html

There is a lot of confusion surrounding the work flow in the Android source tree, so allow me to simplify:

  1. Follow the initial instructions for downloading the source at:

    http://source.android.com/download

  2. Set up your environment to build the engineering build for the generic device and generic product. This is similar to the SDK, but with a few pieces missing.

    $ source build/envsetup.sh
    $ lunch 1

  3. To build for the first time:

    $ make

    If you have a multi-core system, you can build with make -jN where N is twice the number of cores on your machine. This should speed up the first build considerably.

  4. To launch the emulator from your build:

    $ ./out/host/<your-machine-type>/bin/emulator

    On my system <your-machine-type> is linux-x86.

    NOTE: The emulator knows where to find system and data images as a result of running lunch 1 above. This sets the environment variable ANDROID_PRODUCT_OUT to point to the target directory. For this example, it should be out/target/product/generic/.

  5. If you wish to make changes to the source code, there are handy utilities that have been exposed to your environment by source build/envsetup.sh above. For example, if you modify the Email app and just want to rebuild it:

    $ mmm packages/apps/Email

  6. To see your changes in the emulator you can run:

    $ adb remount
    $ adb sync

    Which will copy the regenerated Email.apk file into the emulator’s /system/app folder, triggering the PackageManager to automatically reinstall it.

  7. Or if you change framework resources in frameworks/base/core/res/res/ you could regenerate framework-res.apk with:

    $ mmm frameworks/base/core/res

    Or if you modified even the framework itself you could run:

    $ ONE_SHOT_MAKEFILE="frameworks/base/Android.mk" make framework

    This is a special variation of mmm which is used to build frameworks/base/core/java.

    To sync these changes you must restart the running framework and sync, as with this handy sequence:

    $ adb remount
    $ adb shell stop
    $ adb sync
    $ adb shell start

  8. Finally, to debug your changes you can use the DDMS tool to select a process for debug and then attach Eclipse to it. If you have the Eclipse Android Development plugin installed, there is a special DDMS perspective which you can use to choose the process for debug. To attach Eclipse to it, see these instructions:

    http://source.android.com/using-eclipse

    This document also describes how to use Eclipse for development. Any IDE should work with the proper finagling though. Just note that the IDE won’t really by an integrated environment, the final output of APKs, system.img, and even the generation of R.java files will have to be done by make!

    A note about the processes in Android:

    • system_process houses all things under frameworks/base/services. This includes the PackageManagerService, StatusBarService, etc. It has many, many threads (one for each service, and then one main UI thread), so be wary when debugging.
    • com.android.acore hosts Launcher (home), Contacts, etc. You can determine the apps/providers that run here by looking forandroid:process="android.process.acore" in the various AndroidManifest.xml files in packages/.

    Also remember that the “framework” (under frameworks/base/core/java) is not hosted by any one process. It is a library used by most processes, so to debug code there you can usually use a simple demo app that takes advantage of whatever you changed and debug that app’s process. A useful trick for setting up your debug connection is to call Debug.waitForDebugger() during some startup part of an application or system service.



TiGERTiAN 2010-09-28 11:25 發表評論
]]>
Configuring a New Product of Android 2.2 Froyohttp://www.aygfsteel.com/TiGERTiAN/archive/2010/09/24/332751.htmlTiGERTiANTiGERTiANFri, 24 Sep 2010 03:11:00 GMThttp://www.aygfsteel.com/TiGERTiAN/archive/2010/09/24/332751.htmlhttp://www.aygfsteel.com/TiGERTiAN/comments/332751.htmlhttp://www.aygfsteel.com/TiGERTiAN/archive/2010/09/24/332751.html#Feedback0http://www.aygfsteel.com/TiGERTiAN/comments/commentRss/332751.htmlhttp://www.aygfsteel.com/TiGERTiAN/services/trackbacks/332751.html閱讀全文

TiGERTiAN 2010-09-24 11:11 發表評論
]]>
Using eclipse with android sourcehttp://www.aygfsteel.com/TiGERTiAN/archive/2010/09/24/332731.htmlTiGERTiANTiGERTiANFri, 24 Sep 2010 00:41:00 GMThttp://www.aygfsteel.com/TiGERTiAN/archive/2010/09/24/332731.htmlhttp://www.aygfsteel.com/TiGERTiAN/comments/332731.htmlhttp://www.aygfsteel.com/TiGERTiAN/archive/2010/09/24/332731.html#Feedback0http://www.aygfsteel.com/TiGERTiAN/comments/commentRss/332731.htmlhttp://www.aygfsteel.com/TiGERTiAN/services/trackbacks/332731.html

sing Eclipse

This document will help you set up the Eclipse IDE for Android platform development.

Note: if you are looking for information on how to use Eclipse to develop applications that run on Android, this is not the right page for you. You probably would find the Eclipse page on developer.android.com more useful.

Enter eclipse

Basic setup

First, it's important to make sure the regular Android development system is set up.

cd /path/to/android/root 
make # and wait a while, if you haven't done this

Important : You will still be using "make" to build the files you will actually run (in the emulator or on a device). You will be using Eclipse to edit files and verify that they compile, but when you want to run something you will need to make sure files are saved in Eclipse and run "make" in a shell. The Eclipse build is just for error checking.

Eclipse needs a list of directories to search for Java files. This is called the "Java Build Path" and can be set with the .classpath file. We have a sample version to start you off.

cd /path/to/android/root 
cp development/ide/eclipse/.classpath .
chmod u+w .classpath # Make the copy writable

Now edit that copy of .classpath, if necessary.

Increase Eclipse's Memory Settings

The Android project is large enough that Eclipse's Java VM sometimes runs out of memory while compiling it. Avoid this problem by editing the the eclipse.ini file. On Apple OSX the eclipse.ini file is located at /Applications/eclipse/Eclipse.app/Contents/MacOS/eclipse.ini

Memory-related defaults (as of Eclipse 3.4)

-Xms40m 
-Xmx256m
-XX:MaxPermSize=256m

Recommended settings for Android development

-Xms128m 
-Xmx512m
-XX:MaxPermSize=256m

These settings set Eclipse's minimum Java heap size to 128MB, set the maximum Java heap size to 512MB, and keep the maximum permanent generation size at the default of 256MB.

Now start Eclipse:

eclipse  # or you can click some clicky thing instead, if you prefer 

Now create a project for Android development:

  1. If Eclipse asks you for a workspace location, choose the default.
  2. If you have a "Welcome" screen, close it to reveal the Java perspective.
  3. File New Java Project
  4. Pick a project name, "android" or anything you like.
  5. Select "Create project from existing source", enter the path to your Android root directory, and click Finish.
  6. Wait while it sets up the project. (You'll see a subtle progress meter in the lower right corner.)

Once the project workspace is created, Eclipse should start building. In theory, it should build with no errors and you should be set to go. If necessary, uncheck and re-check Project Build Automatically to force a rebuild.

Note: Eclipse sometimes likes to add an "import android.R" statement at the top of your files that use resources, especially when you ask eclipse to sort or otherwise manage imports. This will cause your make to break. Look out for these erroneous import statements and delete them.

When you sync

Every time you repo sync, or otherwise change files outside of Eclipse (especially the .classpath), you need to refresh Eclipse's view of things:

  1. Window Show View Navigator
  2. In the "Navigator", right-click on the project ("android-java" or whatever you named it)
  3. Click Refresh in the context menu

Adding apps to the build path

The default .classpath includes the source to the core system and a sample set of apps, but might not include the particular app you may want to work on. To add an app, you must add the app's source directory. To do this inside Eclipse:

  1. Project Properties
  2. Select "Java Build Path" from the left-hand menu.
  3. Choose the "Source" tab.
  4. Click "Add Folder...".
  5. Add your app's "src" directory.
  6. Click OK.

When you're done, the "source folder" path in the list should look like android/packages/apps/YourAppName /src. Depending on which app(s) you include, you may also need to include othersrc/main/java directories under android/dalvik/libcore. Do this if you find you cannot build with the default set.

Eclipse formatting

You can import files in development/ide/eclipse to make Eclipse follow the Android style rules. Select "Window › Preferences › Java › Code Style". Use "Formatter › Import" to import android-formatting.xml and "Organize Imports › Import" to import android.importorder.

Debugging the emulator with Eclipse

You can also use eclipse to debug the emulator and step through code. First, start the emulator running:

cd /path/to/android/root 
. build/envsetup.sh
lunch 1 # to build the emulator
make # if you didn't already do this
emulator # you should see a GUI picture of a phone

In another shell, start DDMS (the Dalvik debug manager):

cd /path/to/android/root 
ddms # you should get a splufty debugging console

Now, in eclipse, you can attach to the emulator:

  1. Run Open Debug Dialog...
  2. Right-click "Remote Java Application", select "New".
  3. Pick a name, "android-debug" or anything you like.
  4. Set the "Project" to your project ("android-java" or whatever).
  5. Keep the "Host" set to "localhost", but change "Port" to 8700.
  6. Click the "Debug" button and you should be all set.

Note that port 8700 is attached to whatever process is currently selected in the DDMS console, so you need to sure that DDMS has selected the process you want to debug.

You may need to open the Debug perspective (next to the "Java" perspective icon in the upper-right, click the small "Open Perspective" icon and select "Debug"). Once you do, you should see a list of threads; if you select one and break it (by clicking the "pause" icon), it should show the stack trace, source file, and line where execution is at. Breakpoints and whatnot should all work.

Bonus material

Replace Ctrl with the Apple key on Mac.

Ctrl-Shift-o = Organize imports 
Ctrl-Shift-t = load class by name
Ctrl-Shift-r = load non-class resource by name
Ctrl-1 = quick fix
Ctrl-e = Recently viewed files
Ctrl-space = auto complete
Shift-Alt-r = refactor:rename
Shift-Alt-v = refactor:move

"Eclipse is not working correctly, what should I do?"

Make sure:

  • You followed the instructions on this page precisely.
  • Your Problems view doesn't show any errors.
  • Your application respects the package/directory structure.

If you're still having problems, please contact one of the Android mailing lists or IRC channels.



TiGERTiAN 2010-09-24 08:41 發表評論
]]>
Compiling Android 2.2 Froyo source On Mac OS X 10.6 Snow Leopardhttp://www.aygfsteel.com/TiGERTiAN/archive/2010/09/21/332630.htmlTiGERTiANTiGERTiANTue, 21 Sep 2010 13:53:00 GMThttp://www.aygfsteel.com/TiGERTiAN/archive/2010/09/21/332630.htmlhttp://www.aygfsteel.com/TiGERTiAN/comments/332630.htmlhttp://www.aygfsteel.com/TiGERTiAN/archive/2010/09/21/332630.html#Feedback0http://www.aygfsteel.com/TiGERTiAN/comments/commentRss/332630.htmlhttp://www.aygfsteel.com/TiGERTiAN/services/trackbacks/332630.html閱讀全文

TiGERTiAN 2010-09-21 21:53 發表評論
]]>
android在ubuntu桌面系統下編譯可能的錯誤和解決方法http://www.aygfsteel.com/TiGERTiAN/archive/2010/09/19/332475.htmlTiGERTiANTiGERTiANSun, 19 Sep 2010 12:55:00 GMThttp://www.aygfsteel.com/TiGERTiAN/archive/2010/09/19/332475.htmlhttp://www.aygfsteel.com/TiGERTiAN/comments/332475.htmlhttp://www.aygfsteel.com/TiGERTiAN/archive/2010/09/19/332475.html#Feedback0http://www.aygfsteel.com/TiGERTiAN/comments/commentRss/332475.htmlhttp://www.aygfsteel.com/TiGERTiAN/services/trackbacks/332475.html

Ubuntu9.10默認安裝的純凈系統,沒裝任何其他軟件。

  1.下載源碼android-2.1_r2,直接make

  2.出錯及解決如下:

  (1)/bin/bash: bison: command not found

  解決:a@ubuntu:~/work/android-2.1_r2$ sudo apt-get install bison

  (2)make: *** No rule to make target `Please-install-JDK-5.0,-update-12-or-higher,-which-you-can-download-from-java.sun.com',

  needed by `out/target/common/docs/api-stubs-timestamp'. Stop.

  解決:安裝JDK 5.0

  1):根據官方文檔里所說,源代碼的編譯必須使用JDK5才能編譯的了,所以這里我們使用jdk5

  2): 需要先更新源,在終端里執行 sudo vim /etc/apt/sources.list

  3): 在source.list里把以下2行拷貝到文檔最后面:

  deb http://us.archive.ubuntu.com/ubuntu/ jaunty multiverse

  deb http://us.archive.ubuntu.com/ubuntu/ jaunty-updates multiverse

  保存退出。

  4): 執行 sudo apt-get update 更新源.

  5): 配置編譯環境并下載JDK5:sudo apt-get install sun-java5-jdk

  (3)/bin/bash: g++: command not found

  make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libhost_intermediates/pseudolocalize.o] Error 127

  解決:a@ubuntu:~/work/android-2.1_r2$ sudo apt-get install build-essential

  (4)external/clearsilver/cgi/cgi.c:22:18: error: zlib.h: No such file or directory

  external/clearsilver/cgi/cgi.c: In function ‘cgi_compress’:

  external/clearsilver/cgi/cgi.c:885: error: ‘z_stream’ undeclared (first use in this function)

  external/clearsilver/cgi/cgi.c:885: error: (Each undeclared identifier is reported only once

  external/clearsilver/cgi/cgi.c:885: error: for each function it appears in.)

  external/clearsilver/cgi/cgi.c:885: error: expected ‘;’ before ‘stream’

  external/clearsilver/cgi/cgi.c:888: error: ‘stream’ undeclared (first use in this function)

  external/clearsilver/cgi/cgi.c:888: error: ‘Bytef’ undeclared (first use in 

this function)

  external/clearsilver/cgi/cgi.c:888: error: expected expression before ‘)’ token

  external/clearsilver/cgi/cgi.c:889: error: ‘uInt’ undeclared (first use in this function)

  external/clearsilver/cgi/cgi.c:889: error: expected ‘;’ before ‘str’

  external/clearsilver/cgi/cgi.c:890: error: expected expression before ‘)’ token

  external/clearsilver/cgi/cgi.c:892: error: ‘uLong’ undeclared (first use in this function)

  external/clearsilver/cgi/cgi.c:892: error: expected ‘)’ before ‘stream’

  external/clearsilver/cgi/cgi.c:895: error: ‘alloc_func’ undeclared (first use in this function)

  external/clearsilver/cgi/cgi.c:895: error: expected ‘;’ before numeric constant

  external/clearsilver/cgi/cgi.c:896: error: ‘free_func’ undeclared (first use in this function)

  external/clearsilver/cgi/cgi.c:896: error: expected ‘;’ before numeric constant

  external/clearsilver/cgi/cgi.c:897: error: ‘voidpf’ undeclared (first use in this function)

  external/clearsilver/cgi/cgi.c:897: error: expected ‘;’ before numeric constant

  external/clearsilver/cgi/cgi.c:900: error: ‘Z_DEFAULT_COMPRESSION’ undeclared (first use in this function)

  external/clearsilver/cgi/cgi.c:900: error: ‘Z_DEFLATED’ undeclared (first use in this function)

  external/clearsilver/cgi/cgi.c:900: error: ‘MAX_WBITS’ undeclared (first use in this function)

  external/clearsilver/cgi/cgi.c:900: error: ‘Z_DEFAULT_STRATEGY’ undeclared (first use in this function)

  external/clearsilver/cgi/cgi.c:901: error: ‘Z_OK’ undeclared (first use in this function)

  external/clearsilver/cgi/cgi.c:904: error: ‘Z_FINISH’ undeclared (first use in this function)

  external/clearsilver/cgi/cgi.c:905: error: ‘Z_STREAM_END’ undeclared (first use in this function) external/clearsilver/cgi/cgi.c: In function ‘cgi_output’:

  external/clearsilver/cgi/cgi.c:1200: error: ‘Z_NULL’ undeclared (first use in this function)

  external/clearsilver/cgi/cgi.c:1201: error: expected ‘)’ before ‘Bytef’

  external/clearsilver/cgi/cgi.c:1218: error: ‘Z_DEFLATED’ undeclared (first use in this function)

  make: *** [out/host/linux-x86/obj/SHARED_LIBRARIES/libneo_cgi_intermediates/cgi.o] Error 1

  解決:a@ubuntu:~/work/android-2.1_r2$ sudo apt-get install zlib1g-dev

  (5)/bin/bash: flex: command not found

  make: *** [out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_l.cpp] Error 127

  解決:a@ubuntu:~/work/android-2.1_r2$ sudo apt-get install flex

  (6)/usr/bin/ld: cannot find -lncurses

  collect2: ld returned 1 exit status

  make: *** [out/host/linux-x86/obj/EXECUTABLES/adb_intermediates/adb] Error 1

  解決:a@ubuntu:~/work/android-2.1_r2$ sudo apt-get install libncurses-dev

  (7)prebuilt/linux-x86/sdl/include/SDL/SDL_syswm.h:55:22: error: X11/Xlib.h: No such file or directory

  prebuilt/linux-x86/sdl/include/SDL/SDL_syswm.h:56:23: error: X11/Xatom.h: No such file or directory

  In file included from external/qemu/android/skin/window.c:19:

  prebuilt/linux-x86/sdl/include/SDL/SDL_syswm.h:73: error: expected specifier-qualifier-list before ‘XEvent’

  prebuilt/linux-x86/sdl/include/SDL/SDL_syswm.h:86: error: expected specifier-qualifier-list before ‘Display’

  make: *** [out/host/linux-x86/obj/EXECUTABLES/emulator_intermediates/android/skin/window.o] Error 1

  解決:a@ubuntu:~/work/android-2.1_r2$ sudo apt-get install libx11-dev

  (8)sh: gperf: not found

  calling gperf failed: 32512 at ./makeprop.pl line 96.

  make: *** [out/target/product/generic/obj/STATIC_LIBRARIES/libwebcore_intermediates/WebCore/css/CSSPropertyNames.h] Error 25

  make: *** Deleting file `out/target/product/generic/obj/STATIC_LIBRARIES/libwebcore_intermediates/WebCore/css/CSSPropertyNames.h'

  解決:a@ubuntu:~/work/android-2.1_r2$ sudo apt-get install gperf

  http://hi.baidu.com/maxgoto/blog/item/fa000f7bf01135f80ad187d8.html 最近下載了Android 2.1源碼,在Ubuntu 9.10上做了一次編譯,由于系統為純凈系統,之前沒有進行過任何Android的編譯,所以需先安裝一些必要軟件。編譯過程參考網上一些文章,做下筆記如下,以供參考:

1. 下載或更新Android源碼 至最新,截止到前天(04-09)好像是2.1-r2.

2. Android 要求的 jdk 1.5,而Ubuntu9.10的源里只有JDK1.6. 目前網上解決方法有兩種:
    解決方法一: 安裝JDK1.5
   1) 根據官方文檔里所說,源代碼的編譯必須使用JDK5才能編譯的了,所以這里我們使用jdk5
   2) 需要先更新源,在終端里執行 sudo vim /etc/apt/sources.list
   3) 在source.list里把以下2行拷貝到文檔最后面:
        deb http://us.archive.ubuntu.com/ubuntu/ jaunty multiverse
        deb http://us.archive.ubuntu.com/ubuntu/ jaunty-updates multiverse
        保存退出。
   4) 執行 sudo apt-get update 更新源.
   5)配置編譯環境并下載JDK5:sudo apt-get install sun-java5-jdk

   解決方法二: 安裝JDK 1.6 , 修改Android源文件。
   1) 安裝jdk 1.6,修改<src_top/build/core/make.mk>(如果2.0版本源碼請修改<src_top/build/core/main.mk>)
    在文件中搜索并分別把:
        java_version := $(shell java -version 2>&1 | head -n 1 | grep '[ "]1.5[. "$$]')
        javac_version := $(shell javac -version 2>&1 | head -n 1 | grep '[ "]1.5[. "$$]')
    兩行改成:
        java_version := $(shell java -version 2>&1 | head -n 1 | grep '[ "]1.6[. "$$]')
        javac_version := $(shell javac -version 2>&1 | head -n 1 | grep '[ "]1.6[. "$$]')
    即可。
   推薦使用第一種解決方法。

3. 安裝編譯過程中必需軟件 。根據網上高人的經驗,這是編譯的最小工具軟件集。
    $sudo apt-get install build-essential
    $sudo apt-get install zlib1g-dev
    $sudo apt-get install flex
    $sudo apt-get install libncurses-dev
    $sudo apt-get install libx11-dev
    $sudo apt-get install gperf

4. make .經過漫長的編譯過程,編譯成功。



TiGERTiAN 2010-09-19 20:55 發表評論
]]>
Please increase the size of APT::Cache-Limit問題的解決方法http://www.aygfsteel.com/TiGERTiAN/archive/2010/09/17/332246.htmlTiGERTiANTiGERTiANFri, 17 Sep 2010 00:22:00 GMThttp://www.aygfsteel.com/TiGERTiAN/archive/2010/09/17/332246.htmlhttp://www.aygfsteel.com/TiGERTiAN/comments/332246.htmlhttp://www.aygfsteel.com/TiGERTiAN/archive/2010/09/17/332246.html#Feedback0http://www.aygfsteel.com/TiGERTiAN/comments/commentRss/332246.htmlhttp://www.aygfsteel.com/TiGERTiAN/services/trackbacks/332246.html/etc/apt/apt.conf.d/70debconf
加入
APT::Cache-Limit "33554432";或者更大的空間數值
保存
執行sudo apt-get autoclean
執行sudo apt-get update即可


TiGERTiAN 2010-09-17 08:22 發表評論
]]>
編譯Android源碼http://www.aygfsteel.com/TiGERTiAN/archive/2010/05/30/322292.htmlTiGERTiANTiGERTiANSun, 30 May 2010 09:33:00 GMThttp://www.aygfsteel.com/TiGERTiAN/archive/2010/05/30/322292.htmlhttp://www.aygfsteel.com/TiGERTiAN/comments/322292.htmlhttp://www.aygfsteel.com/TiGERTiAN/archive/2010/05/30/322292.html#Feedback0http://www.aygfsteel.com/TiGERTiAN/comments/commentRss/322292.htmlhttp://www.aygfsteel.com/TiGERTiAN/services/trackbacks/322292.html閱讀全文

TiGERTiAN 2010-05-30 17:33 發表評論
]]>
Ubuntu添加源和安裝Javahttp://www.aygfsteel.com/TiGERTiAN/archive/2010/05/30/322286.htmlTiGERTiANTiGERTiANSun, 30 May 2010 09:08:00 GMThttp://www.aygfsteel.com/TiGERTiAN/archive/2010/05/30/322286.htmlhttp://www.aygfsteel.com/TiGERTiAN/comments/322286.htmlhttp://www.aygfsteel.com/TiGERTiAN/archive/2010/05/30/322286.html#Feedback0http://www.aygfsteel.com/TiGERTiAN/comments/commentRss/322286.htmlhttp://www.aygfsteel.com/TiGERTiAN/services/trackbacks/322286.html 1. 添加下面的語句到文件中,保存即可添加apt-get源了
deb http://run.hit.edu.cn/ubuntu/ jaunty main restricted universe multiverse
deb-src http://run.hit.edu.cn/ubuntu/ jaunty main restricted universe multiverse
deb http://run.hit.edu.cn/ubuntu/ jaunty-updates main restricted universe multiverse
deb-src http://run.hit.edu.cn/ubuntu/ jaunty-updates main restricted universe multiverse
deb http://run.hit.edu.cn/ubuntu/ jaunty-backports main restricted universe multiverse
deb-src http://run.hit.edu.cn/ubuntu/ jaunty-backports main restricted universe multiverse
deb http://run.hit.edu.cn/ubuntu/ jaunty-security main restricted universe multiverse
deb-src http://run.hit.edu.cn/ubuntu/ jaunty-security main restricted universe multiverse

deb http://mirror.optus.net/ubuntu/ jaunty main restricted universe multiverse
deb http://mirror.optus.net/ubuntu/ jaunty-security main restricted universe multiverse
deb http://mirror.optus.net/ubuntu/ jaunty-updates main restricted universe multiverse
deb http://mirror.optus.net/ubuntu/ jaunty-proposed main restricted universe multiverse
deb http://mirror.optus.net/ubuntu/ jaunty-backports main restricted universe multiverse
deb-src http://mirror.optus.net/ubuntu/ jaunty main restricted universe multiverse
deb-src http://mirror.optus.net/ubuntu/ jaunty-security main restricted universe multiverse
deb-src http://mirror.optus.net/ubuntu/ jaunty-updates main restricted universe multiverse
deb-src http://mirror.optus.net/ubuntu/ jaunty-proposed main restricted universe multiverse
deb-src http://mirror.optus.net/ubuntu/ jaunty-backports main restricted universe multiverse

2. 切換到9.04的源

sudo apt-get update

3. update之后,用

sudo apt-get install sun-java5-jdk 即可安裝java 1.5


4. 安裝后進行設置:

sudo update-alternatives --config java

sudo update-java-alternatives -s java-1.5.0-sun


TiGERTiAN 2010-05-30 17:08 發表評論
]]>
Linux下制作Java的Daemon服務程序(系統服務程序)http://www.aygfsteel.com/TiGERTiAN/archive/2010/01/19/310037.htmlTiGERTiANTiGERTiANTue, 19 Jan 2010 02:16:00 GMThttp://www.aygfsteel.com/TiGERTiAN/archive/2010/01/19/310037.htmlhttp://www.aygfsteel.com/TiGERTiAN/comments/310037.htmlhttp://www.aygfsteel.com/TiGERTiAN/archive/2010/01/19/310037.html#Feedback4http://www.aygfsteel.com/TiGERTiAN/comments/commentRss/310037.htmlhttp://www.aygfsteel.com/TiGERTiAN/services/trackbacks/310037.htmlhttp://wrapper.tanukisoftware.org/doc/english/introduction.html),該工具能在很多中平臺下面注冊為系統服務(查看支持平臺)。該工具使用方法有三種模式,我用的是第一種WrapperSimpleApp幫助類,另外的兩種方式都需要在原來的程序上進行適當的編碼。下面就用我的程序ss為例子說明下大概的配置步驟。(其實文檔中已經用Jboss進行了演示)

1.將Wrapper壓縮包中的bin,lib,conf,logs目錄拷貝到新建的目錄ss中,將我們的程序打包成jar和依賴包一起放入lib中。

2.將bin目錄中的testwrapper改成應用名ss,并編輯,修改下面兩項:
APP_NAME="SocketServer"
APP_LONG_NAME="SocketServer Application"

3.修改conf/wrapper.conf文件:

#wrapper的主類
wrapper
.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp

#java classpath

wrapper
.java.classpath.1=../lib/wrapper.jar
wrapper
.java.classpath.6=../lib/ss.jar

#你應用的入口
#注意如果參數不是1,是2,經過測試發現,用這種方式,入口如果賦值給參數1,則不起作用

wrapper.app.parameter.2=com.test.ss.Main
#你應用自帶的一些參數
wrapper.app.parameter.3=29999

4.這樣基本上就可以了,上傳到服務器上,進入bin目錄,執行./ss start,如果沒有權限,則執行chmod a+x *即可



TiGERTiAN 2010-01-19 10:16 發表評論
]]>
Linux下Openssh的配置http://www.aygfsteel.com/TiGERTiAN/archive/2010/01/19/310034.htmlTiGERTiANTiGERTiANTue, 19 Jan 2010 01:53:00 GMThttp://www.aygfsteel.com/TiGERTiAN/archive/2010/01/19/310034.htmlhttp://www.aygfsteel.com/TiGERTiAN/comments/310034.htmlhttp://www.aygfsteel.com/TiGERTiAN/archive/2010/01/19/310034.html#Feedback0http://www.aygfsteel.com/TiGERTiAN/comments/commentRss/310034.htmlhttp://www.aygfsteel.com/TiGERTiAN/services/trackbacks/310034.html安裝和設置 OpenSSH Server

Ubuntu 下安裝 OpenSSH Server 是無比輕松的一件事情,需要的命令只有一條:

sudo apt-get install openssh-server

隨后,Ubuntu 會自動下載并安裝 openssh server,并一并解決所有的依賴關系。當您完成這一操作后,您可以找另一臺計算機,然后使用一個 SSH 客戶端軟件(強烈推薦 PuTTy),輸入您服務器的 IP 地址。如果一切正常的話,等一會兒就可以連接上了。并且使用現有的用戶名和密碼應該就可以登錄了。

事實上如果沒什么特別需求,到這里 OpenSSH Server 就算安裝好了。但是進一步設置一下,可以讓 OpenSSH 登錄時間更短,并且更加安全。這一切都是通過修改 openssh 的配置文件 sshd_config 實現的。

首先,您剛才實驗遠程登錄的時候可能會發現,在輸入完用戶名后需要等很長一段時間才會提示輸入密碼。其實這是由于 sshd 需要反查客戶端的 dns 信息導致的。我們可以通過禁用這個特性來大幅提高登錄的速度。首先,打開 sshd_config 文件:

sudo nano /etc/ssh/sshd_config

找到 GSSAPI options 這一節,將下面兩行注釋掉:

#GSSAPIAuthentication yes
#GSSAPIDelegateCredentials no

然后重新啟動 ssh 服務即可:

sudo /etc/init.d/ssh restart

再登錄試試,應該非常快了吧 :)

利用 PuTTy 通過證書認證登錄服務器

SSH 服務中,所有的內容都是加密傳輸的,安全性基本有保證。但是如果能使用證書認證的話,安全性將會更上一層樓,而且經過一定的設置,還能實現證書認證自動登錄的效果。

首先修改 sshd_config 文件,開啟證書認證選項:

RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile %h/.ssh/authorized_keys

修改完成后重新啟動 ssh 服務。

下一步我們需要為 SSH 用戶建立私鑰和公鑰。首先要登錄到需要建立密鑰的賬戶下,這里注意退出 root 用戶,需要的話用 su 命令切換到其它用戶下。然后運行:

ssh-keygen

這里,我們將生成的 key 存放在默認目錄下即可。建立的過程中會提示輸入 passphrase,這相當于給證書加個密碼,也是提高安全性的措施,這樣即使證書不小心被人拷走也不怕了。當然如果這個留空的話,后面即可實現 PuTTy 通過證書認證的自動登錄。

ssh-keygen 命令會生成兩個密鑰,首先我們需要將公鑰改名留在服務器上:

cd ~/.ssh
mv id_rsa.pub authorized_keys

然后將私鑰 id_rsa 從服務器上復制出來,并刪除掉服務器上的 id_rsa 文件。

服務器上的設置就做完了,下面的步驟需要在客戶端電腦上來做。首先,我們需要將 id_rsa 文件轉化為 PuTTy 支持的格式。這里我們需要利用 PuTTyGEN 這個工具:

點擊 PuTTyGen 界面中的 Load 按鈕,選擇 id_rsa 文件,輸入 passphrase(如果有的話),然后再點擊 Save PrivateKey 按鈕,這樣 PuTTy 接受的私鑰就做好了。

打開 PuTTy,在 Session 中輸入服務器的 IP 地址,在 Connection->SSH->Auth 下點擊 Browse 按鈕,選擇剛才生成好的私鑰。然后回到 Connection 選項,在 Auto-login username 中輸入證書所屬的用戶名。回到 Session 選項卡,輸入個名字點 Save 保存下這個 Session。點擊底部的 Open 應該就可以通過證書認證登錄到服務器了。如果有 passphrase 的話,登錄過程中會要求輸入 passphrase,否則將會直接登錄到服務器上,非常的方便。

好了,今天就寫到這,以后逐步再寫 AMP,Proftpd 和 Squid 的安裝和設置。



TiGERTiAN 2010-01-19 09:53 發表評論
]]>
主站蜘蛛池模板: 彭阳县| 大荔县| 永安市| 延长县| 衡山县| 双桥区| 呼玛县| 英吉沙县| 巫山县| 凤阳县| 黄梅县| 区。| 彰化县| 嘉义市| 尼勒克县| 南通市| 武夷山市| 万安县| 孙吴县| 鸡东县| 科技| 基隆市| 灵山县| 陆河县| 寿阳县| 盐池县| 岑溪市| 收藏| 万州区| 灌云县| 曲水县| 金坛市| 新丰县| 朝阳区| 奉贤区| 上林县| 双桥区| 思茅市| 宣城市| 焦作市| 章丘市|