private void prepare() { String jdkPath = RegistryHandler.getJDKPath(); if (!isToolsJarInWebSDK()) { copyJdkTools(jdkPath); } File tools_jar = new File(jdkPath + "\\lib\\tools.jar"); current.addPathComponent(tools_jar); try { fileHandler.deleteFolder(new File(tempAndroidProjectPath)); copyAssets(); copyProject(); changeIcon(); changePackage(); changeName(); createBuildProperties(); targetId = RegistryHandler.getAndroidTarget() + 1; // Update R.java and some properties. cmdHelper.updateAndroidProject(targetId, tempAndroidProjectPath, getNameForFile()); } catch (IOException ex) { java.util.logging.Logger.getLogger(AndroidApplicationModel.class.getName()) .log(Level.SEVERE, null, ex); } }
public AndroidApplicationModel(Settings settings) { super(PLATFORM, settings); this.settings = settings; this.installDirectory = RegistryHandler.getInstallDir(); this.tempPath = System.getProperty("java.io.tmpdir"); // this.defaultAndroidProjectPath = installDirectory + "/PhonegapSDK/Default/android"; this.defaultAndroidProjectPath = settings.getProjectPath(); this.tempAndroidProjectPath = tempPath + "/android"; this.tempBuildFile = new File(tempPath + "/android/" + "build.xml"); this.tempWwwPath = tempAndroidProjectPath + "/assets/www"; this.tempManifestPath = tempAndroidProjectPath + "/AndroidManifest.xml"; this.tempSrcPath = tempAndroidProjectPath + "/src/"; this.tempStringsPath = tempAndroidProjectPath + "/res/values/strings.xml"; this.tempDrawableFolder = tempAndroidProjectPath + "/res/drawable"; this.buildProperties = tempAndroidProjectPath + "/build.properties"; this.antListener = new AntListener(); this.fileHandler = new FileHandler(); this.cmdHelper = new CmdHelper(); cmdHelper.addListener(this); antHelper = new AntHelper(); antHelper.addBuildListener(antListener); current = new AntClassLoader(null, Path.systemClasspath); androidKeys = settings.getAndroidKeys(); }
/** * checking for Android SDK and java compiler configured and accessable * * @return true if all correct */ private boolean isValid() { File sdkToolsFolder = new File(RegistryHandler.getAndroidSDKPath() + "\\tools"); return sdkToolsFolder.exists() && isToolsJarInWebSDK(); }