Calvin's Tech Space

          成于堅(jiān)忍,毀于浮躁

             :: 首頁 :: 聯(lián)系 :: 聚合  :: 管理
          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) 評(píng)論(1)  編輯  收藏 所屬分類: Android

          Feedback

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

          主站蜘蛛池模板: 舒城县| 商洛市| 永登县| 建瓯市| 安福县| 黔东| 广州市| 榆中县| 拜泉县| 保靖县| 曲靖市| 新巴尔虎左旗| 南京市| 张家界市| 广元市| 通海县| 田东县| 赣州市| 禹城市| 望江县| 巴林左旗| 德安县| 巨鹿县| 航空| 金沙县| 鹰潭市| 唐海县| 景谷| 麻江县| 灯塔市| 阳江市| 三明市| 奉贤区| 钦州市| 迁西县| 邹平县| 定安县| 屏山县| 阿拉善右旗| 竹北市| 朔州市|