I see lots of people here with this problem for the iPhone, but this is a Nexus 7 device. App crashes with the release build, yet when I debug directly on the device, the crash doesn't happen. I can tell it's the latest, newest version of the software.
Anyone else run into this?
Release version and debug version are even running off the same database.
Here is the code that's crashing (null pointer exception - line indicated):
mTabHost = (TabHost)findViewById(R.id.tabHost);
mTabHost.setup();
mTabHost.setOnTabChangedListener(this);
String className = this.getLocalClassName();
if (surveyID < 68) {
String sql = "Select * FROM L_Options WHERE Type = 'TabSetup' AND Setting = '" + optIncludeSurvey + "' "
+ "AND Value = " + surveyID;
Cursor c = DataBaseConnector.query(sql);
if (c != null) {
if (c.moveToFirst()) {
surveyID = c.getInt(c.getColumnIndex("FK_RecID"));
}
}
}
String sql = "SELECT TS.TextID, TS.TabClass, TS.TabHeaderID, TS.Comments,O.Value "//
+ "FROM L_TabSetup AS TS LEFT JOIN L_Options O ON "//
+ "O.FK_RecID = TS.TabSurveyID AND O.Type = 'TabSetup' AND O.Setting = '" + optIncludeSurvey + "' "//
+ "WHERE TS.ScreenClass = '" + className + "' "//
+ "AND TS.Active = 1 "//
+ "AND O.Active = 1 "//
+ "AND TS.TabSurveyID = " + surveyID + " ";
if (GlobalVars.subjectLeftToRight == 1) {
sql += "ORDER BY TS.DisplayOrder ASC";
} else {
sql += "ORDER BY TS.DisplayOrder DESC";
}
Cursor c = DataBaseConnector.query(sql);
if (c != null) {
if (c.moveToFirst()) {
TabInfo tabInfo = null;
do {
String comment = c.getString(c.getColumnIndex("Comments"));
int includeSurveyID = c.getInt(c.getColumnIndex("Value"));
Class<?> tabClass = getClass(c.getString(c.getColumnIndex("TabClass")));
int tabHeaderID = c.getInt(c.getColumnIndex("TabHeaderID"));
//put in included SurveyID
if (args != null) {
if (args.getInt(optIncludeSurvey, -1) == -1) {
args.putInt(optIncludeSurvey, includeSurveyID);
}
}
else {
args = new Bundle();
args.putInt(optIncludeSurvey, includeSurveyID);
}
String[] texts = Lookups.getText(c.getInt(c.getColumnIndex("TextID")));
//crash line
////////////////////////////////////////////////////////
tabInfo = new TabInfo(tabClass, args, texts, c.getInt(c.getColumnIndex("TextID")), tabHeaderID, comment, surveyID);
//end crash line
//////////////////////////////////////////////////////////
addTab(this, tabInfo);
this.mapTabInfo.put(tabInfo.texts[0], tabInfo);
} while (c.moveToNext());
}
c.close();
c = null;
}
Please be kind about the coding practices - this is legacy code.
EDITED: Logcat file
08-15 10:07:09.818: E/AndroidRuntime(1221): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.assistek.ediary/com.assistek.ediary.SubjectMenuEvent}: java.lang.NullPointerException
08-15 10:07:09.818: E/AndroidRuntime(1221): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
08-15 10:07:09.818: E/AndroidRuntime(1221): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
08-15 10:07:09.818: E/AndroidRuntime(1221): at android.app.ActivityThread.access$600(ActivityThread.java:141)
08-15 10:07:09.818: E/AndroidRuntime(1221): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
08-15 10:07:09.818: E/AndroidRuntime(1221): at android.os.Handler.dispatchMessage(Handler.java:99)
08-15 10:07:09.818: E/AndroidRuntime(1221): at android.os.Looper.loop(Looper.java:137)
08-15 10:07:09.818: E/AndroidRuntime(1221): at android.app.ActivityThread.main(ActivityThread.java:5039)
08-15 10:07:09.818: E/AndroidRuntime(1221): at java.lang.reflect.Method.invokeNative(Native Method)
08-15 10:07:09.818: E/AndroidRuntime(1221): at java.lang.reflect.Method.invoke(Method.java:511)
08-15 10:07:09.818: E/AndroidRuntime(1221): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
08-15 10:07:09.818: E/AndroidRuntime(1221): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
08-15 10:07:09.818: E/AndroidRuntime(1221): at dalvik.system.NativeStart.main(Native Method)
08-15 10:07:09.818: E/AndroidRuntime(1221): Caused by: java.lang.NullPointerException
08-15 10:07:09.818: E/AndroidRuntime(1221): at com.assistek.ediary.SubjectMenuEvent.setupTabHost(SubjectMenuEvent.java:255)
08-15 10:07:09.818: E/AndroidRuntime(1221): at com.assistek.ediary.SubjectMenuEvent.onCreate(SubjectMenuEvent.java:96)
08-15 10:07:09.818: E/AndroidRuntime(1221): at android.app.Activity.performCreate(Activity.java:5104)
08-15 10:07:09.818: E/AndroidRuntime(1221): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
08-15 10:07:09.818: E/AndroidRuntime(1221): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
08-15 10:07:09.818: E/AndroidRuntime(1221): ... 11 more
Related question: Reinstalling app does not bring over all the changes of released app android