Esempio n. 1
0
        protected void Recompile(string compositFilePath, string inputFolder, CrcsProject project)
        {
            var ep       = new ExecuteProgram();
            var apiLevel = project.Properties.ApiLevel;

            var arguments = new StringBuilder();

            arguments.Append("-jar \"").Append(_smaliFile).Append("\"");
            arguments.Append(" \"").Append(inputFolder).Append("\"");
            string classesDexFile = Path.Combine(FolderUtility.CreateTempFolder(), "classes.dex");

            arguments.Append(" -o \"").Append(classesDexFile).Append("\"");
            if (_useSmaliApiLevel)
            {
                arguments.Append(" -a ").Append(apiLevel);
            }
            if (ep.Execute(_javaFile, arguments.ToString(), Path.GetDirectoryName(classesDexFile)) != 0)
            {
                throw ep.CreateException(Path.GetFileName(_smaliFile));
            }

            // add to program file apk/jar...
            using (var zf = new AndroidArchive(compositFilePath))
            {
                zf.Add(classesDexFile, Path.GetFileName(classesDexFile));
            }
        }