posted by Solver Full-stack Developer 2011.06.13 17:55
참고 사진 출처: http://asantoso.wordpress.com



Step 1. Generate R.java

cd c:\\android\androidsdk\platform-tools
aapt package -m -J "C:\Android\Workspace\ProjectName\gen" -M "C:\Android\Workspace\ProjectName\AndroidManifest.xml" -S "C:\Android\Workspace\ProjectName\res" -j "C:\Android\Workspace\ProjectName\libs" -I "C:\Android\AndroidSDK\platforms\android-7\android.jar"

Step 2. Compile src&R.java
 
cd C:\Program Files\Java\jdk1.6.0_23\bin
 
javac -d "C:\Android\Workspace\ProjectName\bin" -classpath "C:\Android\Workspace\ProjectName\bin" -bootclasspath "C:\Android\AndroidSDK\platforms\android-7\android.jar" "C:\Android\Workspace\ProjectName\gen\com\Company\PackageName1\R.java"
javac -d "C:\Android\Workspace\ProjectName\bin" -classpath "C:\Android\Workspace\ProjectName\bin" -bootclasspath "C:\Android\AndroidSDK\platforms\android-7\android.jar" "C:\Android\Workspace\ProjectName\src\com\Company\PackageName1\PackageName2\C1.java" -cp "C:\Android\Workspace\ProjectName\libs\JarName.jar"
javac -d "C:\Android\Workspace\ProjectName\bin" -classpath "C:\Android\Workspace\ProjectName\bin" -bootclasspath "C:\Android\AndroidSDK\platforms\android-7\android.jar" "C:\Android\Workspace\ProjectName\src\com\Company\PackageName1\PackageName2\C2.java"
javac -d "C:\Android\Workspace\ProjectName\bin" -classpath "C:\Android\Workspace\ProjectName\bin" -bootclasspath "C:\Android\AndroidSDK\platforms\android-7\android.jar" "C:\Android\Workspace\ProjectName\src\com\Company\PackageName1\PackageName2\C3.java"
javac -d "C:\Android\Workspace\ProjectName\bin" -classpath "C:\Android\Workspace\ProjectName\bin" -bootclasspath "C:\Android\AndroidSDK\platforms\android-7\android.jar" "C:\Android\Workspace\ProjectName\src\com\Company\PackageName1\C4.java"
javac -d "C:\Android\Workspace\ProjectName\bin" -classpath "C:\Android\Workspace\ProjectName\bin" -bootclasspath "C:\Android\AndroidSDK\platforms\android-7\android.jar" "C:\Android\Workspace\ProjectName\src\com\Company\PackageName1\C5.java"
javac -d "C:\Android\Workspace\ProjectName\bin" -classpath "C:\Android\Workspace\ProjectName\bin" -bootclasspath "C:\Android\AndroidSDK\platforms\android-7\android.jar" "C:\Android\Workspace\ProjectName\src\com\Company\PackageName1\C6.java"
javac -d "C:\Android\Workspace\ProjectName\bin" -classpath "C:\Android\Workspace\ProjectName\bin" -bootclasspath "C:\Android\AndroidSDK\platforms\android-7\android.jar" "C:\Android\Workspace\ProjectName\src\com\Company\PackageName1\C7.java"
javac -d "C:\Android\Workspace\ProjectName\bin" -classpath "C:\Android\Workspace\ProjectName\bin" -bootclasspath "C:\Android\AndroidSDK\platforms\android-7\android.jar" "C:\Android\Workspace\ProjectName\src\com\Company\PackageName1\C8.java"
javac -d "C:\Android\Workspace\ProjectName\bin" -classpath "C:\Android\Workspace\ProjectName\bin" -bootclasspath "C:\Android\AndroidSDK\platforms\android-7\android.jar" "C:\Android\Workspace\ProjectName\src\com\Company\PackageName1\I9.java"
javac -d "C:\Android\Workspace\ProjectName\bin" -classpath "C:\Android\Workspace\ProjectName\bin" -bootclasspath "C:\Android\AndroidSDK\platforms\android-7\android.jar" "C:\Android\Workspace\ProjectName\src\com\Company\PackageName1\C10.java"
javac -d "C:\Android\Workspace\ProjectName\bin" -classpath "C:\Android\Workspace\ProjectName\bin" -bootclasspath "C:\Android\AndroidSDK\platforms\android-7\android.jar" "C:\Android\Workspace\ProjectName\src\com\Company\PackageName1\C11.java"
javac -d "C:\Android\Workspace\ProjectName\bin" -classpath "C:\Android\Workspace\ProjectName\bin" -bootclasspath "C:\Android\AndroidSDK\platforms\android-7\android.jar" "C:\Android\Workspace\ProjectName\src\com\Company\PackageName1\UI12.java"
javac -d "C:\Android\Workspace\ProjectName\bin" -classpath "C:\Android\Workspace\ProjectName\bin" -bootclasspath "C:\Android\AndroidSDK\platforms\android-7\android.jar" "C:\Android\Workspace\ProjectName\src\com\Company\PackageName1\UI13.java"
javac -d "C:\Android\Workspace\ProjectName\bin" -classpath "C:\Android\Workspace\ProjectName\bin" -bootclasspath "C:\Android\AndroidSDK\platforms\android-7\android.jar" "C:\Android\Workspace\ProjectName\src\com\Company\PackageName1\UI14.java" -deprecation "C:\Android\Workspace\ProjectName\src\com\Company\PackageName1\UI141.java" "C:\Android\Workspace\ProjectName\src\com\Company\PackageName1\UI142.java"
javac -d "C:\Android\Workspace\ProjectName\bin" -classpath "C:\Android\Workspace\ProjectName\bin" -bootclasspath "C:\Android\AndroidSDK\platforms\android-7\android.jar" "C:\Android\Workspace\ProjectName\src\com\Company\PackageName1\UI15.java" 
javac -d "C:\Android\Workspace\ProjectName\bin" -classpath "C:\Android\Workspace\ProjectName\bin" -bootclasspath "C:\Android\AndroidSDK\platforms\android-7\android.jar" "C:\Android\Workspace\ProjectName\src\com\Company\PackageName1\UI16.java"  
javac -d "C:\Android\Workspace\ProjectName\bin" -classpath "C:\Android\Workspace\ProjectName\bin" -bootclasspath "C:\Android\AndroidSDK\platforms\android-7\android.jar" "C:\Android\Workspace\ProjectName\src\com\Company\PackageName1\PackageName2\UI17.java"
javac -d "C:\Android\Workspace\ProjectName\bin" -classpath "C:\Android\Workspace\ProjectName\bin" -bootclasspath "C:\Android\AndroidSDK\platforms\android-7\android.jar" "C:\Android\Workspace\ProjectName\src\com\Company\PackageName1\PackageName2\UI18.java"
javac -d "C:\Android\Workspace\ProjectName\bin" -classpath "C:\Android\Workspace\ProjectName\bin" -bootclasspath "C:\Android\AndroidSDK\platforms\android-7\android.jar" "C:\Android\Workspace\ProjectName\src\com\Company\PackageName1\PackageNa

Step 3. Convert classes to Dalvik bytecodes

cd C:\Android\AndroidSDK\tools
dx --dex --output="C:\Android\Workspace\ProjectName\bin\classes.dex" --positions=lines C:\Android\Workspace\ProjectName\bin\

Step 4. Create unsigned APK

cd C:\Android\AndroidSDK\tools
aapt package -f -M "C:\Android\Workspace\ProjectName\AndroidManifest.xml" -S "C:\Android\Workspace\ProjectName\res" -j "C:\Android\Workspace\ProjectName\libs\JarName.jar" -A "C:\Android\Workspace\ProjectName\assets" -I "C:\Android\AndroidSDK\platforms\android-7\android.jar" -F "C:\Android\Workspace\ProjectName\bin\ProjectName.apk"

apkbuilder "C:\Android\Workspace\ProjectName\bin\ProjectName-debug.apk" -z "C:\Android\Workspace\ProjectName\bin\ProjectName.apk" -f "C:\Android\Workspace\ProjectName\bin\classes.dex" -rf "C:\Android\Workspace\ProjectName\src" -rj "C:\Android\Workspace\ProjectName\libs\JarName.jar"

Step 6. Generate a key
 
use key tool or use eclipe -> u r project Rclick -> AndroidTools -> export signed apk

Step 7. Sign APK

cd C:\Android\AndroidSDK\tools
jarsigner -keystore "C:\Android\ProjectName_key.key" -storepass "Password" -keypass "Password" -signedjar "C:\Android\APK\ProjectName_v1.0.apk" "C:\Android\Workspace\ProjectName\bin\ProjectName.apk" "Key-Alias"

예제 디렉토리 이미지 

설명:
음... 쿨하게 다 오픈하고싶지만... 어쩔수없네요... 자동배포를 위해 테스트한거였구요.

우선 리소스를 R.java로 만들고

javac로 R.java와 소스코드들 compile해준다. compile시 include관계 잘봐가면서 해줘야한다. 외부에서 끌어다 사용하는 jar있으면 표시해줘야 한다.

compile된 class파일들을 Dalvik으로 JVM용으로 변환 해준다.

aapt(Android Asset Packaging tool)을 이용하여 apk 만들고

apkbuilder로 unsigned apk를 만든다.

키는 keystore에서 만들거나 eclipe에서 제공하는 android tool을 사용한다 플젝 우클릭 안드 툴 익소포트 사인드 @#@가면 있다. 위에 명시해두었다...

마지막으로 unsigned apk와 key를 사용하여 배포한다.

 
신고