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

          主站蜘蛛池模板: 噶尔县| 宁明县| 广丰县| 海口市| 修水县| 丰宁| 浦城县| 崇信县| 吴江市| 保靖县| 磴口县| 赤峰市| 孝义市| 古交市| 佛学| 莲花县| 万年县| 通河县| 北安市| 高唐县| 灵寿县| 兴文县| 松阳县| 阜南县| 禹州市| 靖江市| 石楼县| 百色市| 萍乡市| 九龙县| 朝阳市| 竹山县| 泊头市| 忻城县| 元谋县| 罗城| 广昌县| 中山市| 云浮市| 习水县| 浪卡子县|