zoukankan      html  css  js  c++  java
  • (转)如何手动编译一个APK

    he 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

  • 相关阅读:
    HDU 1240 Asteroids!【BFS】
    POJ 2251 Dungeon Master【BFS】
    HDU 1548 A strange lift【BFS】
    HDU 1171 Big Event in HDU【01背包】
    HDU 1505 City Game【DP】
    POJ 2386 Lake Counting【BFS】
    POJ 3278 Catch That Cow【BFS】
    HDU 1506 Largest Rectangle in a Histogram【DP】
    随想而已
    HDU 1285 确定比赛名次【拓扑排序】
  • 原文地址:https://www.cnblogs.com/greywolf/p/3031181.html
Copyright © 2011-2022 走看看