Android Question [SOLVED] application instantly stop

makis_best

Well-Known Member
Licensed User
Longtime User
When I run my application instantly stop with this error.

FATAL EXCEPTION: main
Process: gr.iosif, PID: 16875
java.lang.RuntimeException: Unable to create service gr.iosif.starter: java.lang.RuntimeException: java.lang.RuntimeException: Object should first be initialized.
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3370)
at android.app.ActivityThread.-wrap5(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1670)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:156)
at android.app.ActivityThread.main(ActivityThread.java:6623)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:942)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:832)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Object should first be initialized.
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:233)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:176)
at gr.iosif.starter.onCreate(starter.java:56)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3350)
... 8 more
Caused by: java.lang.RuntimeException: Object should first be initialized.
at anywheresoftware.b4a.sql.SQL.checkNull(SQL.java:55)
at anywheresoftware.b4a.sql.SQL.ExecNonQuery(SQL.java:73)
at gr.iosif.createsqltable._v0(createsqltable.java:34)
at gr.iosif.starter._service_create(starter.java:5213)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
 
When I run my application instantly stop with this error.
Do you think it is a good practise not to show us the relevant code you are using?

Start looking at the generated java code from this version to find the b4a line which is raising the error.
- starter.java:5213 <- line
- createsqltable.java:34
 
Upvote 0
I figure what you mean but I don't know about java...
But in the file starter.java:5213 is this code

Code: Copy
public static String  _service_create() throws Exception{
 //BA.debugLineNum = 22;BA.debugLine="Sub Service_Create";
 //BA.debugLineNum = 30;BA.debugLine="If File.ExternalWritable = False Then";
if (anywheresoftware.b4a.keywords.Common.File.getExternalWritable()==anywheresoftware.b4a.keywords.Common.False) {
 //BA.debugLineNum = 31;BA.debugLine="Msgbox(\"Cannot write on storage card.\", \"Warning";
anywheresoftware.b4a.keywords.Common.Msgbox(BA.ObjectToCharSequence("Cannot write on storage card."),BA.ObjectToCharSequence("Warning"),processBA);
 //BA.debugLineNum = 32;BA.debugLine="ExitApplication";
anywheresoftware.b4a.keywords.Common.ExitApplication();
 };
 //BA.debugLineNum = 36;BA.debugLine="If File.IsDirectory(File.DirRootExternal,\"DroidVi";
if (anywheresoftware.b4a.keywords.Common.File.IsDirectory(anywheresoftware.b4a.keywords.Common.File.getDirRootExternal(),"DroidViewDB")==anywheresoftware.b4a.keywords.Common.False) {
 //BA.debugLineNum = 37;BA.debugLine="File.MakeDir(File.DirRootExternal, \"DroidViewDB\"";
anywheresoftware.b4a.keywords.Common.File.MakeDir(anywheresoftware.b4a.keywords.Common.File.getDirRootExternal(),"DroidViewDB");
 };
 //BA.debugLineNum = 41;BA.debugLine="If File.Exists(File.DirRootExternal & \"/DroidView";
if (anywheresoftware.b4a.keywords.Common.File.Exists(anywheresoftware.b4a.keywords.Common.File.getDirRootExternal()+"/DroidViewDB/","DVDatabase.db")==anywheresoftware.b4a.keywords.Common.False) {
 //BA.debugLineNum = 42;BA.debugLine="Log(File.DirRootExternal & \"/DroidViewDB/\")";
anywheresoftware.b4a.keywords.Common.LogImpl("0393236",anywheresoftware.b4a.keywords.Common.File.getDirRootExternal()+"/DroidViewDB/",0);
 //BA.debugLineNum = 44;BA.debugLine="CreateSqlTable.CreateTablesInDatabase";
mostCurrent._vvvvv2._v0(processBA);   <<----  5213 line
 };
 //BA.debugLineNum = 46;BA.debugLine="DisableStrictMode";
_vvv2();
 //BA.debugLineNum = 47;BA.debugLine="End Sub";
return "";
}
 
Upvote 0
The <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> solve the problem.

Thank you all.
 
Upvote 0
Back
Top