Created
July 4, 2014 02:39
-
-
Save Gracker/1236f18e3b85914b92e7 to your computer and use it in GitHub Desktop.
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
public static void compileNinePatch() { | |
File projectRootPath = new File("ThemeTools"); | |
File manifest = new File("lewaThemeTools" + File.separator | |
+ "AndroidManifest.xml"); | |
File android = new File("lewaThemeTools" + File.separator + "libs" | |
+ File.separator + "android.jar"); | |
File resource = new File("temp" + File.separator + "drawable"); | |
File tempFile = new File("temp" + File.separator + "temp.zip"); | |
File tempFolder = new File("temp" + File.separator + "temp"); | |
command = "res" + File.separator + "aapt-mac"; | |
command += " package"; | |
command += " -M " + manifest.getAbsolutePath(); | |
command += " -S " + resource.getAbsolutePath(); | |
command += " -I " + android.getAbsolutePath(); | |
command += " -F " + tempFile.getAbsolutePath(); | |
System.out.println(command); | |
try { | |
Runtime.getRuntime().exec(command); | |
Thread.sleep(3000); | |
} catch (IOException e) { | |
// TODO Auto-generated catch block | |
e.printStackTrace(); | |
} catch (InterruptedException e) { | |
// TODO Auto-generated catch block | |
e.printStackTrace(); | |
} catch (Exception e) { | |
e.printStackTrace(); | |
} | |
if (tempFile.exists()) { | |
unZip("temp" + File.separator + "temp.zip", | |
tempFolder.getAbsolutePath()); | |
} else { | |
System.out.println("打包不成功"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment