We have developed mobile banking application, when downloaded from playstore immediately after crashing on splash screen.
unable to identify the line number.
Got issue message from google play console.
java.lang.RuntimeException:
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3779)
at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3943)
at android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:85)
at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2276)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loop (Looper.java:246)
at android.app.ActivityThread.main (ActivityThread.java:8414)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:596)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1130)
Caused by: java.lang.NullPointerException:
at com.android.internal.policy.PhoneWindow.getInsetsController (PhoneWindow.java:4120)
at com.mbanking.vsbl.vsbl.activity.SS.onCreate (Unknown Source:14)
at android.app.Activity.performCreate (Activity.java:8171)
at android.app.Activity.performCreate (Activity.java:8155)
at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1309)
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3752)
I have mentioned the splash screen activity coding. Im unable to identify which line code is crashing, and checked oneplus phone its working, dont have any other device with version of android 11. SO unable to run and resolve the issue
package com.mbanking.vsbl.vsbl.activity;
@SuppressWarnings({"unused", "deprecation"})
public class SS extends Activity {
//VARIABLE DECLARATION
private Context ctx;
private static AlertDialog alertDialog;
private Utils utils;
// public native String abc();
private final WSCallerVersionListener wSCallerVersionListener = new WSCallerVersionListener() {
@Override
public void onGetResponse(boolean isUpdateAvailable) {
if (isUpdateAvailable) {
showUpdateDialog();
}
else
{
submit_getBankDetails_MOB();
}
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
//REMOVE STATUS BAR IN PROGRATMICALLY
requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splashscreen);
ctx = this;
utils = new Utils();
HeaderImageUtils headerImageUtils = new HeaderImageUtils();
ImageView splashlogo = findViewById(R.id.splashlogo);
ImageView csplashlogo = findViewById(R.id.csplashlogo);
TextView text_bankname = findViewById(R.id.text_bankname);
headerImageUtils.setImage(Constants.BANK_ID, splashlogo, ctx, csplashlogo);
//refer constand and take corresponsing app name
Prefs.setAndroid_id(ctx, Constants.app_ajmsb);
text_bankname.setText(Constants.bankname_cedge);
//clearing all values
Prefs.setpausetime(ctx, null);
InternetConnectionUtils internetConnectionUtils = new InternetConnectionUtils();
int Internet_check = internetConnectionUtils.Internetconnect_Check(ctx);
if (Internet_check == 0) {
int appsignautestatus = Utils.checkAppSignatureALL(ctx);
if (appsignautestatus == 0) {
if (!Utils.isDeviceRooted()) {
new GPSA(ctx, wSCallerVersionListener).execute();
} else {
CommonDialog.DeleteAlertRoot(ctx,utils);
}
} else {
CommonDialog.DeleteAlert(ctx, utils);
}
} else {
CommonDialog.simpleAlert(alertDialogInterface, utils, "#275599", ctx, getString(R.string.netconnect), Constants.INTERNET);
}
}
private void submit_getBankDetails_MOB() {
CommonDialog.progressAlert(ctx);
MobileUserDTO mobileUserDTO = new MobileUserDTO();
APIRestCallTask asyncTask = new APIRestCallTask(ctx, mResultCallback, ServerUtils.getBankDetails_MOB, "getBankDetails_MOB", mobileUserDTO);
asyncTask.execute();
}
@Override
protected void onDestroy() {
CommonDialog.ondismiss();
CommonDialog.onProgressdismiss();
super.onDestroy();
}
// interface methods for receivng alertdialog status and back to privous fragment
private final AlertDialogInterface alertDialogInterface = new AlertDialogInterface() {
@Override
public void DialogRestult(String result) {
finish();
finishAffinity();
}
};
private void Restcall1(String str_Theme_color) {
if (str_Theme_color.equalsIgnoreCase("themeRed")) {
Prefs.setapptoolbackdark(ctx, "#D32F2F");
Prefs.setappbacklight(ctx, "#F34E46");
Prefs.setGradient_middle(ctx, "#FF6B5E");
} else {
Prefs.setapptoolbackdark(ctx, "#275599");
Prefs.setappbacklight(ctx, "#476DB4");
Prefs.setGradient_middle(ctx, "#6486D0");
}
}
//Getting Response from Resttempalte using Asyntask
private final IResult mResultCallback = new IResult() {
@Override
public void notifySuccess(String response, String str_fromapi) {
CommonDialog.onProgressdismiss();
String[] result = response.split(" ", 2);
String response1;
if (response.length() > 0) {
if (response.length() == 5) {
response1 = response.substring(0, 5);
} else {
response1 = response.substring(0, 7);
}
} else {
response1 = response;
}
if (response1.toLowerCase().contains(Constants.SUCCESS.toLowerCase())) {
CommonDialog.simpleAlert(alertDialogInterface, utils, "#275599", ctx, response, Constants.SUCCESS);
} else if (response1.toLowerCase().contains(Constants.ALERT.toLowerCase())) {
CommonDialog.simpleAlert(alertDialogInterface, utils, "#275599", ctx, result[1].replace(":", ""), Constants.ALERT);
} else if (response1.toLowerCase().contains(Constants.ERROR.toLowerCase())) {
CommonDialog.simpleAlert(alertDialogInterface, utils, "#275599", ctx, response, Constants.ERROR);
} else {
try {
JSONObject jsonObject = new JSONObject(response);
JSONObject jsonObject1 = jsonObject.getJSONObject("bankURLs");
String str_theme = jsonObject1.getString("theme");
Restcall1(str_theme);
Base64Encoder_Decoder base64Encoder_decoder = new Base64Encoder_Decoder();
String str_encodedparams = base64Encoder_decoder.encrypt(response, base64Encoder_decoder.decrypt_sig(Prefs.getAndroid_id(ctx), Utils.Get_Sha_lt(Utils.checkAppSignature(ctx))));
SharedPreferences appSharedPrefs = PreferenceManager.getDefaultSharedPreferences(ctx);
SharedPreferences.Editor prefsEditor = appSharedPrefs.edit();
prefsEditor.putString("bankresponse", str_encodedparams);
prefsEditor.apply();
Prefs.setbankresponse(ctx,str_encodedparams);
Intent nextPage = new Intent(SS.this, SSS.class);
nextPage.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(nextPage);
finish();
finishAffinity();
} catch (Exception ignored) {
}
}
}
@Override
public void notifyError(String error) {
CommonDialog.onProgressdismiss();
CommonDialog.simpleAlert(alertDialogInterface, utils, "#275599", ctx, error, Constants.ERROR);
}
};
private void showUpdateDialog() {
final String appUrl = Utils.fetchApplicationUrl(ctx);
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(SS.this);
alertDialogBuilder.setTitle(SS.this.getString(R.string.app_name));
alertDialogBuilder.setMessage(SS.this.getString(R.string.updateapp));
alertDialogBuilder.setCancelable(false);
alertDialogBuilder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
if (alertDialog != null && alertDialog.isShowing()) {
alertDialog.dismiss();
alertDialog.cancel();
SS.this.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(appUrl)));
}
}
});
if (!((Activity) ctx).isFinishing()) {
alertDialog = alertDialogBuilder.create();
alertDialog.show();
}
}
}