• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1page.title=Troubleshooting
2parent.title=FAQs, Tips, and How-to
3parent.link=index.html
4@jd:body
5
6
7<p>Here are some tips and tricks for common Android errors. Don't forget to use the
8    ddms logcat capability to get a deeper view when errors occur. See <a href="{@docRoot}guide/developing/debug-tasks.html">Debugging</a> for more debugging tips. </p>
9<ul>
10    <li><a href="#installeclipsecomponents">ADT Installation Error: "requires plug-in org.eclipse.wst.sse.ui".</a></li>
11    <li><a href="#nodevice">ADB reports &quot;no device&quot; when an emulator is running</a></li>
12    <li><a href="#noapp">My new application/activity isn't showing up in the device application
13        list </a></li>
14    <li><a href="#noupdate">I updated my app, but the updates don't seem to be showing up on
15    the device</a></li>
16    <li><a href="#layout_wilih">I'm getting a &quot;Binary XML file line #2: You must supply a layout_wilih
17    attribute&quot; error when I start an application</a></li>
18    <li><a href="#permission">My request to (<em>make a call, catch an incoming SMS, receive
19        a notification, send an intent to an Android application</em>) is being
20        ignored</a></li>
21    <li><a href="#build">Help! My project won't build in Eclipse</a></li>
22    <li><a href="#eclipse">Eclipse isn't talking to the emulator</a></li>
23    <li><a href="#majorminor">When I go to preferences in Eclipse and select "Android", I get the following error message: Unsupported major.minor version 49.0.</a></li>
24    <li><a href="#apidemosreinstall">I can't install ApiDemos apps in my IDE because of a signing error</a></li>
25    <li><a href="#signingcalendar">I can't compile my app because the build tools generated an expired debug certificate</a></li>
26</ul>
27
28<a name="installeclipsecomponents" id="installeclipsecomponents"></a><h2>ADT Installation Error: "requires plug-in org.eclipse.wst.sse.ui".</h2>
29<p>
30The "Android Editors" feature of the ADT Plugin requires specific Eclipse components, such as WST. If you
31encounter this error message during ADT installation, you need to install the
32required Eclipse components and then try the ADT installation again. Follow the steps below to install the required components for the
33Android Editors feature, based on the version of Eclipse that you are using.</p>
34
35<table style="font-size:100%">
36<tr><th>Eclipse 3.3 (Europa)</th><th>Eclipse 3.4 (Ganymede)</th></tr>
37<tr>
38<td width="50%">
39<ol>
40<li>From the dialog where you select the <strong>Update sites to visit</strong>, select the checkboxes for both the
41ADT site, and the Callisto/Europa/Ganymede Discovery Site (you may want to
42check <strong>Automatically select mirrors</strong> at the bottom).</li>
43<li>Click <strong>Finish</strong>.</li>
44<li>In the <strong>Next</strong> dialog, select the Android Plugins.</li>
45<li>Now, expand the tree item of the discovery site. It seems that if you
46don't do it, it doesn't load the content of the discovery site.</li>
47<li>On the right, click <strong>Select required</strong>. This will select all the components
48that are required to install the Android plugin (wst, emf, etc...).</li>
49<li>Click <strong>Next</strong>, accept the agreement, click <strong>Install All</strong>, and restart Eclipse.</li>
50</ol>
51</td>
52<td>
53<ol>
54    <li>Select <strong>Help</strong> &gt; <strong>Software Updates...</strong></li>
55    <li>Select the <strong>Installed Software</strong> tab.</li>
56    <li>Click <strong>Update...</strong></li>
57    <li>If an update for ADT is available, select it and click <strong>Finish</strong>.</li>
58</ol>
59</td>
60</tr>
61</table>
62
63
64</p>
65<a name="nodevice"></a><h2>ADB reports &quot;no device&quot; when an emulator is running</h2>
66    <p>Try restarting adb by stopping it (<code>adb
67        kill-server</code>) then any other adb command to restart it.</p>
68
69<a name="noapp"></a><h2>My new application/activity isn't showing up in the
70        applications list </h2>
71<ul>
72    <li>You often must restart your device or emulator before a new activity shows
73        up in the applications list. This is particularly true when it is a completely
74        new application with a new AndroidManifest.xml file.</li>
75    <li>If this is for a new activity in an existing AndroidManifest.xml file, did
76        you include an <code>&lt;activity&gt;</code> tag for your app (or a <code>&lt;service&gt;</code>        tag
77        for a service, or a <code>&lt;receiver&gt;</code> tag for a receiver, etc.)? </li>
78    <li>Make sure that your AndroidManifest.xml file is valid. Errors in attribute
79        values, such as the <em>value </em> attribute in <code>&lt;action <em>value</em>=&quot;<em>&lt;something&gt;</em>&quot;&gt;</code>
80        will often not be caught by compilers, but will prevent your application
81        from being displayed because the intent filter will not be matched. Extra
82        spaces or other characters can often sneak into these strings.</li>
83    <li>Did you send your .apk file to the device (<a href="{@docRoot}guide/developing/tools/adb.html#move">adb install</a>)?</li>
84    <li>Run logcat on your device (<code>adb logcat</code>)
85        and then install your .apk file. Check the logcat output to see whether the
86        application is being installed and recognized properly. Here's sample output
87        from a successful installation:
88<pre>I/FileObserver( 414): *** onEvent wfd: 3 mask: 8 path: MyRSSReader.apk
89D/PackageManager( 414): Scanning package: /data/app/MyRSSReader.apk
90D/PackageManager( 414): Adding package com.example.codelab.rssexample
91D/PackageManager( 414): Registered content provider: my_rss_item, className = com.example.codelab.rssexample.RssContentProvider, isSyncable = false
92D/PackageManager( 414): Providers: com.example.codelab.rssexample.RssContentProvider
93D/PackageManager( 414): Activities: com.example.codelab.rssexample.MyRssReader com.example.codelab.rssexample.MyRssReader2 </pre>
94    </li>
95	<li>If logcat shows that the package manager is having problems loading the manifest
96	    file, force your manifest to be recompiled by adding a space in the file and
97	    compiling it.</li>
98</ul>
99<a name="noupdate"></a><h2>I updated my app, but the updates don't seem to be showing up on the device</h2>
100    <p>Did you remember to send your .apk file to the device (<a href="{@docRoot}guide/developing/tools/adb.html#move">adb
101        install</a>)?</p>
102
103<a name="layout_wilih"></a><h2>I'm getting a &quot;Binary XML file line #2: You must supply a layout_wilih
104    attribute&quot; error
105    when I start an application (but I declare a layout_wilih attribute <em>right
106        there!!!</em>)</h2>
107<ul>
108    <li>Make sure that the SDK you are building with is the same version as the Android
109        OS that you are running on. </li>
110    <li>Make sure that you're calling setContentView() early in your onCreate() method.
111        Calling other methods, such as setListAdapter() before calling setContentView()
112        can sometimes create odd errors when Android tries to access screen elements
113        that haven't been set before.</li>
114</ul>
115<a name="permission"></a><h2>My request to (<em>make a call, catch an incoming SMS,
116receive a notification, send an intent to an Android application</em>) is being
117ignored</h2>
118    <p>You might not have permission (or might not have requested permission) to
119        call this activity or receive this intent. Many standard Android activities,
120        such as making a call, have a permission assigned to it to prevent arbitrary
121        applications from sending or receiving requests. See <a
122        href="{@docRoot}guide/topics/security/security.html">Security and
123        Permissions</a> for more information on permissions, and
124		{@link android.Manifest.permission Manifest.permission} for a list of
125        standard permissions supported by the Android platform.
126</p>
127<a name="build"></a><h2>Help! My project won't build in Eclipse</h2>
128<p>If your project doesn't build, you may notice symptoms such as new
129resources added in the <code>res/</code> sub-folders not showing up in the R class,
130the emulator not being started, not being able to run the application, or even seeming to run an old version of the application.</p>
131<p>To troubleshoot these types of problems, first try:</p>
132<ol>
133  <li>Switch to the DDMS view in Eclipse (if you don't already have it open):
134    <ol type="a">
135      <li>From the menu select <code>Window &gt; Open Perspective &gt; Other</code></li>
136      <li>Select DDMS from the list and hit OK</li>
137    </ol>
138  </li>
139  <li>In the Devices panel (top right panel by default), click on the down triangle
140  to bring up the panel menu</li>
141  <li>Select <code>Reset ADB</code> from the menu, and then try running the
142  application again</li>
143</ol>
144<p>If the above still doesn't work, you can try these steps:</p>
145<ol>
146  <li>
147    Check the console and problems tabs at the bottom of the Eclipse UI
148  </li>
149  <li>
150    If there are problems listed in either place, they should give you a clue
151    what is wrong
152  </li>
153  <li>
154    If you aren't sure if the problems are fresh or stale, clear the console
155    with a right click &gt; Clear, then clean the project
156  </li>
157  <li>
158    To clean the project (a good idea with any kind of build error), select
159    Project &gt; Clean from the eclipse main menu, then select the project you
160    are working on (or clean all)
161  </li>
162</ol>
163<a name="eclipse"></a><h2>Eclipse isn't talking to the emulator</h2>
164<p>When communication doesn't seem to be happening between Eclipse and the emulator, symptoms can include: nothing happening when you press run, the emulator hanging waiting
165for a debugger to connect, or errors that Eclipse reports about not being able
166to find the emulator or shell. By far the most common symptom is that when you press run, the emulator starts (or
167is already running), but the application doesn't start.</p>
168<p>
169You may find any of these steps will fix the problem and with practice you
170probably can figure out which one you need to do for your particular issue, but
171to start with, the safest option is to run through all of them in order:</p>
172<ol>
173  <li>
174    Quit the emulator if it is running
175  </li>
176  <li>
177    Check that any emulator processes are killed (sometimes they    can hang, use ps on unix or mac, or task manager in the process view on
178    windows).
179  </li>
180  <li>
181    Quit Eclipse
182  </li>
183  <li>
184    From the command line, type:
185<pre>adb kill-server </pre>
186  </li>
187  <li>
188    Start Eclipse and try again
189  </li>
190</ol>
191
192<a name="majorminor"></a><h2>When I go to preferences in Eclipse and select "Android", I get the following error message: Unsupported major.minor version 49.0.</h2>
193<p>This error is displayed if you are using an older version of the JDK. Please make sure you are using JDK version 5 or 6.</p>
194
195<h2 id="apidemosreinstall">I can't install ApiDemos apps in my IDE because of a signing error</a></h2>
196
197<p>The Android system requires that all applications be signed, as described in
198	<a href="{@docRoot}guide/publishing/app-signing.html">Signing Your Applications</a>. The ApiDemos
199applications included with the SDK are preinstalled on the emulator and for that reason have been
200compiled and signed with a private key.</p>
201
202If you want to modify or run one of the ApiDemos apps from Eclipse/ADT or other IDE, you can do so
203so only after you uninstall the <em>preinstalled</em> version of the app from the emulator. If
204you try to run an ApiDemos apps from your IDE without removing the preinstalled version first,
205you will get errors similar to: </p>
206
207<pre>[2008-08-13 15:14:15 - ApiDemos] Re-installation failed due to different application signatures.
208[2008-08-13 15:14:15 - ApiDemos] You must perform a full uninstall of the application. WARNING: ...This will remove the application data!
209[2008-08-13 15:14:15 - ApiDemos] Please execute 'adb uninstall com.android.samples' in a shell.</pre>
210
211<p>The error occurs because, in this case, you are attempting to install another copy of ApiDemos
212onto the emulator, a copy that is signed with a different certificate (the Android IDE tools will
213have signed the app with a debug certificate, where the existing version was already signed with
214a private certificate). The system does not allow this type of reinstallation.  </p>
215
216<p>To resolve the issue, you need to fully uninstall the preinstalled and then reinstall it using
217the adb tool. Here's how to do that:</p>
218
219<ol>
220  <li>In a terminal, change to the tools directory of the SDK.</li>
221  <li>If no emulator instance is running, start an emulator using using the command <code>emulator &</code>.</li>
222  <li>Uninstall the preinstalled app using the command <code>adb uninstall com.android.samples</code>.</li>
223  <li>Reinstall the app using the command <code>adb install &lt;path to the ApiDemos.apk&gt;</code>. If you are
224  working in Eclipse/ADT, you can just compile and run the app in the normal way. </li>
225</ol>
226
227<p>Note that if multiple emulator instances are running, you need to direct your uninstall/install
228commands to the emulator instance that you are targeting. To do that you can add the
229<code>-s &lt;serialNumber&gt;</code> to the command, for example: </p>
230
231<pre>adb -s emulator-5556 install</pre>
232
233<p>For more information about adb, see the <a href="{@docRoot}guide/developing/tools/adb.html">Android Debug Bridge</a>
234documentation.</p>
235
236
237<h2 id="signingcalendar">I can't compile my app because the build tools generated an expired debug certificate</h2>
238
239<p>If your development machine uses a locale that has a non-Gregorian calendar, you may encounter problems when first trying to compile and run your application. Specifically, you may find that the Android build tools won't compile your application because the debug key is expired. </p>
240
241<p>The problem occurs because the Keytool utility &mdash; included in the JDK and used by the Android build tools &mdash; fails to properly handle non-Gregorian locales and may create validity dates that are in the past. That is, it may generate a debug key that is already expired, which results in the compile error.</p>
242
243<p>If you encounter this problem, follow these steps to work around it: </p>
244
245<ol>
246<li>First, delete the debug keystore/key already generated by the Android build tools. Specifically, delete the <code>debug.keystore</code> file. On Linux/Mac OSX, the file is stored in <code>~/.android</code>. On Windows XP, the file is stored in <code>
247C:\Documents and Settings\&lt;user&gt;\.android</code>. On Windows Vista, the file is stored in <code>
248C:\Users\&lt;user&gt;\.android</code></li>
249<li>Next, you can either
250<ul>
251<li>Temporarily change your development machine's locale (date and time) to one that uses a Gregorian calendar, for example, United States. Once the locale is changed, use the Android build tools to compile and install your app. The build tools will regenerate a new keystore and debug key with valid dates. Once the new debug key is generated, you can reset your development machine to the original locale. </li>
252<li>Alternatively, if you do not want to change your machine's locale settings, you can generate the keystore/key on any machine using the Gregorian calendar, then copy the <code>debug.keystore</code> file from that computer to the proper location on your development machine. </li>
253</ul>
254</li>
255</ol>
256
257<p>This problem has been verified on Windows and may apply to other platforms. </p>
258
259<p>For general information about signing Android applications, see
260<a href="{@docRoot}guide/publishing/app-signing.html">Signing Your Applications</a>. </p>
261
262