I am testing the example given on http://developer.android.com/resources/tutorials/notepad/notepad-ex1.html.
I have followed the steps as mentioned in the tutorial. The application is successfully launched in the emulator
But when i click on the menu button error comes
When i check in eclipse console it does not show any error.
When i open DDMS perspective in eclipse and go to the File Explorer. Inside File Explorer when i go to the data/data/com.android.demo.notepad1/. I see two folders one showing 5120 size.
Under Log Cat following error is coming:
04-05 16:19:07.267: ERROR/AndroidRuntime(345): FATAL EXCEPTION: main
04-05 16:19:07.267: ERROR/AndroidRuntime(345): android.content.res.Resources$NotFoundException: String resource ID #0x7f040002
04-05 16:19:07.267: ERROR/AndroidRuntime(345): at android.content.res.Resources.getText(Resources.java:201)
04-05 16:19:07.267: ERROR/AndroidRuntime(345): at android.content.res.Resources.getString(Resources.java:254)
04-05 16:19:07.267: ERROR/AndroidRuntime(345): at com.android.internal.view.menu.MenuBuilder.add(MenuBuilder.java:397)
04-05 16:19:07.267: ERROR/AndroidRuntime(345): at com.android.demo.notepad1.Notepadv1.onCreateOptionsMenu(Notepadv1.java:45)
04-05 16:19:07.267: ERROR/AndroidRuntime(345): at android.app.Activity.onCreatePanelMenu(Activity.java:2158)
04-05 16:19:07.267: ERROR/AndroidRuntime(345): at com.android.internal.policy.impl.PhoneWindow.preparePanel(PhoneWindow.java:323)
04-05 16:19:07.267: ERROR/AndroidRuntime(345): at com.android.internal.policy.impl.PhoneWindow.onKeyDownPanel(PhoneWindow.java:568)
04-05 16:19:07.267: ERROR/AndroidRuntime(345): at com.android.internal.policy.impl.PhoneWindow.onKeyDown(PhoneWindow.java:1210)
04-05 16:19:07.267: ERROR/AndroidRuntime(345): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1668)
04-05 16:19:07.267: ERROR/AndroidRuntime(345): at android.view.ViewRoot.deliverKeyEventToViewHierarchy(ViewRoot.java:2560)
04-05 16:19:07.267: ERROR/AndroidRuntime(345): at android.view.ViewRoot.handleFinishedEvent(ViewRoot.java:2535)
04-05 16:19:07.267: ERROR/AndroidRuntime(345): at android.view.ViewRoot.handleMessage(ViewRoot.java:1867)
04-05 16:19:07.267: ERROR/AndroidRuntime(345): at android.os.Handler.dispatchMessage(Handler.java:99)
04-05 16:19:07.267: ERROR/AndroidRuntime(345): at android.os.Looper.loop(Looper.java:123)
04-05 16:19:07.267: ERROR/AndroidRuntime(345): at android.app.ActivityThread.main(ActivityThread.java:3683)
04-05 16:19:07.267: ERROR/AndroidRuntime(345): at java.lang.reflect.Method.invokeNative(Native Method)
04-05 16:19:07.267: ERROR/AndroidRuntime(345): at java.lang.reflect.Method.invoke(Method.java:507)
04-05 16:19:07.267: ERROR/AndroidRuntime(345): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
04-05 16:19:07.267: ERROR/AndroidRuntime(345): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
04-05 16:19:07.267: ERROR/AndroidRuntime(345): at dalvik.system.NativeStart.main(Native Method)
04-05 16:19:07.366: WARN/ActivityManager(67): Force finishing activity com.android.demo.notepad1/.Notepadv1
04-05 16:19:07.926: WARN/ActivityManager(67): Activity pause timeout for HistoryRecord{405525f0 com.android.demo.notepad1/.Notepadv1}
04-05 16:19:19.540: WARN/ActivityManager(67): Activity destroy timeout for HistoryRecord{405525f0 com.android.demo.notepad1/.Notepadv1}
04-05 16:20:39.455: DEBUG/SntpClient(67): request time failed: java.net.SocketException: Address family not supported by protocol
04-05 16:24:11.534: INFO/Process(345): Sending signal. PID: 345 SIG: 9
04-05 16:24:12.428: ERROR/InputDispatcher(67): channel '406a5ed8 com.android.demo.notepad1/com.android.demo.notepad1.Notepadv1 (server)' ~ Consumer closed input channel or an error occurred. events=0x8
04-05 16:24:12.468: ERROR/InputDispatcher(67): channel '406a5ed8 com.android.demo.notepad1/com.android.demo.notepad1.Notepadv1 (server)' ~ Channel is unrecoverably broken and will be disposed!
04-05 16:24:12.572: INFO/ActivityManager(67): Process com.android.demo.notepad1 (pid 345) has died.
04-05 16:24:12.719: INFO/WindowManager(67): WIN DEATH: Window{406a5ed8 com.android.demo.notepad1/com.android.demo.notepad1.Notepadv1 paused=false}
Please help me trace out the reason for such error
Thanks
Pankaj
I have resolved the issue. Actually when i imported the project there was drawable folder along with drawable-hdpi, drawable-mdpi and drawable-ldpi folder.It was causing the conflict. I have removed the drawable folder and put the image which was in it to the hdpi,mdpi & ldpi folders. Now when i run the application, it works as expected.
I was having this problem also. I decided to try deleting the drawable-hdpi, drawable-ldpi, and drawable-mdpi directories. This didn't work. However, when diffing all the files in my solution versus the Notepadv1Solution, I noticed there seems to be a discrepancy in one of the xml files. On the notepad excercise 1 site under step 4, the xml for notepad_list.xml is written as
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ListView android:id="#android:id/list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView android:id="#android:id/empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/no_notes"/>
</LinearLayout>
However, in the Notepadv1Solution, this same file is written as
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ListView android:id="#id/android:list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView android:id="#id/android:empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/no_notes"/>
</LinearLayout>
When I replaced the code from the site with the code from the solution, it started working.
Related
Hi i tried NOKIA NOTIFICATION MESSAGING in android but i face the following error
LOG:
04-05 13:43:07.801: E/AndroidRuntime(1042): FATAL EXCEPTION: main
04-05 13:43:07.801: E/AndroidRuntime(1042): java.lang.NoClassDefFoundError: com.nokia.push.PushRegistrar
04-05 13:43:07.801: E/AndroidRuntime(1042): at com.example.nokiapush.NotificationsManager.<init>(NotificationsManager.java:68)
04-05 13:43:07.801: E/AndroidRuntime(1042): at com.example.nokiapush.NotificationsManager.getInstance(NotificationsManager.java:46)
04-05 13:43:07.801: E/AndroidRuntime(1042): at com.example.nokiapush.MainActivity.onCreate(MainActivity.java:65)
04-05 13:43:07.801: E/AndroidRuntime(1042): at android.app.Activity.performCreate(Activity.java:5180)
04-05 13:43:07.801: E/AndroidRuntime(1042): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
04-05 13:43:07.801: E/AndroidRuntime(1042): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2031)
04-05 13:43:07.801: E/AndroidRuntime(1042): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2092)
04-05 13:43:07.801: E/AndroidRuntime(1042): at android.app.ActivityThread.access$600(ActivityThread.java:133)
04-05 13:43:07.801: E/AndroidRuntime(1042): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1203)
04-05 13:43:07.801: E/AndroidRuntime(1042): at android.os.Handler.dispatchMessage(Handler.java:99)
04-05 13:43:07.801: E/AndroidRuntime(1042): at android.os.Looper.loop(Looper.java:137)
04-05 13:43:07.801: E/AndroidRuntime(1042): at android.app.ActivityThread.main(ActivityThread.java:4807)
04-05 13:43:07.801: E/AndroidRuntime(1042): at java.lang.reflect.Method.invokeNative(Native Method)
04-05 13:43:07.801: E/AndroidRuntime(1042): at java.lang.reflect.Method.invoke(Method.java:511)
04-05 13:43:07.801: E/AndroidRuntime(1042): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
04-05 13:43:07.801: E/AndroidRuntime(1042): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:559)
04-05 13:43:07.801: E/AndroidRuntime(1042): at dalvik.system.NativeStart.main(Native Method)
Make sure that you are also exporting that library. If you are not exporting, library is only available at build time. Select Build path properties from eclipse (if using that) and from "Order and Export" tab select push jar to be exported. If it is not visible there check that you are exporting private libraries and dependencies.
Make also sure that you are running your app in Android emulator that is having Nokia X image (build target is Nokia X)
Recently I've added ActionBarSherlock to my android project. After adding it and testing application on AVD version 4.1 everything was fine, but launching application at 2.3.3 gives the next type of errors when starting activity at setContentView:
> 04-05 18:55:03.277: E/AndroidRuntime(659): FATAL EXCEPTION: main
04-05 18:55:03.277: E/AndroidRuntime(659): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.fitness.calculator/com.fitness.calculator.ProportionsActivity}: android.view.InflateException: Binary XML file line #26: Error inflating class com.actionbarsherlock.internal.widget.ActionBarContainer
04-05 18:55:03.277: E/AndroidRuntime(659): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
04-05 18:55:03.277: E/AndroidRuntime(659): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
04-05 18:55:03.277: E/AndroidRuntime(659): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
04-05 18:55:03.277: E/AndroidRuntime(659): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
04-05 18:55:03.277: E/AndroidRuntime(659): at android.os.Handler.dispatchMessage(Handler.java:99)
04-05 18:55:03.277: E/AndroidRuntime(659): at android.os.Looper.loop(Looper.java:123)
04-05 18:55:03.277: E/AndroidRuntime(659): at android.app.ActivityThread.main(ActivityThread.java:3683)
04-05 18:55:03.277: E/AndroidRuntime(659): at java.lang.reflect.Method.invokeNative(Native Method)
04-05 18:55:03.277: E/AndroidRuntime(659): at java.lang.reflect.Method.invoke(Method.java:507)
04-05 18:55:03.277: E/AndroidRuntime(659): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
04-05 18:55:03.277: E/AndroidRuntime(659): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
04-05 18:55:03.277: E/AndroidRuntime(659): at dalvik.system.NativeStart.main(Native Method)
04-05 18:55:03.277: E/AndroidRuntime(659): Caused by: android.view.InflateException: Binary XML file line #26: Error inflating class com.actionbarsherlock.internal.widget.ActionBarContainer
04-05 18:55:03.277: E/AndroidRuntime(659): at android.view.LayoutInflater.createView(LayoutInflater.java:518)
04-05 18:55:03.277: E/AndroidRuntime(659): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:570)
04-05 18:55:03.277: E/AndroidRuntime(659): at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
04-05 18:55:03.277: E/AndroidRuntime(659): at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
04-05 18:55:03.277: E/AndroidRuntime(659): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
04-05 18:55:03.277: E/AndroidRuntime(659): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
04-05 18:55:03.277: E/AndroidRuntime(659): at com.actionbarsherlock.internal.ActionBarSherlockCompat.generateLayout(ActionBarSherlockCompat.java:1045)
04-05 18:55:03.277: E/AndroidRuntime(659): at com.actionbarsherlock.internal.ActionBarSherlockCompat.installDecor(ActionBarSherlockCompat.java:915)
04-05 18:55:03.277: E/AndroidRuntime(659): at com.actionbarsherlock.internal.ActionBarSherlockCompat.setContentView(ActionBarSherlockCompat.java:849)
04-05 18:55:03.277: E/AndroidRuntime(659): at com.actionbarsherlock.app.SherlockActivity.setContentView(SherlockActivity.java:229)
04-05 18:55:03.277: E/AndroidRuntime(659): at com.fitness.calculator.MainMenuActivity.onCreate(MainMenuActivity.java:45)
04-05 18:55:03.277: E/AndroidRuntime(659): at com.fitness.calculator.ProportionsActivity.onCreate(ProportionsActivity.java:90)
04-05 18:55:03.277: E/AndroidRuntime(659): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-05 18:55:03.277: E/AndroidRuntime(659): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
04-05 18:55:03.277: E/AndroidRuntime(659): ... 11 more
04-05 18:55:03.277: E/AndroidRuntime(659): Caused by: java.lang.reflect.InvocationTargetException
04-05 18:55:03.277: E/AndroidRuntime(659): at java.lang.reflect.Constructor.constructNative(Native Method)
04-05 18:55:03.277: E/AndroidRuntime(659): at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
04-05 18:55:03.277: E/AndroidRuntime(659): at android.view.LayoutInflater.createView(LayoutInflater.java:505)
04-05 18:55:03.277: E/AndroidRuntime(659): ... 24 more
04-05 18:55:03.277: E/AndroidRuntime(659): Caused by: java.lang.NoSuchMethodError: com.actionbarsherlock.internal.widget.ActionBarContainer.setBackground
04-05 18:55:03.277: E/AndroidRuntime(659): at com.actionbarsherlock.internal.widget.ActionBarContainer.<init>(ActionBarContainer.java:58)
04-05 18:55:03.277: E/AndroidRuntime(659): ... 27 more
Does anybody have an idea what could cause that type of error? Any ideas? I can't find a solution for this problem.
I fixed this problem by re-adding clear ActionBarSherlock library. First time I have fixed all warnings in library, and that caused the problem. So don't try to fix warnings in ActionBarSherlock. Hope this will help somebody.
I just added the GreenDroid Library into my Application. I extended the startview with GDActivity and added the NFFApplication and added into the Manifest under the application tag android:name=".logic.NFFApplication".
NFFAplication:
public class NFFApplication extends GDApplication {
#Override
public Class<?> getHomeActivityClass() {
return NFFApplication.class;
}
#Override
public Intent getMainApplicationIntent() {
return new Intent(NFFApplication.this,MainView.class);
}
}
Login Activity:
public class LoginView extends GDActivity {
private ProgressDialog pd = null;
Editor editor = null;
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setTitle("Movie");
setActionBarContentView(R.layout.loginlayout);
LogCat:
04-05 16:12:16.714: E/AndroidRuntime(443): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.korn.nff/com.korn.nff.view.LoginView}: android.view.InflateException: Binary XML file line #27: Error inflating class greendroid.widget.ActionBar
04-05 16:12:16.714: E/AndroidRuntime(443): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
04-05 16:12:16.714: E/AndroidRuntime(443): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
04-05 16:12:16.714: E/AndroidRuntime(443): at android.app.ActivityThread.access$2200(ActivityThread.java:119)
04-05 16:12:16.714: E/AndroidRuntime(443): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
04-05 16:12:16.714: E/AndroidRuntime(443): at android.os.Handler.dispatchMessage(Handler.java:99)
04-05 16:12:16.714: E/AndroidRuntime(443): at android.os.Looper.loop(Looper.java:123)
04-05 16:12:16.714: E/AndroidRuntime(443): at android.app.ActivityThread.main(ActivityThread.java:4363)
04-05 16:12:16.714: E/AndroidRuntime(443): at java.lang.reflect.Method.invokeNative(Native Method)
04-05 16:12:16.714: E/AndroidRuntime(443): at java.lang.reflect.Method.invoke(Method.java:521)
04-05 16:12:16.714: E/AndroidRuntime(443): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
04-05 16:12:16.714: E/AndroidRuntime(443): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
04-05 16:12:16.714: E/AndroidRuntime(443): at dalvik.system.NativeStart.main(Native Method)
04-05 16:12:16.714: E/AndroidRuntime(443): Caused by: android.view.InflateException: Binary XML file line #27: Error inflating class greendroid.widget.ActionBar
04-05 16:12:16.714: E/AndroidRuntime(443): at android.view.LayoutInflater.createView(LayoutInflater.java:513)
04-05 16:12:16.714: E/AndroidRuntime(443): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
04-05 16:12:16.714: E/AndroidRuntime(443): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
04-05 16:12:16.714: E/AndroidRuntime(443): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
04-05 16:12:16.714: E/AndroidRuntime(443): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
04-05 16:12:16.714: E/AndroidRuntime(443): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
04-05 16:12:16.714: E/AndroidRuntime(443): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
04-05 16:12:16.714: E/AndroidRuntime(443): at android.app.Activity.setContentView(Activity.java:1622)
04-05 16:12:16.714: E/AndroidRuntime(443): at greendroid.app.GDActivity.ensureLayout(GDActivity.java:187)
04-05 16:12:16.714: E/AndroidRuntime(443): at greendroid.app.GDActivity.getActionBar(GDActivity.java:265)
04-05 16:12:16.714: E/AndroidRuntime(443): at greendroid.app.GDActivity.setTitle(GDActivity.java:256)
04-05 16:12:16.714: E/AndroidRuntime(443): at com.korn.nff.view.LoginView.onCreate(LoginView.java:39)
04-05 16:12:16.714: E/AndroidRuntime(443): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-05 16:12:16.714: E/AndroidRuntime(443): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
04-05 16:12:16.714: E/AndroidRuntime(443): ... 11 more
04-05 16:12:16.714: E/AndroidRuntime(443): Caused by: java.lang.reflect.InvocationTargetException
04-05 16:12:16.714: E/AndroidRuntime(443): at greendroid.widget.ActionBar.<init>(ActionBar.java:130)
04-05 16:12:16.714: E/AndroidRuntime(443): at java.lang.reflect.Constructor.constructNative(Native Method)
04-05 16:12:16.714: E/AndroidRuntime(443): at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
04-05 16:12:16.714: E/AndroidRuntime(443): at android.view.LayoutInflater.createView(LayoutInflater.java:500)
04-05 16:12:16.714: E/AndroidRuntime(443): ... 24 more
04-05 16:12:16.714: E/AndroidRuntime(443): Caused by: android.content.res.Resources$NotFoundException: File res/drawable-hdpi/title_bar_shadow.9.png from drawable resource ID #0x0
04-05 16:12:16.714: E/AndroidRuntime(443): at android.content.res.Resources.loadDrawable(Resources.java:1710)
04-05 16:12:16.714: E/AndroidRuntime(443): at android.content.res.TypedArray.getDrawable(TypedArray.java:548)
04-05 16:12:16.714: E/AndroidRuntime(443): at android.view.View.<init>(View.java:1850)
04-05 16:12:16.714: E/AndroidRuntime(443): at android.view.View.<init>(View.java:1799)
04-05 16:12:16.714: E/AndroidRuntime(443): at android.view.ViewGroup.<init>(ViewGroup.java:284)
04-05 16:12:16.714: E/AndroidRuntime(443): at android.widget.LinearLayout.<init>(LinearLayout.java:92)
04-05 16:12:16.714: E/AndroidRuntime(443): at greendroid.widget.ActionBar.<init>(ActionBar.java:134)
04-05 16:12:16.714: E/AndroidRuntime(443): ... 28 more
04-05 16:12:16.714: E/AndroidRuntime(443): Caused by: java.io.FileNotFoundException: res/drawable-hdpi/title_bar_shadow.9.png
04-05 16:12:16.714: E/AndroidRuntime(443): at android.content.res.AssetManager.openNonAssetNative(Native Method)
04-05 16:12:16.714: E/AndroidRuntime(443): at android.content.res.AssetManager.openNonAsset(AssetManager.java:390)
04-05 16:12:16.714: E/AndroidRuntime(443): at android.content.res.Resources.loadDrawable(Resources.java:1702)
I'm not 100% sure if this is the issue, but can it be that you've forgotten to override the theme? Greendroid needs a custom theme for the application to run.
Here's the line in the greendroid documentation:
You finally need to make your project use the GreenDroid base theme. In your AndroidManifest.xml, go to the application tag and add android:theme="#style/Theme.GreenDroid" as a new attribute.
Steps you have to follow:
Download the GreenDroid library on your computer with a simple: git
clone http://github.com/cyrilmottier/GreenDroid.git. As usual, Git
will clone the GreenDroid repository and create a folder GreenDroid
that contains a 3 folders:
GreenDroid: the core library. This is the code that will be mostly linked to your code
GreenDroid-GoogleAPIs: GreenDroid's extension including Google APIs related features (GDMapActivity for instance)
GDCatalog: the demonstration application. This project contains a lot of snippet of code showing you how to use GreenDroid.
Since May 2010, the ADT plugin added an amazing new feature: the
ability to work with library projects. Using GreenDroid consists on
applying the GreenDroid project as a library to your application. A
complete description on how to use library projects is given on the
Android documentation website. Make sure your development
environment uses the latest tools and platforms, since older
releases of the tools and platforms do not support building with
library project.
In case you want to use some Google APIs features, make sure you are
using the GreenDroid-GoogleAPIs library. GreenDroid-GoogleAPIs is
based on GreenDroid. As a result, you don't need to link GreenDroid
as an Android library to your project. By default, the GreenDroid
theme inherits from #android:style/Theme. If your project inherits
from a different theme, you'll have to modify the GreenDroid library
on your own (and do that everytime you are updating GreenDroid as
updating deletes all of your changes - still working on a way to
overcome that problem). Open the res/values/gd_themes.xml and
replace the parent theme #android:style/Theme with your own theme.
A lot of GreenDroid's feature (GDActivity, GDListActivity or
GDTabActivity for instance) requires your application to be a
GDApplication so make sure your application is a GDApplication
class. In order to do that, simply add
android:name="greendroid.app.GDApplication (where
greendroid.app.GDApplication may be replaced by your own class that
inherits from GDApplication) in the application tag of your
AndroidManifest.xml.
You finally need to make your project use the GreenDroid base theme.
In your AndroidManifest.xml, go to the application tag and add
android:theme="#style/Theme.GreenDroid" as a new attribute.
Ok so i update to eclipse adt to version 17 and I get this error
04-05 12:28:55.810: E/AndroidRuntime(5470): FATAL EXCEPTION: main
04-05 12:28:55.810: E/AndroidRuntime(5470): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.galeola.agentis/com.galeola.agentis.activity.GestionaleActivity}: java.lang.ClassNotFoundException: com.galeola.agentis.activity.GestionaleActivity in loader dalvik.system.PathClassLoader[/system/framework/com.google.android.maps.jar:/data/app/com.galeola.agentis-1.apk]
04-05 12:28:55.810: E/AndroidRuntime(5470): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1742)
04-05 12:28:55.810: E/AndroidRuntime(5470): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1834)
04-05 12:28:55.810: E/AndroidRuntime(5470): at android.app.ActivityThread.access$500(ActivityThread.java:122)
04-05 12:28:55.810: E/AndroidRuntime(5470): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1027)
04-05 12:28:55.810: E/AndroidRuntime(5470): at android.os.Handler.dispatchMessage(Handler.java:99)
04-05 12:28:55.810: E/AndroidRuntime(5470): at android.os.Looper.loop(Looper.java:132)
04-05 12:28:55.810: E/AndroidRuntime(5470): at android.app.ActivityThread.main(ActivityThread.java:4126)
04-05 12:28:55.810: E/AndroidRuntime(5470): at java.lang.reflect.Method.invokeNative(Native Method)
04-05 12:28:55.810: E/AndroidRuntime(5470): at java.lang.reflect.Method.invoke(Method.java:491)
04-05 12:28:55.810: E/AndroidRuntime(5470): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:844)
04-05 12:28:55.810: E/AndroidRuntime(5470): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
04-05 12:28:55.810: E/AndroidRuntime(5470): at dalvik.system.NativeStart.main(Native Method)
04-05 12:28:55.810: E/AndroidRuntime(5470): Caused by: java.lang.ClassNotFoundException: com.galeola.agentis.activity.GestionaleActivity in loader dalvik.system.PathClassLoader[/system/framework/com.google.android.maps.jar:/data/app/com.galeola.agentis-1.apk]
04-05 12:28:55.810: E/AndroidRuntime(5470): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:251)
04-05 12:28:55.810: E/AndroidRuntime(5470): at java.lang.ClassLoader.loadClass(ClassLoader.java:540)
04-05 12:28:55.810: E/AndroidRuntime(5470): at java.lang.ClassLoader.loadClass(ClassLoader.java:500)
04-05 12:28:55.810: E/AndroidRuntime(5470): at android.app.Instrumentation.newActivity(Instrumentation.java:1022)
04-05 12:28:55.810: E/AndroidRuntime(5470): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1733)
04-05 12:28:55.810: E/AndroidRuntime(5470): ... 11 more
however if i move my libraries to /libs i can start the applications, but with the libraries in /libs javadoc and javasources stops working, while if they are not in /libs javadoc and javasource works, so I don't understand why.
Have a look at Xavier Ducrohet's answers here. But basically, with adt17 you cannot attach Javadoc to your dependencies.
For non library projects:
As mentioned in the original question comment 8 in this android issue fixes the build, runtime and javadoc issues, albeit by way of a kludge.
Unfortunately Ant builds are broken. To fix Ant builds which use Proguard, move jars to lib as described in comment 8 and to ant.properties add:
jar.libs.dir=lib
and to proguard.cfg add:
-injars lib
The second addition is necessary to fix runtime crashes.
I've not tested this for projects that use instrumentation or emma tasks, but it seems OK for non-library projects where you want both an Eclipse and an Ant build.
Maybe the ADK update has messed-up with your project's build-path. Try removing the JAR and add it again to your libs folder, add it to your Build Path and do a Clean Project.
check my Question once -- New android SDK 17 issue
Ok so this is the bug and the solution is comment #8 http://code.google.com/p/android/issues/detail?id=27490#c8
Well, after hours of research , I found a simple solution.
Click on your Android Project
Select Properties
Select Java Build
Path Select Order and Export
Check all your references
Thats all !
I'm creating a gps app for the android! And now I've stumbled upon a problem. The app doesn't start at all... Any ideas of how to fix this?
04-05 12:54:50.877: D/dalvikvm(540): Not late-enabling CheckJNI (already on)
04-05 12:54:51.018: I/dalvikvm(540): Turning on JNI app bug workarounds for target SDK version 5...
04-05 12:54:51.417: I/dalvikvm(540): Could not find method org.acra.ACRA.init, referenced from method com.kulplex.gaia.GaiaApp.onCreate
04-05 12:54:51.417: W/dalvikvm(540): VFY: unable to resolve static method 652: Lorg/acra/ACRA;.init (Landroid/app/Application;)V
04-05 12:54:51.417: D/dalvikvm(540): VFY: replacing opcode 0x71 at 0x0000
04-05 12:54:51.457: D/AndroidRuntime(540): Shutting down VM
04-05 12:54:51.457: W/dalvikvm(540): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
04-05 12:54:51.477: E/AndroidRuntime(540): FATAL EXCEPTION: main
04-05 12:54:51.477: E/AndroidRuntime(540): java.lang.NoClassDefFoundError: org.acra.ACRA
04-05 12:54:51.477: E/AndroidRuntime(540): at com.kulplex.gaia.GaiaApp.onCreate(GaiaApp.java:54)
04-05 12:54:51.477: E/AndroidRuntime(540): at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:969)
04-05 12:54:51.477: E/AndroidRuntime(540): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3954)
04-05 12:54:51.477: E/AndroidRuntime(540): at android.app.ActivityThread.access$1300(ActivityThread.java:123)
04-05 12:54:51.477: E/AndroidRuntime(540): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1185)
04-05 12:54:51.477: E/AndroidRuntime(540): at android.os.Handler.dispatchMessage(Handler.java:99)
04-05 12:54:51.477: E/AndroidRuntime(540): at android.os.Looper.loop(Looper.java:137)
04-05 12:54:51.477: E/AndroidRuntime(540): at android.app.ActivityThread.main(ActivityThread.java:4424)
04-05 12:54:51.477: E/AndroidRuntime(540): at java.lang.reflect.Method.invokeNative(Native Method)
04-05 12:54:51.477: E/AndroidRuntime(540): at java.lang.reflect.Method.invoke(Method.java:511)
04-05 12:54:51.477: E/AndroidRuntime(540): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
04-05 12:54:51.477: E/AndroidRuntime(540): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
04-05 12:54:51.477: E/AndroidRuntime(540): at dalvik.system.NativeStart.main(Native Method)
I had this same issue after updating to the latest Android tools.
In the project properties, Java Build Path, Order and Export section, I had to make sure the Android Private Libraries was checked.
Then I had to clean the project. After that it seems to work.
It was indeed an issue with 'Order and Export' of the Java Build Path.
When upgrading, the 'Order and Export' of the new 'Android Private Libraries' is not always checked. And the android-support-v4.jar is now in this 'Android Private Libraries' section.
To fix this, go to 'Order and Export' and check 'Android Private Libraries'. Then refresh/clean/rebuild.
After you done this 'fix' for a library project, you may need to just close and re-open any depending project, because they may not see this 'fix' immediately.
I found the answer here.
If you've recently updated to ADT 17 and above, they've changed the lib library handling.
so you need to rename your lib dir to libs,
then right click your project > properties > Java build path > Libraries > select all the jars with error markings on them and click remove > click add JARs > select all jars from your new libs dir.
Hope this helps.