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
          拽什么拽,英文寫的這么爛還不如用中文寫,崇洋媚外。  回復  更多評論
            

          主站蜘蛛池模板: 凤城市| 湘乡市| 长宁县| 精河县| 宁化县| 晋宁县| 肥西县| 祥云县| 阿城市| 达州市| 望城县| 搜索| 辽宁省| 安阳市| 银川市| 沙河市| 义乌市| 彭山县| 德格县| 通辽市| 常熟市| 武城县| 舟山市| 顺平县| 大名县| 巧家县| 德化县| 大理市| 二连浩特市| 九江县| 罗甸县| 嘉兴市| 楚雄市| 武安市| 旬邑县| 澄城县| 长阳| 响水县| 得荣县| 江门市| 双江|