Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 08320015 authored by Joe Fernandez's avatar Joe Fernandez
Browse files

docs: Eclipse ADT removing and replacing mentions

Batch 05, Project 01 with InfoPros

b/25192800

Change-Id: I6cce84d8498ba9f0aa488b8d43b7b832e58fe899
parent e3f6c81c
Loading
Loading
Loading
Loading
+22 −18
Original line number Diff line number Diff line
@@ -95,34 +95,38 @@ method calls.</p>
<p>To add the AIDL to your project:</p>

<ol>
  <li>Copy the {@code IInAppBillingService.aidl} file to your Android project.
  <li>First, download the Google Play Billing Library to your Android project:
      <ol type="a">
      <li>Select <strong>Tools > Android > SDK Manager</strong>.</li>
      <li>Under <strong>Appearance & Behavior > System Settings > Android SDK</strong>,
          select the <em>SDK Tools</em> tab to select and download <em>Google Play Billing
          Library</em>.</li></ol>

  <li>Next, copy the {@code IInAppBillingService.aidl} file to your project.
    <ul>
      <li>If you are using Eclipse:
      <li>If you are using Android Studio:
        <ol type="a">
          <li>If you are starting from an existing Android project, open the
          project in Eclipse. If you are creating a new Android project from
          scratch, click <strong>File</strong> &gt; <strong>New</strong> &gt;
          <strong>Android Application Project</strong>, then follow the
          instructions in the <strong>New Android Application</strong> wizard
          to create a new project in your workspace.
          </li>
          <li>Navigate to {@code src/main} in the Project tool window.</li>

          <li>In the {@code /src} directory, click <strong>File</strong> &gt;
          <strong>New</strong> &gt; <strong>Package</strong>, then create a
          package named {@code com.android.vending.billing}.
          </li>
          <li>Select <strong>File > New > Directory</strong> and enter {@code aidl} in the
          <em>New Directory</em> window, then select <strong>OK</strong>.

          <li>Select <strong>File > New > Package</strong> and enter 
          {@code com.android.vending.billing} in the <em>New Package</em> window, then select
          <strong>OK</strong>.</li>

          <li>Copy the {@code IInAppBillingService.aidl} file from {@code
          &lt;sdk&gt;/extras/google/play_billing/} and paste it into the {@code
          src/com.android.vending.billing/} folder in your workspace.
          <li>Using your operating system file explorer, navigate to 
          {@code &lt;sdk&gt;/extras/google/play_billing/}, copy the 
          {@code IInAppBillingService.aidl} file, and paste it into the 
          {@code com.android.vending.billing} package in your project.
          </li>
        </ol>
      </li>

      <li>If you are developing in a non-Eclipse environment: Create the
      <li>If you are developing in a non-Android Studio environment: Create the
      following directory {@code /src/com/android/vending/billing} and copy the
      {@code IInAppBillingService.aidl} file into this directory. Put the AIDL
      file into your project and use the Ant tool to build your project so that
      file into your project and use the Gradle tool to build your project so that
      the <code>IInAppBillingService.java</code> file gets generated.
      </li>
    </ul>
+32 −49
Original line number Diff line number Diff line
@@ -179,21 +179,24 @@ Play services.</p>
these steps: </p>

<ol>
  <li>Launch the Android SDK Manager (available under the Eclipse <strong>Window</strong>
menu or by executing {@code &lt;sdk>/tools/android sdk}).</li>
  <li>Launch the Android SDK Manager, available under the Android Studio Tools menu
(<strong>Tools > Android > SDK Manager</strong>) or by executing
{@code &lt;sdk>/tools/android sdk}.</li>
  <li>Select and download <strong>Google APIs</strong> for the Android version you'd like to target
(must be Android 2.2 or higher).</li>
  <li>When the download is complete, open the AVD Manager (available under the Eclipse
<strong>Window</strong>
menu or by executing {@code &lt;sdk>/tools/android avd}).</li>
  <li>Click
<strong>New</strong> and set the configuration details for the new AVD. </li>
  <li>In the dialog that appears, assign a descriptive name to the AVD and then
use the Target menu to choose the <strong>Google APIs</strong> as
the system image to run on the new AVD. Set the other configuration details as
needed and then click <strong>Create AVD</strong> to finish. The SDK tools
create the new AVD configuration, which then appears in the list of available
Android Virtual Devices.</li>
  <li>When the download is complete, open the AVD Manager, available under the Android Studio
Tools menu (<strong>Tools > Android > AVD Manager</strong>) or by executing
{@code &lt;sdk>/tools/android avd}.</li>
  <li>In the <em>Android Virtual Device Manager</em> window, select
<strong>+ Create Virtual Device</strong> to set the configuration details for the new AVD. </li>
  <li>In the <em>Virtual Device Configuration</em> window, select device hardware, then
select <strong>Next</strong>.</li>
<li>Select a <strong>Google API</strong> as the system image to run on the new AVD, then
select <strong>Next</strong>.</li>
<li>Assign a descriptive name to the AVD and then set the other configuration details as
needed.</li>
<li>Select <strong>Finish</strong> to create the new AVD configuration, which will appear in the
list of available Android Virtual Devices.</li>
</ol>

<p>If you are not familiar with AVDs or how to use them, see <a
@@ -205,7 +208,7 @@ href="{@docRoot}tools/devices/index.html">Managing Virtual Devices</a>.</p>
above &mdash; either on an actual device or on an emulator &mdash; make sure to
update your application project or build scripts as needed, so that your compiled
<code>.apk</code> files that use licensing are deployed into that environment.
In particular, if you are developing in Eclipse, make sure that you set up a
In particular, if you are developing in Android Studio, make sure that you set up a
Run/Debug Configuration that targets the appropriate device or AVD. </p>

<p>You do not need to make any changes to your application's
@@ -323,28 +326,22 @@ across all of your projects and maintain it centrally. </p>
<p>The LVL is provided as a configured library project &mdash; once you have
downloaded it, you can start using it right away. </p>

<p>If you are working in Eclipse with ADT, you need to add the LVL to your
workspace as a new development project, in the same way as you would a new
application project. </p>
<p>If you are working in Android Studio, you need to add the LVL to your
project as a new module.</p>

<ol>
<li>Use the New Project Wizard to create a new
project from existing sources. Select the LVL's <code>library</code> directory
(the directory containing the library's AndroidManifest.xml file) as the project
root.</li>
<li>When you are creating the library project, you can select any application
name, package, and set other fields as needed. </li>
<li>For the library's build target, select Android 1.5 (API level 3) or higher.</li>
<li>Use the New Module Wizard to import a library module by selecting
<strong>File > New > Import Module</strong>.</li>
<li>In the <em>New Module</em> window, in <em>Source directory</em>, enter the LVL's
<code>library</code> directory (the directory containing the library's AndroidManifest.xml file)
as the project root ({@code &lt;sdk>/extras/google/play_licensing/library/AndroidManifest.xml}),
then select <strong>Next</strong>.</li>
<li>Select <strong>Finish</strong> to import the library module.</li>
</ol>

<p> When created, the project is
predefined as a library project in its <code>project.properties</code> file, so
no further configuration is needed. </p>

<p>For more information about how to create an application project or work with
library projects in Eclipse, see <a
href="{@docRoot}tools/projects/projects-eclipse.html">Managing Projects from
Eclipse with ADT</a>.</p>
<p>For more information about how to work with library modules in Android Studio, see
<a href="{@docRoot}sdk/installing/create-project.html#SettingUpLibraryModule">Managing Projects from
Android Studio</a>.</p>


<h4>Copying the LVL sources to your application</h4>
@@ -369,24 +366,10 @@ build tools to include the LVL library project sources in your application at
compile time. The process for adding a reference to a library project depends
on your development environment, as described below.</p>

<p> If you are developing in Eclipse with ADT, you should already have added the
library project to your workspace, as described in the previous section. If you
<p> If you are developing in Android Studio, you should already have added the
library module to your project, as described in the previous section. If you
haven't done that already, do it now before continuing. </p>

<p>Next, open the application's project properties window, as shown below.
Select the "Android" properties group and click <strong>Add</strong>, then
choose the LVL library project (com_android_vending_licensing) and click
<strong>OK</strong>. For more information, see
<a href="{@docRoot}tools/projects/projects-eclipse.html#SettingUpLibraryProject">
Managing Projects from Eclipse with ADT</a></p>.


<img src="{@docRoot}images/licensing_add_library.png" alt=""/>
<p class="img-caption"><strong>Figure 3.</strong> If you are
working in Eclipse with ADT, you can add the LVL library project to your
application from the application's project properties.</p>


<p>If you are developing using the SDK command-line tools, navigate to the
directory containing your application project and open the
<code>project.properties</code> file. Add a line to the file that specifies the
+7 −7
Original line number Diff line number Diff line
@@ -190,11 +190,11 @@ project's {@code gen/} directory. The generated file name matches the {@code .ai
with a {@code .java} extension (for example, {@code IRemoteService.aidl} results in {@code
IRemoteService.java}).</p>

<p>If you use Eclipse, the incremental build generates the binder class almost immediately. If you
do not use Eclipse, then the Ant tool generates the binder class next time you build your
application&mdash;you should build your project with <code>ant debug</code> (or <code>ant
release</code>) as soon as you're finished writing the {@code .aidl} file, so that your code can
link against the generated class.</p>
<p>If you use Android Studio, the incremental build generates the binder class almost immediately.
If you do not use Android Studio, then the Gradle tool generates the binder class next time you
build your application&mdash;you should build your project with <code>gradle assembleDebug</code>
(or <code>gradle assembleRelease</code>) as soon as you're finished writing the {@code .aidl} file,
so that your code can link against the generated class.</p>


<h3 id="Implement">2. Implement the interface</h3>

docs/html/legal.jd

100644 → 100755
+4 −6
Original line number Diff line number Diff line
@@ -70,12 +70,10 @@ Policy &amp; Terms of Service</a>.</p>
restrictions. Such services include:</p>

<dl>
  <dt>Eclipse Android Developer Tools Plugin</dt>
    <dd>If you're developing apps with the Eclipse IDE, we offer a free plugin called the
<a href="{@docRoot}tools/sdk/eclipse-adt.html">Android Developer Tools</a> (ADT) to speed up your
development and debugging. Certain code within the ADT plugin and other packages available
from the SDK Manager require that you agree to terms and conditions for use, reproduction and
distribution upon installation.</dd>
  <dt>Android Studio</dt>
    <dd>Android Studio and other packages available from the SDK manager require that you agree
to terms and conditions
for use, reproduction and distribution upon installation.</dd>

  <dt>Google Play</dt>
    <dd>Google Play is a publicly available service through which you can distribute your apps for
+11 −82
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ memory usage with tools. This guide shows you how to do that.</p>
<p>The simplest place to begin investigating your app’s memory usage is the runtime log messages.
Sometimes when a GC occurs, a message is printed to
<a href="{@docRoot}tools/help/logcat.html">logcat</a>. The logcat output is also available in the
Device Monitor or directly in IDEs such as Eclipse and Android Studio.</p>
Device Monitor or directly in an IDE such as Android Studio.</p>

<h3 id="DalvikLogMessages">Dalvik Log Messages</h3>

@@ -240,7 +240,7 @@ can view real-time updates to your app's heap in Android Studio's

<h3>Memory Monitor in Android Studio</h3>
<p>Use Android Studio to view your app's memory use: </p>
<ul>
<ol>
  <li>Start your app on a connected device or emulator.</li>
  <li>Open the Android run-time window, and view the free and allocated memory in the Memory
    Monitor. </li>
@@ -260,7 +260,7 @@ can view real-time updates to your app's heap in Android Studio's
   </li>
  <li>Identify which actions in your app are likely causing too much allocation and determine where
   in your app you should try to reduce allocations and release resources.
</ul>
</ol>

<h3>Device Monitor </h3>
<ol>
@@ -628,7 +628,7 @@ can track down problems you might have identified while viewing heap updates.</p


<p>To retrieve your heap dump from within Android Studio, use the
<a href="{@docRoot}tools/studio/index.html#me-cpu">Memory Monitor</a> and
<a href="{@docRoot}tools/studio/index.html#mem-cpu">Memory Monitor</a> and
<a href="{@docRoot}tools/studio/index.html#heap-dump">HPROF viewer</a>.  

<p>You can also still perform these procedures in the Android monitor:</p>
@@ -655,10 +655,12 @@ HPROF tool. The major difference in an Android heap dump is due to the fact that
number of allocations in the Zygote process. But because the Zygote allocations are shared across
all app processes, they don’t matter very much to your own heap analysis.</p>

<p>To analyze your heap dump, you can use a standard tool like jhat or the <a href=
"http://www.eclipse.org/mat/downloads.php">Eclipse Memory Analyzer Tool</a> (MAT). However, first
<p>To analyze your heap dump, you can use <a href=
"{@docRoot}tools/help/am-memory.html">Memory Monitor</a> in Android Studio. 
You can also use a standard tool like jhat. However, first
you'll need to convert the HPROF file from Android's format to the J2SE HPROF format. You can do
this using the <code>hprof-conv</code> tool provided in the <code>&lt;sdk&gt;/platform-tools/</code>
this using the <code>hprof-conv</code> tool provided in the 
<code>&lt;sdk&gt;/platform-tools/</code>
directory. Simply run the <code>hprof-conv</code> command with two arguments: the original HPROF
file and the location to write the converted HPROF file. For example:</p>

@@ -666,11 +668,9 @@ file and the location to write the converted HPROF file. For example:</p>
hprof-conv heap-original.hprof heap-converted.hprof
</pre>

<p class="note"><strong>Note:</strong> If you're using the version of DDMS that's integrated into
Eclipse, you do not need to perform the HPROF conversation—it performs the conversion by
default.</p>

<p>You can now load the converted file in MAT or another heap analysis tool that understands

<p>You can now load the converted file into a heap analysis tool that understands
the J2SE HPROF format.</p>

<p>When analyzing your heap, you should look for memory leaks caused by:</p>
@@ -682,77 +682,6 @@ reference to the container Activity or Context.</li>
</ul>


<h3 id="EclipseMat">Using the Eclipse Memory Analyzer Tool</h3>

<p>The <a href=
"http://www.eclipse.org/mat/downloads.php">Eclipse Memory Analyzer Tool</a> (MAT) is just one
tool that you can use to analyze your heap dump. It's also quite powerful so most of its
capabilities are beyond the scope of this document, but here are a few tips to get you started.

<p>Once you open your converted HPROF file in MAT, you'll see a pie chart in the Overview,
showing what your largest objects are. Below this chart, are links to couple of useful features:</p>

<ul>
  <li>The <strong>Histogram view</strong> shows a list of all classes and how many instances
  there are of each.
  <p>You might want to use this view to find extra instances of classes for which you know there
  should be only a certain number. For example, a common source of leaks is additional instance of
  your {@link android.app.Activity} class, for which you should usually have only one instance
  at a time. To find a specific class instance, type the class name into the <em>&lt;Regex></em>
  field at the top of the list.
  <p>When you find a class with too many instances, right-click it and select
  <strong>List objects</strong> &gt; <strong>with incoming references</strong>. In the list that
  appears, you can determine where an instance is retained by right-clicking it and selecting
  <strong>Path To GC Roots</strong> &gt; <strong>exclude weak references</strong>.</p>
  </li>

  <li>The <strong>Dominator tree</strong> shows a list of objects organized by the amount
  of retained heap.
  <p>What you should look for is anything that's retaining a portion of heap that's roughly
  equivalent to the memory size you observed leaking from the <a href="#LogMessages">GC logs</a>,
  <a href="#ViewHeap">heap updates</a>, or <a href="#TrackAllocations">allocation
  tracker</a>.
  <p>When you see something suspicious, right-click on the item and select
  <strong>Path To GC Roots</strong> &gt; <strong>exclude weak references</strong>. This opens a
  new tab that traces the references to that object which is causing the alleged leak.</p>

  <p class="note"><strong>Note:</strong> Most apps will show an instance of
  {@link android.content.res.Resources} near the top with a good chunk of heap, but this is
  usually expected when your app uses lots of resources from your {@code res/} directory.</p>
  </li>
</ul>


<img src="{@docRoot}images/tools/mat-histogram@2x.png" width="760" alt="" />
<p class="img-caption"><strong>Figure 4.</strong> The Eclipse Memory Analyzer Tool (MAT),
showing the Histogram view and a search for "MainActivity".</p>

<p>For more information about MAT, watch the Google I/O 2011 presentation,
<a href="http://www.youtube.com/watch?v=_CruQY55HOk">Memory management for Android apps</a>,
which includes a walkthrough using MAT beginning at about <a href=
"http://www.youtube.com/watch?v=_CruQY55HOk&amp;feature=player_detailpage#t=1270">21:10</a>.
Also refer to the <a href="http://wiki.eclipse.org/index.php/MemoryAnalyzer">Eclipse Memory
Analyzer documentation</a>.</p>

<h4 id="MatCompare">Comparing heap dumps</h4>

<p>You may find it useful to compare your app's heap state at two different points in time in order
to inspect the changes in memory allocation. To compare two heap dumps using MAT:</p>

<ol>
  <li>Create two HPROF files as described above, in <a href="#HeapDump">Capturing a Heap Dump</a>.
  <li>Open the first HPROF file in MAT (<strong>File</strong> > <strong>Open Heap Dump</strong>).
  <li>In the Navigation History view (if not visible, select <strong>Window</strong> >
  <strong>Navigation History</strong>), right-click on <strong>Histogram</strong> and select
  <strong>Add to Compare Basket</strong>.
  <li>Open the second HPROF file and repeat steps 2 and 3.
  <li>Switch to the <em>Compare Basket</em> view and click <strong>Compare the Results</strong>
  (the red "!" icon in the top-right corner of the view).
</ol>






<h2 id="TriggerLeaks">Triggering Memory Leaks</h2>
Loading