I have been developing an app and found that a specific code to not work which I created a new project to test to find the cause but I notice that my android app crashes when I start, here is the code
package my.testapplication;import androidx.appcompat.app.AppCompatActivity;import android.os.Bundle;import android.widget.TextView;import swisseph.SweDate;import swisseph.SwissEph;import swisseph.SwissData;import swisseph.SweConst;public class MainActivity extends AppCompatActivity { private TextView txtBox; int Year, Month, Day, isun, imoon, iflag; double Hour,Min,julDay; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Year = 2021; Month = 02; Day = 10; Hour = 14; Min = 30; julDay = SweDate.getJulDay(Year,Month,Day,Hour); isun = SweConst.SE_SUN; imoon = SweConst.SE_MOON; iflag = SweConst.SEFLG_SWIEPH; double [] xx = new double[0]; StringBuffer serr = new StringBuffer(); SwissEph sw = new SwissEph(); int sunLon = sw.swe_calc_ut(julDay,isun,iflag,xx,serr); int moonLon = sw.swe_calc_ut(julDay,imoon,iflag,xx,serr); txtBox = this.findViewById(R.id.txtBox); txtBox.setText("GDate" + Day +"/" + Month +"/" + Year +"JDate" + julDay +"Sun Long" + sunLon +"Moon Long" + moonLon ); }}
I did include the swisseph jar file under the dependencies and I have placed the jar file in the libs folder under app.I am really new to android java programming, I do apologise if this seemed really simple fix.