hello fellow android programmers,
I’m constantly running into the same problem over and over again and I can’t figure it out, so I thought I’d ask my question here.
To implement ACRA (Application Crash Reporting for Android @ http://code.google.com/p/acra) I have to create a subclass of android.Application and instantiate ACRA.
I create this subclass from within the Manifest.xml editor by clicking on the left upper field “Name” in the “Application” tab. A window pops up where I’m asked to give a proper name to the new class and it is created in the /gen folder (only the R.java is also in this folder) and the needed attribute android:name is set in the <application/> tag automatically.
This works like a charm and all is good if I run my application from within the IDE on the emulator or on my debugging device… BUT, as soon as I want to export the whole package (doesn’t mind if “signed” or “unsigned”) the previous created android.Application subclass is removed from the /gen folder (must be from compiling), the APK gets saved and no error shows up. Until one tries to install and run the application – this will fail due to the lack of this unlucky subclass…
What is wrong? Where do I have to place this subclass other then in the /gen folder? Does anybody else run into the same problem?
It should not go into the
/gendirectory; that directory is for code that is automatically generated by the Android compiler during builds. TheApplicationclass you’re creating is application code, not auto-generated code. Don’t be confused by the fact that ADT is doing you a favor by “generating” it for you from the GUI editor; that’s not the same thing as the compiler building the code automatically for every build.Your
Applicationclass should go in the same place as all your other app code (Activitysubclasses, etc), namely/src(or/sourceor whatever depending on how you set up your project).