Created
July 4, 2014 03:46
-
-
Save Gracker/1416df37cb193921dbf4 to your computer and use it in GitHub Desktop.
使用命令行来编译Android .9文件
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 调用aapt工具进行打包 | |
* | |
* @param resPath | |
* 资源原路径 | |
* @param outPath | |
* 打包输出路径 | |
* @return | |
*/ | |
public static boolean compileNinePatch(String resPath, String outPath) { | |
// 只编译资源文件 | |
String command = "tools" + File.separator + "aapt-mac"; | |
command += " c"; | |
command += " -S " + resPath; | |
command += " -C " + outPath; | |
try { | |
Runtime.getRuntime().exec(command); | |
Thread.sleep(3000); | |
} catch (IOException e) { | |
// TODO Auto-generated catch block | |
e.printStackTrace(); | |
return false; | |
} catch (InterruptedException e) { | |
// TODO Auto-generated catch block | |
e.printStackTrace(); | |
return false; | |
} catch (Exception e) { | |
e.printStackTrace(); | |
return false; | |
} | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment