com.android.utils.StdLogger Java Examples
The following examples show how to use
com.android.utils.StdLogger.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SplashScreenActivity.java From javaide with GNU General Public License v3.0 | 5 votes |
@VisibleForTesting private void testCreateProject() { StdLogger log = new StdLogger(StdLogger.Level.VERBOSE); String sdkFolder = Environment.getSdkDir(this).getAbsolutePath(); SdkManager sdkManager = SdkManager.createManager(sdkFolder, log); ProjectCreator projectCreator = new ProjectCreator(sdkManager, sdkFolder, ProjectCreator.OutputLevel.VERBOSE, log); IAndroidTarget target = null; IAndroidTarget[] targets = sdkManager.getTargets(); if (DLog.DEBUG) DLog.d(TAG, "targets = " + Arrays.toString(targets)); for (IAndroidTarget tmp : targets) { if (tmp.getVersion().getApiLevel() == 27) { target = tmp; } } String projectName = "DemoAndroid"; File rootProject = new File(Environment.getSdkAppDir(), projectName); com.duy.android.compiler.utils.FileUtils.deleteQuietly(rootProject); projectCreator.createGradleProject(rootProject.getAbsolutePath(), projectName, "com.duy.example", "MainActivity", target, false, "1.0"); File[] files = rootProject.listFiles(); if (DLog.DEBUG) DLog.d(TAG, "files = " + Arrays.toString(files)); }
Example #2
Source File: RecipeMergeUtils.java From NBANDROID-V2 with Apache License 2.0 | 5 votes |
/** * Merges the given manifest fragment into the given manifest file */ @Nullable private static MergingReport mergeManifest(@NotNull File moduleRoot, @NotNull final File targetManifest, @NotNull final String targetXml, @NotNull final String mergeText) { try { boolean isMasterManifest = filesEqual(moduleRoot, targetManifest.getParentFile()); //noinspection SpellCheckingInspection final File tempFile2 = new File(targetManifest.getParentFile(), "nevercreated.xml"); StdLogger logger = new StdLogger(StdLogger.Level.INFO); return ManifestMerger2.newMerger(targetManifest, logger, ManifestMerger2.MergeType.APPLICATION) .withFeatures(ManifestMerger2.Invoker.Feature.EXTRACT_FQCNS, ManifestMerger2.Invoker.Feature.HANDLE_VALUE_CONFLICTS_AUTOMATICALLY, ManifestMerger2.Invoker.Feature.NO_PLACEHOLDER_REPLACEMENT) .addLibraryManifest(tempFile2) .asType(isMasterManifest ? XmlDocument.Type.MAIN : XmlDocument.Type.OVERLAY) .withFileStreamProvider(new ManifestMerger2.FileStreamProvider() { @Override protected InputStream getInputStream(@NotNull File file) throws FileNotFoundException { String text = filesEqual(file, targetManifest) ? targetXml : mergeText; return new ByteArrayInputStream(text.getBytes(Charsets.UTF_8)); } }) .merge(); } catch (ManifestMerger2.MergeFailureException e) { return null; } }
Example #3
Source File: Merger.java From java-n-IDE-for-Android with Apache License 2.0 | 4 votes |
@VisibleForTesting protected ILogger createLogger(StdLogger.Level level) { return new StdLogger(level); }
Example #4
Source File: JavaIdeActivity.java From javaide with GNU General Public License v3.0 | 4 votes |
private void compileAndroidProject() { if (mProject instanceof AndroidAppProject) { if (!((AndroidAppProject) mProject).getManifestFile().exists()) { Toast.makeText(this, "Can not find AndroidManifest.xml", Toast.LENGTH_SHORT).show(); return; } //check launcher activity if (((AndroidAppProject) mProject).getLauncherActivity() == null) { String message = getString(R.string.can_not_find_launcher_activity); Toast.makeText(this, message, Toast.LENGTH_SHORT).show(); return; } final AndroidAppBuilder builder = new AndroidAppBuilder(this, (AndroidAppProject) mProject); builder.setStdOut(new PrintStream(mDiagnosticPresenter.getStandardOutput())); builder.setStdErr(new PrintStream(mDiagnosticPresenter.getErrorOutput())); builder.setLogger(new StdLogger(StdLogger.Level.VERBOSE)); BuildTask.CompileListener<AndroidAppProject> listener = new BuildTask.CompileListener<AndroidAppProject>() { @Override public void onStart() { updateUiStartCompile(); } @Override public void onError(Exception e) { updateUIFinishCompile(); Toast.makeText(JavaIdeActivity.this, R.string.failed_msg, Toast.LENGTH_SHORT).show(); } @Override public void onComplete() { updateUIFinishCompile(); Toast.makeText(JavaIdeActivity.this, R.string.build_success, Toast.LENGTH_SHORT).show(); mFilePresenter.refresh(mProject); RootUtils.installApk(JavaIdeActivity.this, ((AndroidAppProject) mProject).getApkSigned()); } }; BuildTask<AndroidAppProject> buildTask = new BuildTask<>(builder, listener); buildTask.execute(); } else { if (mProject != null) { toast("This is Java project, please create new Android project"); } else { toast("You need create Android project"); } } }
Example #5
Source File: Merger.java From javaide with GNU General Public License v3.0 | 4 votes |
@VisibleForTesting protected ILogger createLogger(StdLogger.Level level) { return new StdLogger(level); }
Example #6
Source File: CreateAvdWizardIterator.java From NBANDROID-V2 with Apache License 2.0 | 4 votes |
@Override public Set<?> instantiate() throws IOException { // TODO return set of FileObject (or DataObject) you have created //path /home/arsi/.android/avd/Nexus_5_API_27.avd //avd name Nexus_5_API_27 //skinFolder /jetty/android-studio-sdk/skins/nexus_5 //skinname null //sdcard 512M // //hw.dPad => no x //hw.lcd.height => 1920 x //fastboot.chosenSnapshotFile => //runtime.network.speed => full //hw.accelerometer => yes x //hw.device.name => Nexus 5 x //vm.heapSize => 128 //skin.dynamic => yes //hw.device.manufacturer => Google x //hw.lcd.width => 1080 x //skin.path => /jetty/android-studio-sdk/skins/nexus_5 //hw.gps => yes x //hw.initialOrientation => Portrait //hw.audioInput => yes x //showDeviceFrame => yes //hw.camera.back => emulated //hw.mainKeys => no x //AvdId => Nexus_5_API_27 //hw.lcd.density => 480 x //hw.camera.front => emulated //avd.ini.displayname => Nexus 5 API 27 //hw.gpu.mode => auto/host/software //hw.device.hash2 => MD5:1c925b9117dd9f33c5128dac289a0d68 x //fastboot.forceChosenSnapshotBoot => no //fastboot.forceFastBoot => yes //hw.trackBall => no x //hw.ramSize => 1536 //hw.battery => yes x //fastboot.forceColdBoot => no //hw.cpu.ncore => 4 //hw.sdCard => yes xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx //runtime.network.latency => none //hw.keyboard => yes //hw.sensors.proximity => yes x //hw.sensors.orientation => yesx //disk.dataPartition.size => 2G //hw.gpu.enabled => yes // //dev has playstore true //create snapshot false //removeprev false //editExisting true AndroidSdk defaultSdk = (AndroidSdk) wizard.getProperty(ANDROID_SDK); AvdManager avdManager = (AvdManager) wizard.getProperty(AVD_MANAGER); Device selectedDevice = (Device) wizard.getProperty(DEVICE_SELECTED); SystemImageDescription selectedImage = (SystemImageDescription) wizard.getProperty(SYSTEM_IMAGE); String displayName = (String) wizard.getProperty(AVD_DISPLAY_NAME); String avdId = (String) wizard.getProperty(AVD_ID_NAME); Map<String, String> hardwareProperties = DeviceManager.getHardwareProperties(selectedDevice); Map<String, String> userHardwareProperties = (Map<String, String>) wizard.getProperty(AVD_USER_HW_CONFIG); hardwareProperties.putAll(userHardwareProperties); String skinPath = hardwareProperties.get("skin.path"); String sdcard = (String) wizard.getProperty(AVD_SDCARD); try { String avdPath = avdManager.getBaseAvdFolder().getAbsoluteFile().getAbsolutePath() + File.separator + avdId + ".avd"; avdManager.createAvd(new File(avdPath), avdId, selectedImage.getSystemImage(), new File(skinPath), null, sdcard, hardwareProperties, selectedDevice.getBootProps(), selectedDevice.hasPlayStore()&&selectedImage.getSystemImage().hasPlayStore(), false, false, true, new StdLogger(StdLogger.Level.INFO)); } catch (AndroidLocation.AndroidLocationException androidLocationException) { } changeListener.stateChanged(null); return Collections.emptySet(); }
Example #7
Source File: AndroidManifestProcessor.java From bazel with Apache License 2.0 | 4 votes |
/** Creates a new processor with the appropriate logger. */ public static AndroidManifestProcessor with(StdLogger stdLogger) { return new AndroidManifestProcessor(stdLogger); }
Example #8
Source File: AndroidManifestProcessor.java From bazel with Apache License 2.0 | 4 votes |
private AndroidManifestProcessor(StdLogger stdLogger) { this.stdLogger = stdLogger; }
Example #9
Source File: AndroidResourceProcessor.java From bazel with Apache License 2.0 | 4 votes |
public AndroidResourceProcessor(StdLogger stdLogger) { this.stdLogger = stdLogger; }
Example #10
Source File: AndroidResourceProcessor.java From bazel with Apache License 2.0 | 4 votes |
public void runAapt( Path tempRoot, Path aapt, Path androidJar, @Nullable Revision buildToolsVersion, VariantType variantType, boolean debug, String customPackageForR, AaptOptions aaptOptions, Collection<String> resourceConfigs, Path androidManifest, Path resourceDir, Path assetsDir, Path sourceOut, @Nullable Path packageOut, @Nullable Path proguardOut, @Nullable Path mainDexProguardOut, @Nullable Path publicResourcesOut) throws InterruptedException, LoggedErrorException, IOException { try (JunctionCreator junctions = System.getProperty("os.name").toLowerCase().startsWith("windows") ? new WindowsJunctionCreator(Files.createDirectories(tempRoot.resolve("juncts"))) : new NoopJunctionCreator()) { sourceOut = junctions.create(sourceOut); AaptCommandBuilder commandBuilder = new AaptCommandBuilder(junctions.create(aapt)) .forBuildToolsVersion(buildToolsVersion) .forVariantType(variantType) // first argument is the command to be executed, "package" .add("package") // If the logger is verbose, set aapt to be verbose .when(stdLogger.getLevel() == StdLogger.Level.VERBOSE) .thenAdd("-v") // Overwrite existing files, if they exist. .add("-f") // Resources are precrunched in the merge process. .add("--no-crunch") // Do not automatically generate versioned copies of vector XML resources. .whenVersionIsAtLeast(new Revision(23)) .thenAdd("--no-version-vectors") // Add the android.jar as a base input. .add("-I", junctions.create(androidJar)) // Add the manifest for validation. .add("-M", junctions.create(androidManifest.toAbsolutePath())) // Maybe add the resources if they exist .when(Files.isDirectory(resourceDir)) .thenAdd("-S", junctions.create(resourceDir)) // Maybe add the assets if they exist .when(Files.isDirectory(assetsDir)) .thenAdd("-A", junctions.create(assetsDir)) // Outputs .when(sourceOut != null) .thenAdd("-m") .add("-J", prepareOutputPath(sourceOut)) .add("--output-text-symbols", prepareOutputPath(sourceOut)) .add("-F", junctions.create(packageOut)) .add("-G", junctions.create(proguardOut)) .whenVersionIsAtLeast(new Revision(24)) .thenAdd("-D", junctions.create(mainDexProguardOut)) .add("-P", junctions.create(publicResourcesOut)) .when(debug) .thenAdd("--debug-mode") .add("--custom-package", customPackageForR) // If it is a library, do not generate final java ids. .whenVariantIs(VariantType.LIBRARY) .thenAdd("--non-constant-id") .add("--ignore-assets", aaptOptions.getIgnoreAssets()) .when(aaptOptions.getFailOnMissingConfigEntry()) .thenAdd("--error-on-missing-config-entry") // Never compress apks. .add("-0", "apk") // Add custom no-compress extensions. .addRepeated("-0", aaptOptions.getNoCompress()) // Filter by resource configuration type. .add("-c", Joiner.on(',').join(resourceConfigs)); for (String additional : aaptOptions.getAdditionalParameters()) { commandBuilder.add(additional); } try { new CommandLineRunner(stdLogger).runCmdLine(commandBuilder.build(), null); } catch (LoggedErrorException e) { // Add context and throw the error to resume processing. throw new LoggedErrorException( e.getCmdLineError(), getOutputWithSourceContext(aapt, e.getOutput()), e.getCmdLine()); } } }
Example #11
Source File: Main.java From java-n-IDE-for-Android with Apache License 2.0 | 2 votes |
/** * Creates the {@link #mSdkLog} object. * This logger prints to the attached console. */ private void createLogger() { mSdkLog = new StdLogger(StdLogger.Level.VERBOSE); }
Example #12
Source File: Main.java From javaide with GNU General Public License v3.0 | 2 votes |
/** * Creates the {@link #mSdkLog} object. * This logger prints to the attached console. */ private void createLogger() { mSdkLog = new StdLogger(StdLogger.Level.VERBOSE); }