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 閱讀(976) 評論(1)  編輯  收藏 所屬分類: Android

          Feedback

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

          主站蜘蛛池模板: 肃宁县| 湄潭县| 松潘县| 保定市| 沁水县| 潍坊市| 墨竹工卡县| 阜城县| 东乌珠穆沁旗| 开远市| 格尔木市| 正镶白旗| 黄骅市| 光泽县| 扎兰屯市| 鄂温| 邛崃市| 法库县| 永平县| 故城县| 荔浦县| 襄垣县| 新蔡县| 耿马| 嘉善县| 金阳县| 清河县| 旌德县| 噶尔县| 都安| 阿鲁科尔沁旗| 咸宁市| 兰州市| 和静县| 新巴尔虎右旗| 芜湖县| 方正县| 崇明县| 台北市| 天水市| 珠海市|