• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            隨筆 - 132  文章 - 51  trackbacks - 0
            <2011年7月>
            262728293012
            3456789
            10111213141516
            17181920212223
            24252627282930
            31123456

            常用鏈接

            留言簿(7)

            隨筆分類

            隨筆檔案

            文章分類

            文章檔案

            cocos2d-x

            OGRE

            OPenGL

            搜索

            •  

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜

            Signing in Release Mode


            When your application is ready for release to other users, you must:

            1. Obtain a suitable private key
            2. Compile the application in release mode
            3. Sign your application with your private key
            4. Align the final APK package
            發(fā)布release版本要有4步
            官方說明: 
             http://developer.android.com/tools/publishing/app-signing.html#releasecompile 


            平時(shí)通過Eclipse生成在bin目錄下的apk文件,都是debug版的,如何創(chuàng)建release版的軟件呢? 
            其實(shí)還是挺簡(jiǎn)單的。 

            1. 通過java自帶的keytool工具,創(chuàng)建release版的keystore 

            keytool -genkey -v -keystore keystore_name.keystore -alias alias_name -keyalg RSA -validity 10000 


            keystore_name.keystore:要?jiǎng)?chuàng)建的release版keystore的文件名 
            alias_name:別名?取個(gè)好記點(diǎn)的名字吧,后面還要用到的 (填寫配置文件)
            -keyalg RSA:通過RSA算法生成 
            -validity 10000:有效期,單位是天 

            如果java環(huán)境配置正常,輸入命令后會(huì)出現(xiàn)下列信息 
            Enter keystore password:(keystore的密碼) 
            Re-enter new password:(確認(rèn)keystore的密碼) 
            What is your first and last name? 
              [Unknown]:  (姓名,用自己喜歡的名字吧,不知道會(huì)顯示在哪里) 
            What is the name of your organizational unit? 
              [Unknown]:  (組織單位) 
            What is the name of your organization? 
              [Unknown]:  (組織,不知道和上面那個(gè)有什么區(qū)別) 
            What is the name of your City or Locality? 
              [Unknown]:  (城市) 
            What is the name of your State or Province? 
              [Unknown]:  (州,省,縣) 
            What is the two-letter country code for this unit? 
              [Unknown]:  CN 
            Is CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=CN correct? 
              [no]:  yes (確認(rèn)輸入的信息) 

            Generating 1,024 bit RSA key pair and self-signed certificate (SHA1withRSA) with 
            a validity of 10,000 days 
                    for: CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=CN 
            Enter key password for <alias_name> 
                    (RETURN if same as keystore password):(alias的密碼,如果和keytore密碼一致,直接回車) 
            Re-enter new password:(確認(rèn)alias的密碼) 
            [Storing my-release-key.keystore] 


            2.發(fā)布Release版本
            Signing in Release Mode


            When your application is ready for release to other users, you must:

            1. Obtain a suitable private key
            2. Compile the application in release mode
            3. Sign your application with your private key
            4. Align the final APK package
            官方的步驟有4步,編譯release版本的應(yīng)用程序

            2.1 Eclipse導(dǎo)出
            在Eclipse中,右鍵要發(fā)布的項(xiàng)目,依次選擇Android Tool -> Export Signed Application Package... 
            然后就是step-by-step了,選擇剛才生成的release版keystore,輸入密碼,選擇alias,輸入alias密碼,生成release版的apk。 

            2.2 采用ANT命令行形式

            $ ant release

            By default, the build script compiles the application APK without signing it. The output file in your project bin/ will be <your_project_name>-unsigned.apk. Because the application APK is still unsigned, you must manually sign it with your private key and then align it using zipalign. 

            默認(rèn)編譯出來的版本是沒有證書的<your_project_name>-unsigned.apk ,需要手動(dòng)添加證書和對(duì)齊

            To specify your keystore and alias, open the project ant.properties file (found in the root of the project directory) and add entries for key.store and key.alias. For example: 

            我們可以在ant.properties文件中指定證書位置和對(duì)齊

            # This file is used to override default values used by the Ant build system.
            #
            # This file must be checked into Version Control Systems, as it is
            # integral to the build system of your project.

            # This file is only used by the Ant script.

            # You can use this to override default values such as
            #  'source.dir' for the location of your java source folder and
            #  'out.dir' for the location of your output folder.

            # You can also use it define how the release builds are signed by declaring
            # the following properties:
            #  'key.store' for the location of your keystore and
            #  'key.alias' for the name of the key to use.
            # The password will be asked during the build when you use the 'release' target.

            #我的證書在上一級(jí)目錄下
            #alias是創(chuàng)建證書時(shí)填寫的alias_name

            key.store=../keystore_name.keystore 
            key.alias=alias_name

            接下來的步驟很easy了

            Save your changes. Now you can build a signed .apk in release mode:

            1. Open a command-line and navigate to the root of your project directory.
            2. Use Ant to compile your project in release mode:
              ant release
            3. When prompted, enter you keystore and alias passwords.

              Caution: As described above, your password will be visible on the screen.

            This creates your Android application .apk file inside the project bin/ directory, named<your_project_name>-release.apk. This .apk file has been signed with the private key specified inant.properties and aligned with zipalign. It's ready for installation and distribution.

            ant release后會(huì)生成一個(gè)<your_project_name>-release.apk的版本

            啊,世界清靜了~~~ 

            最后就是安裝了。 
            由于使用了新的簽名,必須先卸載原來安裝的程序才可以安裝。 


            /////////////////////////////////////////////////////////////////////////////////////////////////////////////

            常見問題:
            生成的debug和release有什么區(qū)別 大小差不多

            Support for a true debug build. Developers no longer need to add the android:debuggable attribute to the tag in the manifest — the build tools add the attribute automatically. In Eclipse/ADT, all incremental builds are assumed to be debug builds, so the tools insert android:debuggable="true". When exporting a signed release build, the tools do not add the attribute. In Ant, a ant debug command automatically inserts the android:debuggable="true" attribute, while ant release does not. If android:debuggable="true" is manually set, then ant release will actually do a debug build, rather than a release build. 




























            posted on 2012-08-15 10:11 風(fēng)輕云淡 閱讀(2304) 評(píng)論(0)  編輯 收藏 引用 所屬分類: cocos2d
            久久91精品国产91| 97久久精品无码一区二区| 国产精品一久久香蕉国产线看| 久久国产欧美日韩精品免费| 久久综合色之久久综合| 伊人久久大香线蕉无码麻豆| 久久夜色精品国产www| 香蕉aa三级久久毛片| 2021国内久久精品| 亚洲伊人久久精品影院 | 九九精品99久久久香蕉| 中文无码久久精品| 久久久久久亚洲AV无码专区| 国产精品久久久久久影院| 丁香五月综合久久激情| 亚洲欧洲精品成人久久曰影片 | 欧美伊人久久大香线蕉综合69| 久久精品无码av| 久久精品免费一区二区| AV无码久久久久不卡蜜桃| 99久久精品久久久久久清纯| 久久久WWW成人| 亚洲国产成人精品无码久久久久久综合 | 青青热久久国产久精品 | 天天躁日日躁狠狠久久| 狠狠狠色丁香婷婷综合久久五月| 亚洲伊人久久大香线蕉苏妲己| 久久精品国产一区二区三区| 久久狠狠爱亚洲综合影院| 99久久免费国产特黄| 日韩美女18网站久久精品| 麻豆一区二区99久久久久| 久久久91人妻无码精品蜜桃HD| 亚洲AV乱码久久精品蜜桃| 久久久久国产一级毛片高清板| 久久午夜无码鲁丝片| 久久精品国产WWW456C0M| 无码人妻精品一区二区三区久久| 91久久福利国产成人精品| 亚洲AV日韩精品久久久久久| 无码任你躁久久久久久久|