Package com.android.builder.packaging

Examples of com.android.builder.packaging.Packager


            // this shouldn't happen as we have checked ahead of calling getDebugKey.
            throw new RuntimeException(e);
        }

        try {
            Packager packager = new Packager(
                    outApkLocation, androidResPkgLocation, classesDexLocation,
                    signingInfo, mLogger);

            packager.setDebugJniMode(buildType.isDebugJniBuild());

            // figure out conflicts!
            JavaResourceProcessor resProcessor = new JavaResourceProcessor(packager);

            if (mVariant.getBuildTypeSourceSet() != null) {
                Set<File> buildTypeJavaResLocations =
                        mVariant.getBuildTypeSourceSet().getJavaResources();
                for (File buildTypeJavaResLocation : buildTypeJavaResLocations) {
                    if (buildTypeJavaResLocation != null &&
                            buildTypeJavaResLocation.isDirectory()) {
                        resProcessor.addSourceFolder(buildTypeJavaResLocation.getAbsolutePath());
                    }
                }
            }

            for (SourceSet sourceSet : mVariant.getFlavorSourceSets()) {

                Set<File> flavorJavaResLocations = sourceSet.getJavaResources();
                for (File flavorJavaResLocation : flavorJavaResLocations) {
                    if (flavorJavaResLocation != null && flavorJavaResLocation.isDirectory()) {
                        resProcessor.addSourceFolder(flavorJavaResLocation.getAbsolutePath());
                    }
                }
            }

            Set<File> mainJavaResLocations = mVariant.getDefaultSourceSet().getJavaResources();
            for (File mainJavaResLocation : mainJavaResLocations) {
                if (mainJavaResLocation != null && mainJavaResLocation.isDirectory()) {
                    resProcessor.addSourceFolder(mainJavaResLocation.getAbsolutePath());
                }
            }

            // add the resources from the jar files.
            List<JarDependency> jars = mVariant.getJars();
            if (jars != null) {
                for (JarDependency jar : jars) {
                    packager.addResourcesFromJar(new File(jar.getLocation()));
                }
            }

            // add the resources from the libs jar files
            List<AndroidDependency> libs = mVariant.getDirectLibraries();
            addLibJavaResourcesToPackager(packager, libs);

            // also add resources from library projects and jars
            if (jniLibsLocation != null) {
                packager.addNativeLibraries(jniLibsLocation);
            }

            packager.sealApk();
        } catch (PackagerException e) {
            throw new RuntimeException(e);
        } catch (SealedPackageException e) {
            throw new RuntimeException(e);
        }
View Full Code Here


            // this shouldn't happen as we have checked ahead of calling getDebugKey.
            throw new RuntimeException(e);
        }

        try {
            Packager packager = new Packager(
                    outApkLocation, androidResPkgLocation, classesDexLocation,
                    signingInfo, mLogger);

            packager.setDebugJniMode(buildType.isDebugJniBuild());

            // figure out conflicts!
            JavaResourceProcessor resProcessor = new JavaResourceProcessor(packager);

            if (javaResourcesLocation != null) {
                resProcessor.addSourceFolder(javaResourcesLocation);
            }

            // add the resources from the jar files.
            Collection<JarDependency> jars = mVariant.getJars();
            if (jars != null) {
                for (JarDependency jar : jars) {
                    packager.addResourcesFromJar(new File(jar.getLocation()));
                }
            }

            // add the resources from the libs jar files
            List<AndroidDependency> libs = mVariant.getAllLibraries();

            for (AndroidDependency lib : libs) {
                packager.addResourcesFromJar(lib.getJarFile());
            }

            // also add resources from library projects and jars
            if (jniLibsLocation != null) {
                packager.addNativeLibraries(jniLibsLocation);
            }

            packager.sealApk();
        } catch (PackagerException e) {
            throw new RuntimeException(e);
        } catch (SealedPackageException e) {
            throw new RuntimeException(e);
        }
View Full Code Here

TOP

Related Classes of com.android.builder.packaging.Packager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.