Calvin's Tech Space

          成于堅忍,毀于浮躁

             :: 首頁 :: 聯系 :: 聚合  :: 管理
          The good thing about building manually your apk is that you don’t have to name your resources directory to res, you can name it anything you want.

          You can find ant scripts in: \platforms\android-1.5\templates\android-rules.xml

          Step 1: Generate Resource java code and packaged Resources
          aapt package -f -M ${manifest.file} -F ${packaged.resource.file} -I ${path.to.android-jar.library} -S ${android-resource-directory} [-m -J ${folder.to.output.the.R.java}]

          Step 2: Compile java source codes + R.java
          use javac

          Step 3: Convert classes to Dalvik bytecodes
          use dx.bat
          dx.bat –dex –output=${output.dex.file} ${compiled.classes.directory} ${jar files..}

          Step 4: Create unsigned APK
          use apkbuilder

          apkbuilder ${output.apk.file} -u -z ${packagedresource.file} -f ${dex.file}

          or

          apkbuilder ${output.apk.file} -u -z ${packagedresource.file} -f ${dex.file} -rf ${source.dir} -rj ${libraries.dir}

          -rf = resources required for compiled source files?
          -rj = resources required for jar files

          Step 6: Generate a key
          use keytool

          Step 7: Sign APK
          use jarsigner

          jarsigner -keystore ${keystore} -storepass ${keystore.password} -keypass ${keypass} -signedjar ${signed.apkfile} ${unsigned.apkfile} ${keyalias}

          Step 8: Publish
          use adb
          adb -d install -r ${signed.apk}

          Inspecting your APK file:

          aapt list -v latest.apk

          Open questions:
          1. Can you include more than one dex file in the apk?
          2. Can you have dex file named other than classes.dex in the apk?
          3. Does an apk have to have a packaged resource?

          Note: If upon installing your app using adb you see this error code FAILED_INSTALL_DEXOPT then most likely that either you don’t have classes.dex or you don’t have a packaged resource in the apkBuild process


          http://asantoso.wordpress.com/2009/09/15/how-to-build-android-application-package-apk-from-the-command-line-using-the-sdk-tools-continuously-integrated-using-cruisecontrol/
          posted on 2010-09-15 16:33 calvin 閱讀(977) 評論(1)  編輯  收藏 所屬分類: Android

          Feedback

          # re: 使用ant編譯android工程[未登錄] 2010-10-19 10:47 haha
          拽什么拽,英文寫的這么爛還不如用中文寫,崇洋媚外。  回復  更多評論
            

          主站蜘蛛池模板: 天气| 绥阳县| 滨州市| 中西区| 鄄城县| 涟源市| 台东市| 辰溪县| 左权县| 兰溪市| 永新县| 德昌县| 丰都县| 屏东市| 宽城| 夏河县| 伊宁县| 托里县| 高陵县| 元谋县| 宁南县| 巴东县| 乐陵市| 大名县| 甘谷县| 武汉市| 桐城市| 新疆| 东方市| 大悟县| 乡宁县| 越西县| 巴彦淖尔市| 大庆市| 九龙坡区| 武乡县| 潜江市| 绥阳县| 陕西省| 波密县| 甘德县|