Quantcast
Channel: Active questions tagged crash - Stack Overflow
Viewing all 7150 articles
Browse latest View live

GatsbyJS - Forward Slashes or numbers after Hash in URL crashes App

$
0
0

The URL of my app can be something like www.example.com/#/c/2/v/1

Yet the slashes and numbers after # are causing my GatsbyJS generated pages to crash.

The error message is: Uncaught DOMException: Failed to execute 'querySelector' on 'Document': '#/c/2/v/1' is not a valid selector.

The parameters after hash are not to scroll, put to provide parameters to the app.

I've been struggling with this for two days.Please Help.


'NSInvalidArgumentException', reason: 'index out of bounds for arranged subview: ...' with UIButtonBar involved

$
0
0

I hope someone is able to help me out here. For a weeks I am seeing this exception in my app:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'index out of bounds for arranged subview: index = 5 expected to be less than or equal to 4'*** First throw call stack:(    0   CoreFoundation                      0x00007fff23e3cf0e __exceptionPreprocess + 350    1   libobjc.A.dylib                     0x00007fff50ba89b2 objc_exception_throw + 48    2   CoreFoundation                      0x00007fff23e3cd4c +[NSException raise:format:] + 188    3   UIKitCore                           0x00007fff49095fa8 -[UIStackView insertArrangedSubview:atIndex:] + 161    4   UIKitCore                           0x00007fff48282ac1 -[_UIButtonBar _layoutBar] + 3461    5   UIKitCore                           0x00007fff4828637e -[_UIButtonBarStackView updateConstraints] + 48    6   UIKitCore                           0x00007fff490b0afa -[UIView(AdditionalLayoutSupport) _sendUpdateConstraintsIfNecessaryForSecondPass:] + 489    7   UIKitCore                           0x00007fff490b10c8 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededCollectingViews:forSecondPass:] + 1187    8   UIKitCore                           0x00007fff490b0f62 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededCollectingViews:forSecondPass:] + 829    9   Foundation                          0x00007fff25aa5778 -[NSISEngine withBehaviors:performModifications:] + 84    10  UIKitCore                           0x00007fff490b12de -[UIView(AdditionalLayoutSupport) _recursiveUpdateConstraintsIfNeededCollectingViews:forSecondPass:] + 112    11  UIKitCore                           0x00007fff490b0f62 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededCollectingViews:forSecondPass:] + 829    12  Foundation                          0x00007fff25aa5778 -[NSISEngine withBehaviors:performModifications:] + 84    13  UIKitCore                           0x00007fff490b12de -[UIView(AdditionalLayoutSupport) _recursiveUpdateConstraintsIfNeededCollectingViews:forSecondPass:] + 112    14  UIKitCore                           0x00007fff490b0f62 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededCollectingViews:forSecondPass:] + 829    15  UIKitCore                           0x00007fff490b0f62 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededCollectingViews:forSecondPass:] + 829    16  UIKitCore                           0x00007fff490b0f62 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededCollectingViews:forSecondPass:] + 829    17  UIKitCore                           0x00007fff490b0f62 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededCollectingViews:forSecondPass:] + 829    18  UIKitCore                           0x00007fff490b0f62 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededCollectingViews:forSecondPass:] + 829    19  Foundation                          0x00007fff25aa5778 -[NSISEngine withBehaviors:performModifications:] + 84    20  UIKitCore                           0x00007fff490b12de -[UIView(AdditionalLayoutSupport) _recursiveUpdateConstraintsIfNeededCollectingViews:forSecondPass:] + 112    21  UIKitCore                           0x00007fff490b0f62 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededCollectingViews:forSecondPass:] + 829    22  UIKitCore                           0x00007fff490b0f62 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededCollectingViews:forSecondPass:] + 829    23  UIKitCore                           0x00007fff490b0f62 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededCollectingViews:forSecondPass:] + 829    24  Foundation                          0x00007fff25aa5778 -[NSISEngine withBehaviors:performModifications:] + 84    25  UIKitCore                           0x00007fff490b186a __100-[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededWithViewForVariableChangeNotifications:]_block_invoke + 85    26  UIKitCore                           0x00007fff490b0077 -[UIView(AdditionalLayoutSupport) _withUnsatisfiableConstraintsLoggingSuspendedIfEngineDelegateExists:] + 104    27  UIKitCore                           0x00007fff490b13c5 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededWithViewForVariableChangeNotifications:] + 154    28  UIKitCore                           0x00007fff490a1390 -[UIWindow(UIConstraintBasedLayout) _updateConstraintsIfNeededWithViewForVariableChangeNotifications:] + 92    29  UIKitCore                           0x00007fff490b22e4 -[UIView(AdditionalLayoutSupport) _updateConstraintsAtEngineLevelIfNeededWithViewForVariableChangeNotifications:] + 393    30  UIKitCore                           0x00007fff4917f21b -[UIView(Hierarchy) _updateConstraintsAsNecessaryAndApplyLayoutFromEngine] + 272    31  UIKitCore                           0x00007fff49193678 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2478    32  QuartzCore                          0x00007fff2b4c6398 -[CALayer layoutSublayers] + 255    33  QuartzCore                          0x00007fff2b4cc523 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 523    34  QuartzCore                          0x00007fff2b4d7bba _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 80    35  QuartzCore                          0x00007fff2b420c04 _ZN2CA7Context18commit_transactionEPNS_11TransactionEd + 324    36  QuartzCore                          0x00007fff2b4545ef _ZN2CA11Transaction6commitEv + 649    37  QuartzCore                          0x00007fff2b454f81 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 79    38  CoreFoundation                      0x00007fff23da0127 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23    39  CoreFoundation                      0x00007fff23d9abde __CFRunLoopDoObservers + 430    40  CoreFoundation                      0x00007fff23d9b12a __CFRunLoopRun + 1226    41  CoreFoundation                      0x00007fff23d9a944 CFRunLoopRunSpecific + 404    42  GraphicsServices                    0x00007fff38ba6c1a GSEventRunModal + 139    43  UIKitCore                           0x00007fff48c8b9ec UIApplicationMain + 1605    44  MyApp                               0x00000001012dd63b main + 75    45  libdyld.dylib                       0x00007fff51a231fd start + 1    46  ???                                 0x0000000000000001 0x0 + 1)

I can not find out what the root cause it. Because _UIButtonBarStackView is mentioned I assume that it has something to do with a UINavigationBarUIBarButtons. It seems to happen when I dismiss a modally presented UINavigationController, but I am not sure.It also looks like it started to happen with iOS 13.4.1, because I can't find any crash report with any older version.

Anyone might know what's going on here?

Rstudio in AWS (linux based) crash when I run my code

$
0
0

I developed my R code on my local computer. In my code, I mainly use swmmr package to run SWMM (stormwater management model) and further analysis related to the model outputs. To do that, I have used multiple packages (dplyr, shiny, leaflet, xts, zoo, ...). Everything is fine when I use my local computer and I can run my code from first to last and it works properly.

Now, I decided to move all my codes to AWS (amazon web services) EC2 cloud. Because I need to run my code every one hour. I had some difficulties with this transformation, but I could solve most of them.However, somewhere in my code, when I use the read_out() function from swmmr package, I get some warnings about masking some functions from other packages (attached figure), and my studio in AWS server crash.

Any idea about how I can fix this problem is appreciated. Why does Rstudio in AWS crash when I use this function? I really need to fix this problem ASAP.

You can see the warnings here:enter image description here

high throughput analysis with slow computer

$
0
0

I don't have access to server and work with a laptop with Intel Core i3-2350M processor, 2.30GHz CPU, 8 gigabyte RAM. I need to process large bioinformatics datasets using R. How can I do it or what I need to purchase to stop system crash? I can't buy a faster laptop.

Any idea is much appreciated.

Android Studio, app crashing when opening gallery

$
0
0

SOLVED

Rewrote pickImageFromGallery as below. Don't know why it works though.

        Intent galleryIntent = new Intent();        galleryIntent.setType("image*/");        galleryIntent.setAction(Intent.ACTION_PICK);        startActivityForResult(Intent.createChooser(galleryIntent, "Select picture"), IMAGE_GALLERY_CODE);    }

I'm currently making an app and want to open the gallery to pick out an image (I've also written code for taking a photo but that part works just fine). After giving permission to do so the app will crash and i can't figure out why. I've tried using different verions of android and phone types as emulator but with no different outcome. I've read in a few places that it could be due to some nullpointer when attempting to get.Data(), but since i'm checking for it i can't see why that would be a problem here. Any suggestion on what could be causing this would be very appreciated :) (I get no error message when it crashes)

    Button mUploadPhotoBtn;    Button mTakePhotoBtn;    ImageView mImageView;    private static final int PERMISSION_PHOTO_CODE = 1000;    private static final int PERMISSION_GALLERY_CODE = 1001;    private static final int IMAGE_CAPTURE_CODE = 1002;    private static final int IMAGE_GALLERY_CODE = 1003;    Uri image_uri;    @Override    protected void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentView(R.layout.activity_main);        mUploadPhotoBtn = findViewById(R.id.uploadPhotoBtn);        mTakePhotoBtn = findViewById(R.id.takePhotoBtn);        mImageView = findViewById(R.id.imageView);        mUploadPhotoBtn.setOnClickListener(this);        mTakePhotoBtn.setOnClickListener(this);    }    @Override    public void onClick(View view) {        //One case for each button in mainActivity        switch (view.getId()) {            case R.id.takePhotoBtn:                //check permissions and build version ok                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {                    if (checkSelfPermission(Manifest.permission.CAMERA) ==                            PackageManager.PERMISSION_DENIED ||                            checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) ==                            PackageManager.PERMISSION_DENIED) {                        String[] permission = {Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE};                        requestPermissions(permission, PERMISSION_PHOTO_CODE);                    }                    else {                        openCamera();                    }                }                else {                    openCamera();                }                break;            case R.id.uploadPhotoBtn:                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {                    if (checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE)                            == PackageManager.PERMISSION_DENIED) {                        //Ask for permission if not granted                        String [] permissions = {Manifest.permission.READ_EXTERNAL_STORAGE};                        //Show popup for runtime permission                        requestPermissions(permissions, PERMISSION_GALLERY_CODE);                    }                    else {                        //Permission is already granted                        pickImageFromGallery();                    }                }                else {                    //System version is less than marshmellow                    pickImageFromGallery();                }                break;        }    }    private void openCamera() {        ContentValues values = new ContentValues();        values.put(MediaStore.Images.Media.TITLE, "New Picture");        values.put(MediaStore.Images.Media.DESCRIPTION, "From the Camera");        image_uri = getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);        Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);        cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, image_uri);        startActivityForResult(cameraIntent, IMAGE_CAPTURE_CODE);    }    private void pickImageFromGallery() {        Intent intent = new Intent(Intent.ACTION_PICK);        intent.setType("image*/");        startActivityForResult(intent, IMAGE_GALLERY_CODE);    }    //handling permission result    @Override    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {        switch (requestCode) {            case PERMISSION_PHOTO_CODE: {                if (grantResults.length > 0 && grantResults[0] ==                        PackageManager.PERMISSION_GRANTED) {                    openCamera();                }                else {                    Toast.makeText(this, "Permission denied...", Toast.LENGTH_SHORT).show();                }            }            break;            case PERMISSION_GALLERY_CODE: {                if (grantResults.length > 0 && grantResults[0] ==                        PackageManager.PERMISSION_GRANTED) {                    pickImageFromGallery();                }                else {                    Toast.makeText(this, "Permission denied...", Toast.LENGTH_SHORT).show();                }            }            break;        }    }    //handling activation of button    @Override    protected void onActivityResult (int requestCode, int resultCode, @Nullable Intent data) {            super.onActivityResult(requestCode, resultCode, data);            if (resultCode == RESULT_OK && data != null) {            switch (requestCode) {                case IMAGE_CAPTURE_CODE: {                    mImageView.setImageURI(image_uri);                }                break;                case IMAGE_GALLERY_CODE: {                   mImageView.setImageURI(data.getData());                }                break;            }        }    }}

Flutter app crashes when it use Firestore plugin in Release mode

$
0
0

Everything works perfectly when in debug mode. It first happened when I update Flutter version to 1.10.x I could not remember which version did I use, properly. It should be 1.7.8, it was stable. To fix it I downgrade the flutter to 1.7.8+4 and also downgrade firebase related pub packages. But error still here.

Stack Trace for Related Error, captured from gogle play console

java.lang.RuntimeException:   at com.google.firebase.firestore.util.AsyncQueue.a (AsyncQueue.java:379)  at com.google.firebase.firestore.util.AsyncQueue$$Lambda$5.run (AsyncQueue.java:2)  at android.os.Handler.handleCallback (Handler.java:790)  at android.os.Handler.dispatchMessage (Handler.java:99)  at android.os.Looper.loop (Looper.java:164)  at android.app.ActivityThread.main (ActivityThread.java:7000)  at java.lang.reflect.Method.invoke (Method.java)  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:441)  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1408)Caused by: java.lang.AbstractMethodError:   at com.google.protobuf.GeneratedMessageLite.a (GeneratedMessageLite.java:1319)  at com.google.firebase.firestore.proto.WriteBatch.s (WriteBatch.java:120)  at com.google.firebase.firestore.proto.WriteBatch.a (WriteBatch.java:162)  at com.google.firebase.firestore.proto.WriteBatch.a (WriteBatch.java:15)  at com.google.firebase.firestore.proto.WriteBatch$Builder.a (WriteBatch.java:835)  at com.google.firebase.firestore.local.LocalSerializer.a (LocalSerializer.java:172)  at com.google.firebase.firestore.local.SQLiteMutationQueue.a (SQLiteMutationQueue.java:188)  at com.google.firebase.firestore.local.LocalStore.a (LocalStore.java:237)  at com.google.firebase.firestore.local.LocalStore$$Lambda$2.get (LocalStore.java:8)  at com.google.firebase.firestore.local.SQLitePersistence.a (SQLitePersistence.java:195)  at com.google.firebase.firestore.local.LocalStore.a (LocalStore.java:201)  at com.google.firebase.firestore.core.SyncEngine.a (SyncEngine.java:227)  at com.google.firebase.firestore.core.FirestoreClient.a (FirestoreClient.java:200)  at com.google.firebase.firestore.core.FirestoreClient$$Lambda$11.run (FirestoreClient.java:6)  at com.google.firebase.firestore.util.AsyncQueue.a (AsyncQueue.java:311)  at com.google.firebase.firestore.util.AsyncQueue$$Lambda$4.call (AsyncQueue.java:2)  at com.google.firebase.firestore.util.AsyncQueue.a (AsyncQueue.java:287)  at com.google.firebase.firestore.util.AsyncQueue$$Lambda$3.run (AsyncQueue.java:4)  at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:457)  at java.util.concurrent.FutureTask.run (FutureTask.java:266)  at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run             (ScheduledThreadPoolExecutor.java:301)  at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1162)  at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:636)  at com.google.firebase.firestore.util.AsyncQueue$DelayedStartFactory.run (AsyncQueue.java:205)  at java.lang.Thread.run (Thread.java:764)

When I saw the error trace on device (in android crash report dialog) It mentioned Firebase 19.0.0

Flutter Doctor:

Doctor summary (to see all details, run flutter doctor -v):[√] Flutter (Channel unknown, v1.7.8+hotfix.4, on Microsoft Windows [Version 10.0.17134.1069], locale en-US)[√] Android toolchain - develop for Android devices (Android SDK version 29.0.0)[√] Chrome - develop for the web[√] Visual Studio - develop for Windows (Visual Studio Enterprise 2017 15.9.7)[√] Android Studio (version 3.4)[√] VS Code, 64-bit edition (version 1.38.1)[√] Connected device (3 available)• No issues found!

Error reporoducing scenario for final describe:

  • Build app with flutter run --release
  • App try an basic firestore call

    Firestore.instance.collection('collection-name').document('docuemnt-id').get()

  • App crashes.

Also getting the same error with building with flutter build appbudle

Program crashes inside the copy constructor of a discriminated union

$
0
0

So I've been trying to create a discriminated union for my project. Coming from C, I thought it would be trivial... ;)

The structure is named Message. It has a MessageType and an inner union which holds either a MessageGet or a MessageSet.

enum MessageType {    MESSAGE_GET,    MESSAGE_SET};struct MessageGet {    std::string store_name;    std::vector<uint8_t> key;};struct MessageSet {    std::string store_name;    std::vector<uint8_t> key;    std::vector<uint8_t> value;};struct Message {    MessageType type;    uint64_t sender_id;        union U {        U() : get() {}        U(const U& other) {            get = other.get;            set = other.set;        }        ~U() {}        U& operator=(const U& other) {            set = other.set;            get = other.get;            return *this;        }        MessageGet get;        MessageSet set;    } as;    Message() {}    ~Message() {        switch (type) {            case MESSAGE_GET: {                as.get.~MessageGet();                break;            }            case MESSAGE_SET: {                as.set.~MessageSet();                break;            }        }    }    Message(MessageGet get, uint64_t sender_id) {        type = MESSAGE_GET;        as.get = get;        sender_id = sender_id;    }    Message(MessageSet set, uint64_t sender_id) {        type = MESSAGE_SET;        as.set = set;        sender_id = sender_id;    }    Message(const Message& other) {        type = other.type;        as = other.as;        sender_id = other.sender_id;    }    Message& operator=(const Message& other) {        type = other.type;        as = other.as;        sender_id = other.sender_id;        return *this;    }};

The program crashes elsewhere in the code where I do something like this:

Message message(MessageGet {std::move(store_name), std::move(key)}, sender);messages.push_back(message); // messages is a local std::vector<Message>

It doesn't crash with an exception - simply a crash.

I've managed to narrow it down to inside the Message copy constructor. After that, have no clue what causes this. Ideas would be appreciated.

few devices experience crash on startup

$
0
0

when i gave my friends to test my app, one of them experienced crash on start up. I don't find any issues in code part of my project but i don't get it why few devices crash. I have my whole project on git hub https://github.com/hsr121/agile.git .

I tried compressing background jpeg image from 9.5 MB to 2 MB. Cannot figure out the problem, the amazon app store rejects to upload my app dues to same crashing reason.


Xamarin Forms App keeps crashing after it's deployed in the device and then stopped

$
0
0

I have been developing a Xamarin Forms app for 9 months now, however lately I've discovered a problem. It successfully deploys my application to the device, and I can use it normally, but after closing it and try to open it again it keeps crashing.

I have tried in other devices and have the same problem, also I cannot debug where the problem is because it only happens if I try to open the app when it has been previously closed so the debugger is no longer running.

As I said before, I just have had this problem recently, it was working perfectly fine.

This is my App.xaml.cs code.

using VYRMobile.Services;using Xamarin.Forms;using Microsoft.AppCenter;using Microsoft.AppCenter.Push;using System.IO;using System.Collections.Generic;using VYRMobile.Models;using Newtonsoft.Json;using Syncfusion.XForms.Buttons;using VYRMobile.Views;using Plugin.CloudFirestore;using System.Collections.ObjectModel;using Xamarin.Essentials;namespace VYRMobile{    public partial class App : Application    {        internal static bool IsUserLoggedIn = true;        internal static bool IsEquipmentValitated = false;        internal static string ApplicationUserId;        internal static string ApplicationUserRole;        internal static string AntennaId;        internal static string ReviewedUserId;        internal static ApplicationUser WorkerOnReview;        internal static FirestoreAlarm Alarm;        internal static List<Stream> ImagesStreams = new List<Stream>();        internal static List<string> ImagesNames = new List<string>();        internal static List<Record> Records = new List<Record>();        internal static List<SfCheckBox> Faults = new List<SfCheckBox>();        internal static List<Calculation> Calculations = new List<Calculation>();        internal static List<ApplicationUser> Workers = new List<ApplicationUser>();        internal static ObservableCollection<ApplicationUser> ExchangeableWorkers = new ObservableCollection<ApplicationUser>();        public App()        {            Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense(Constants.SyncfusionLicenseKey);            InitializeComponent();            GoogleMapsApiService.Initialize(Constants.GoogleMapsApiKey);            CreateDirectory();            MainPage = new MainPage();        }        protected override void OnStart()        {            //AppCenter.Start("bff38954-6dd9-4a23-a41a-13430c73bfd8", typeof(Push));        }        protected override void OnSleep()        {            // Handle when your app sleeps        }        protected override void OnResume()        {            // Handle when your app resumes        }        private async void CreateDirectory()        {            var json = await SecureStorage.GetAsync("records");            if (json != null)            {                Records = JsonConvert.DeserializeObject<List<Record>>(json);            }        }    }}

And this my MainActivity.cs code:

using Android.App;using Android.Content.PM;using Android.Runtime;using Android.OS;using Xamarin;using Xamarin.Forms.GoogleMaps.Android;using Android.Content;using Plugin.LocalNotifications;using FFImageLoading.Forms.Platform;using Xamarin.Forms;using CarouselView.FormsPlugin.Android;using Firebase;using Firebase.Firestore;using Android.Net;using Plugin.PushNotification;namespace VYRMobile.Droid{    [Activity(        Label = "VYR-X",         Icon = "@drawable/vyrx",         Theme = "@style/MainTheme",         MainLauncher = true,         ResizeableActivity = false,         ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation, ScreenOrientation = ScreenOrientation.Portrait)]    public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity    {        //MainActivity activity;        private static MainActivity _instance;        public static MainActivity Instance        {            get            {                if (_instance == null)                    _instance = new MainActivity();                return _instance;            }        }        protected override void OnCreate(Bundle savedInstanceState)        {            InitControls();            TabLayoutResource = Resource.Layout.Tabbar;            ToolbarResource = Resource.Layout.Toolbar;            base.OnCreate(savedInstanceState);            Forms.SetFlags("FastRenderers_Experimental");            Forms.SetFlags("CarouselView_Experimental");            Forms.SetFlags("CollectionView_Experimental");            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);            FirebaseApp.InitializeApp(Application.ApplicationContext);            var platformConfig = new PlatformConfig            {                BitmapDescriptorFactory = new CachingNativeBitmapDescriptorFactory()            };            FormsMaps.Init(this, savedInstanceState);            CachedImageRenderer.Init(true);            Xamarin.Essentials.Platform.Init(this, savedInstanceState);            FormsGoogleMaps.Init(this, savedInstanceState, platformConfig);            Plugin.CurrentActivity.CrossCurrentActivity.Current.Init(this, savedInstanceState);            global::Xamarin.FormsMaps.Init(this, savedInstanceState);            Rg.Plugins.Popup.Popup.Init(this, savedInstanceState);            PushNotificationManager.ProcessIntent(this, Intent);            FirebaseFirestore firestore = FirebaseFirestore.GetInstance(FirebaseApp.Instance);            FirebaseFirestoreSettings settings = new FirebaseFirestoreSettings.Builder().SetTimestampsInSnapshotsEnabled(true).Build();            firestore.FirestoreSettings = settings;            //this.activity = Instance;            LoadApplication(new App());        }        private void InitControls()        {            CarouselViewRenderer.Init();        }        public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Android.Content.PM.Permission[] grantResults)        {            Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);            Plugin.Permissions.PermissionsImplementation.Current.OnRequestPermissionsResult(requestCode, permissions, grantResults);            base.OnRequestPermissionsResult(requestCode, permissions, grantResults);        }        public void StartAlarmService()        {            Intent intent = new Intent(Android.App.Application.Context.ApplicationContext, typeof(AlertService));            Android.App.Application.Context.StartService(intent);        }        public void StopAlarmService()        {            Intent intent = new Intent(Android.App.Application.Context.ApplicationContext, typeof(AlertService));            Android.App.Application.Context.StopService(intent);        }    }}

Why does this JavaScript crash when I launch it in google chrome?

$
0
0
    function Game(){    var random_numberv2= Math.floor(Math.random()*100);//spit random number in double digit    var random_numberv3= Math.floor(Math.random()*1000);//spit random number in triple digitvar canvas = document.getElementById("canvas").getContext("2d");var i = 0;var Color_list=[];while (i<5){    var random_number= Math.floor(Math.random()*10);//spit random number in single digit    Color_list.push(random_number);}canvas.fillStyle= "'"+"#"+Color_list[0]+Color_list[1]+Color_list[2]+Color_list[3]+Color_list[4]+Color_list[5]+"'";console.log("'"+"#"+Color_list[0]+Color_list[1]+Color_list[2]+Color_list[3]+Color_list[4]+Color_list[5]+"'");canvas.fillRect(random_numberv3,random_numberv2,Color_list[i],random_numberv2);i = 0;Color_list=[];}

I was trying to make a canvas that would generate random rectangles with different colors when the user clicks on it.

Forge crashes after load

$
0
0

i don't know whats the reason for crashing and would like to know it so if sb can translate it for me, thank you. It runs on Forge 1.7.10 with many mods.

Here's my output

java.lang.IndexOutOfBoundsException    at java.nio.Buffer.checkIndex(Buffer.java:540)    at java.nio.DirectIntBufferU.get(DirectIntBufferU.java:253)    at net.minecraft.client.renderer.RenderGlobal.func_72712_a(RenderGlobal.java:350)    at net.minecraft.client.renderer.RenderGlobal.func_72732_a(RenderGlobal.java:294)    at net.minecraft.client.Minecraft.func_71353_a(Minecraft.java:2216)    at net.minecraft.client.Minecraft.func_71403_a(Minecraft.java:2146)    at net.minecraft.client.network.NetHandlerPlayClient.func_147282_a(NetHandlerPlayClient.java:240)    at net.minecraft.network.play.server.S01PacketJoinGame.func_148833_a(SourceFile:70)    at net.minecraft.network.play.server.S01PacketJoinGame.func_148833_a(SourceFile:13)    at net.minecraft.network.NetworkManager.func_74428_b(NetworkManager.java:212)    at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:2061)    at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:973)    at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:898)    at net.minecraft.client.main.Main.main(SourceFile:148)    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)    at java.lang.reflect.Method.invoke(Method.java:497)    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)A detailed walkthrough of the error, its code path and all known details is as follows:----------------------------------------------------------------------------------------- Head --Stacktrace:    at java.nio.Buffer.checkIndex(Buffer.java:540)    at java.nio.DirectIntBufferU.get(DirectIntBufferU.java:253)    at net.minecraft.client.renderer.RenderGlobal.func_72712_a(RenderGlobal.java:350)    at net.minecraft.client.renderer.RenderGlobal.func_72732_a(RenderGlobal.java:294)    at net.minecraft.client.Minecraft.func_71353_a(Minecraft.java:2216)    at net.minecraft.client.Minecraft.func_71403_a(Minecraft.java:2146)    at net.minecraft.client.network.NetHandlerPlayClient.func_147282_a(NetHandlerPlayClient.java:240)    at net.minecraft.network.play.server.S01PacketJoinGame.func_148833_a(SourceFile:70)    at net.minecraft.network.play.server.S01PacketJoinGame.func_148833_a(SourceFile:13)    at net.minecraft.network.NetworkManager.func_74428_b(NetworkManager.java:212)

Android Studio Simple 'TV' App With WebView crashes after long time

$
0
0

So I have a super simple app with just a WebView that connects to our host page and acts as a 'TV'. After checking for memory leaks, I run this app on my Amazon Fire Stick for an extended period of time, but regardless after around 8-9 hours it crashes without exception on the console. How did I check for memory leaks:

LeakCanary did not detect any leaks.Watching the memory profiler over time I see that the total memory used always consistently averages 400MB, even at the 8 hour mark.Comparing to the old version of the program which was worse (it had a lot of unrelated code and was an older project), LeakCanary DID detect leaks on the exact same code, and the profiler did slowly increase the total memory used. This led me to believe that isolating all the necessary code and moving it to a new project solved part of the problem.Now, the really weird thing is that even though the ALLOCATED memory in the profiler fluctuates, it's DECREASING. In fact to negative numbers. By the 8 hour mark I was seeing it average around -40000. Why's the allocated number negative?

Finally, here's a recurring and suspicious console log I saw right before the crash, hinting it is indeed a memory related crash

I/Kernel: [126985.795618].(0)[3041:RenderThread]lowmemorykiller: Killing 'VMetricsProcess' (29681), adj 1, score_adj 58,    [126985.795618]   to free 20124kB on behalf of 'RenderThread' (3041) because    [126985.795618]   cache 40244kB is below limit 40960kB for oom_score_adj 58    [126985.795618]   Free memory is 0kB above reserved

Any help would be greatly appreciated as I've been struggling with this bug for so long.

Circle Image View : Null Pointer Exception

$
0
0

My app runs fine but when i open a menu item where i have a list of names, images, and links of their social media it crushes.

This is my first professional app ,i really need to solve this issue.Give me a suggestion to work,i have totally ran out of ideas.

Here are my errors:

2020-06-25 21:34:18.427 6306-6334/com.labawsrh.aws.introscreen E/eglCodecCommon: GoldfishAddressSpaceHostMemoryAllocator: ioctl_ping failed for device_type=5, ret=-1

2020-06-25 21:34:47.935 6306-6306/com.labawsrh.aws.introscreen E/InputEventReceiver: Exception dispatching input event.

2020-06-25 21:34:47.942 6306-6306/com.labawsrh.aws.introscreen E/AndroidRuntime: FATAL EXCEPTION: mainProcess: com.labawsrh.aws.introscreen, PID: 6306java.lang.NullPointerException: Attempt to invoke interface method 'void com.alexzh.circleimageview.ItemSelectedListener.onUnselected(android.view.View)' on a null object referenceat com.alexzh.circleimageview.CircleImageView.hidePressedRing(CircleImageView.java:433)at com.alexzh.circleimageview.CircleImageView.setPressed(CircleImageView.java:406)at android.view.View.onTouchEvent(View.java:13847)at android.view.View.dispatchTouchEvent(View.java:12513)at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3000)at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2719)at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3000)at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2719)at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3000)at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2719)at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3000)at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2719)at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3000)at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2719)at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3030)at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2719)at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3030)at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2719)at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3030)at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2719)at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3030)at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2719)at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3030)at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2719)at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:440)at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1830)at android.app.Activity.dispatchTouchEvent(Activity.java:3400)at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:69)at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:398)at android.view.View.dispatchPointerEvent(View.java:12752)at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:5106)at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4909)at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4426)at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4479)at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4445)at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4585)at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4453)at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4642)at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4426)at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4479)at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4445)at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4453)at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4426)at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:7092)at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:7061)at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:7022)at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:7195)at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:186)at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method)2020-06-25 21:34:47.943 6306-6306/com.labawsrh.aws.introscreen E/AndroidRuntime: at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:177)at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:7166)at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:7218)at android.view.Choreographer$CallbackRecord.run(Choreographer.java:949)at android.view.Choreographer.doCallbacks(Choreographer.java:761)at android.view.Choreographer.doFrame(Choreographer.java:690)at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:935)at android.os.Handler.handleCallback(Handler.java:873)at android.os.Handler.dispatchMessage(Handler.java:99)at android.os.Looper.loop(Looper.java:193)at android.app.ActivityThread.main(ActivityThread.java:6669)at java.lang.reflect.Method.invoke(Native Method)at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

Unfortunately MyApp has stopped. How can I solve this?

$
0
0

I am developing an application, and everytime I run it, I get the message:

Unfortunately, MyApp has stopped.

What can I do to solve this?


About this question - obviously inspired by What is a stack trace, and how can I use it to debug my application errors?, there are lots of questions stating that their application has crashed, without any further detail. This question aims to instruct novice Android programmers on how to try and fix their problems themselves, or ask the right questions.

What happen in production mode if Django crash?

$
0
0

I'm new to Django.Since in a development environment it happens that an error occurs after a request (often because it is badly handled) and Django crashes, I thought about creating a script (in production) to detect if Django is running and if not run it again (something like this). And of course after adding block try except everywhere.

But since Django is well done it wouldn't surprise me if this concern is already taken in consideration, hence my question.

Thank you.


CEF crash when app exit (QT5+CEF3.2526)

$
0
0

it is a very simple QT+CEF windows application, see https://github.com/GreatTux/CefMinGWQt

when I close the main window CEF trigger the breakpoint:I guess I failed here:

void CefBrowserMainParts::PostMainMessageLoopRun() {....#ifndef NDEBUG// No CefBrowserContext instances should exist at this point.DCHECK_EQ(0, CefBrowserContext::DebugObjCt);#endif}

I don't know what is the correct way to free the browser resource, I have looked a lot of examples on web, almost all of them got this problem on my Windows 7+vs2010 env

I also try this but doesn't work

void ClientHandler::OnBeforeClose(CefRefPtr<CefBrowser> browser) {  if(m_browser.get())    m_browser = NULL;

==== trace ===

libcef.dll!base::debug::BreakDebugger()  Line 21    C++libcef.dll!logging::LogMessage::~LogMessage()  Line 604 C++libcef.dll!CefBrowserMainParts::PostMainMessageLoopRun()  Line 189  C++libcef.dll!content::BrowserMainLoop::ShutdownThreadsAndCleanUp()  Line 946 + 0x27 bytes C++libcef.dll!content::BrowserMainRunnerImpl::Shutdown()  Line 293 C++libcef.dll!CefMainDelegate::ShutdownBrowser()  Line 659 + 0x1b bytes    C++libcef.dll!CefContext::FinalizeShutdown()  Line 462 C++libcef.dll!CefContext::Shutdown()  Line 345 C++libcef.dll!CefShutdown()  Line 171  C++libcef.dll!cef_shutdown()  Line 192 C++qtloop.exe!CefShutdown()  Line 180 + 0x8 bytes  C++qtloop.exe!main(int argc=1, char * * argv=0x00375b90)  Line 35  C++qtloop.exe!WinMain(HINSTANCE__ * __formal=0x00fe0000, HINSTANCE__ *    __formal=0x00fe0000, HINSTANCE__ * __formal=0x00fe0000, HINSTANCE__ * __formal=0x00fe0000)  Line 113 + 0xd bytes C++qtloop.exe!__tmainCRTStartup()  Line 547 + 0x2c bytes   Cqtloop.exe!WinMainCRTStartup()  Line 371    C

How to tell Netbeans IDE not to open previously opened projects on startup

$
0
0

My netbeans seems to freeze every time I try to open it. It says waiting projects opened. I want to somehow clear the list of 'open projects' so that netbeans doesn't try and open them automatically on startup.

Maybe clearing the cache or something?

I'm running Netbeans 7.3 on Mac OS: X Mountain Lion

Unity Android APK crashing on startup

$
0
0

OK, so since I last successfully built, all I have done is tried adding Google Play Services to my game, from here.

I imported the unity package, and setup the google play games for android in the relevant setup window.

I tried building at this point, however I was unable to, recieved that strange error whilst building dex files signifying there being a conflict between aar files. I narrowed it down to being caused by both assets/plugins/android/play-services-base-9.0.2 and assets/plugins/android/play-services-basement-9.0.2.

I unchecked both of these being built to android to have the conversion to dex error stuff go away. I assumed this would be OK.

I then pushed the app onto Google Play, (alpha environment) along with a small controller script for Google Play to login on start():

void Awake(){    // recommended for debugging:    PlayGamesPlatform.DebugLogEnabled = true;    // Activate the Google Play Games platform    PlayGamesPlatform.Activate();}void Start(){    Login();}void Login(){    Social.localUser.Authenticate((bool success) => {        LoggedIn = success;    });}

However Unity appears to be crashing before opening the first scene. It is crashing right away, upon startup. The logcat stuff can be seen here.

The problem appears to occur around line 842:

10-07 06:03:06.282: E/AndroidRuntime(9551): FATAL EXCEPTION: main10-07 06:03:06.298: W/ActivityManager(771):   Force finishing activity 1 com.PINGUAPPS.TEMPLATE/com.unity3d.player.UnityPlayerNativeActivity10-07 06:03:06.339: W/ActivityManager(771):   Force finishing activity 2 com.google.android.apps.mtaas.backdrop/.BackdropActivity10-07 06:03:06.402: D/Atlas(771): Validating map...

I have no idea how to fix this?

::Additional Info::

So I have rolled back to a point where I have the unity package imported into Unity, but I haven't configured it yet, giving it my xml containing the resources. It is giving a nullreferenceexception in the editor at this point:

NullReferenceException: Object reference not set to an instance of an objectGooglePlayServices.PlayServicesResolver.OnPostprocessAllAssets (System.String[] importedAssets, System.String[] deletedAssets, System.String[] movedAssets, System.String[] movedFromAssetPaths) (at Assets/PlayServicesResolver/Editor/PlayServicesResolver.cs:104)System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)UnityEditor.AssetPostprocessingInternal.PostprocessAllAssets (System.String[] importedAssets, System.String[] addedAssets, System.String[] deletedAssets, System.String[] movedAssets, System.String[] movedFromPathAssets) (at C:/buildslave/unity/build/Editor/Mono/AssetPostprocessor.cs:27)UnityEditor.AssetDatabase:Refresh()GooglePlayGames.Editor.GPGSUpgrader:.cctor() (at Assets/GooglePlayGames/Editor/GPGSUpgrader.cs:107)UnityEditor.EditorAssemblies:SetLoadedEditorAssemblies(Assembly[])

The line it references is:

if (!Resolver.ShouldAutoResolve(importedAssets, deletedAssets,                movedAssets, movedFromAssetPaths))

However right after this nullreferenceexception, I see the resolver being registered in the logs. Such as:

Registering resolver version 1.2.0UnityEngine.Debug:Log(Object)GooglePlayServices.ResolverVer1_2:.cctor() (at Assets/PlayServicesResolver/Editor/ResolverVer1_2.cs:34)UnityEditor.EditorAssemblies:SetLoadedEditorAssemblies(Assembly[])

etc.

Now, I can build this APK and run it on my phone fine, no problems. (Obviously google play game services won't do much, as it isn't configured).

So, I go to Window >> Google Play Games >> Setup >> Androidand here, I paste my resources XML.I give a place and name for the resources C# file, and hit Setup.

I see the following Jar Dependency Conflict options:

Remove or replace play-services-ads version 9.0.2 with version 9.6.1?Remove or replace support-v4 version 23.1.1 with version 24.0.0?Remove or replace play-services-gcm version 9.0.2 with version 9.6.1?Remove or replace play-services-location version 9.0.2 with version 9.6.1?Remove or replace play-services-base version 9.0.2 with version 9.6.1?Remove or replace play-services-basement version 9.0.2 with version 9.6.1?Remove or replace support-annotations version 23.1.1 with version 23.4.0?Remove or replace play-services-iid version 9.0.2 with version 9.6.1?Remove or replace play-services-tasks version 9.0.2 with version 9.6.1?

I have tried pressing keep to all of these as well as OK, both actions end up causing a conflict with my aars.

I just tried again, this time pressing OK to all of them, and attempted to build again having only done this since my last successful build. Whilst converting the jars to dex format, it fails the build giving the following error:

CommandInvokationFailure: Unable to convert classes into dex format.C:\Program Files (x86)\Java\jdk1.7.0_55\bin\java.exe -Xmx1024M -Dcom.android.sdkmanager.toolsdir="C:/Users/PINGU/AppData/Local/Android/sdk\tools" -Dfile.encoding=UTF8 -jar "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -stderr[warning: Ignoring InnerClasses attribute for an anonymous inner class(com.fyber.a) that doesn't come with anassociated EnclosingMethod attribute. This class was probably produced by acompiler that did not target the modern .class file format. The recommendedsolution is to recompile the class from source, using an up-to-date compilerand without specifying any "-target" type options. The consequence of ignoringthis warning is that reflective operations on this class will incorrectlyindicate that it is *not* an inner class.warning: Ignoring InnerClasses attribute for an anonymous inner class(com.fyber.ads.banners.BannerSize$1) that doesn't come with anassociated EnclosingMethod attribute. This class was probably produced by acompiler that did not target the modern .class file format. The recommendedsolution is to recompile the class from source, using an up-to-date compilerand without specifying any "-target" type options. The consequence of ignoringthis warning is that reflective operations on this class will incorrectlyindicate that it is *not* an inner class.warning: Ignoring InnerClasses attribute for an anonymous inner class(com.fyber.ads.banners.b) that doesn't come with anassociated EnclosingMethod attribute. This class was probably produced by acompiler that did not target the modern .class file format. The recommendedsolution is to recompile the class from source, using an up-to-date compilerand without specifying any "-target" type options. The consequence of ignoringthis warning is that reflective operations on this class will incorrectlyindicate that it is *not* an inner class.warning: Ignoring InnerClasses attribute for an anonymous inner class(com.fyber.ads.banners.d) that doesn't come with anassociated EnclosingMethod attribute. This class was probably produced by acompiler that did not target the modern .class file format. The recommendedsolution is to recompile the class from source, using an up-to-date compilerand without specifying any "-target" type options. The consequence of ignoringthis warning is that reflective operations on this class will incorrectlyindicate that it is *not* an inner class.warning: Ignoring InnerClasses attribute for an anonymous inner class(com.fyber.ads.banners.a) that doesn't come with anassociated EnclosingMethod attribute. This class was probably produced by acompiler that did not target the modern .class file format. The recommendedsolution is to recompile the class from source, using an up-to-date compilerand without specifying any "-target" type options. The consequence of ignoringthis warning is that reflective operations on this class will incorrectlyindicate that it is *not* an inner class.warning: Ignoring InnerClasses attribute for an anonymous inner class(com.fyber.ads.banners.c) that doesn't come with anassociated EnclosingMethod attribute. This class was probably produced by acompiler that did not target the modern .class file format. The recommendedsolution is to recompile the class from source, using an up-to-date compilerand without specifying any "-target" type options. The consequence of ignoringthis warning is that reflective operations on this class will incorrectlyindicate that it is *not* an inner class.warning: Ignoring InnerClasses attribute for an anonymous inner class(com.fyber.ads.interstitials.a.b) that doesn't come with anassociated EnclosingMethod attribute. This class was probably produced by acompiler that did not target the modern .class file format. The recommendedsolution is to recompile the class from source, using an up-to-date compilerand without specifying any "-target" type options. The consequence of ignoringthis warning is that reflective operations on this class will incorrectlyindicate that it is *not* an inner class.warning: Ignoring InnerClasses attribute for an anonymous inner class(com.fyber.ads.interstitials.a.c) that doesn't come with anassociated EnclosingMethod attribute. This class was probably produced by acompiler that did not target the modern .class file format. The recommendedsolution is to recompile the class from source, using an up-to-date compilerand without specifying any "-target" type options. The consequence of ignoringthis warning is that reflective operations on this class will incorrectlyindicate that it is *not* an inner class.warning: Ignoring InnerClasses attribute for an anonymous inner class(com.fyber.ads.ofw.a) that doesn't come with anassociated EnclosingMethod attribute. This class was probably produced by acompiler that did not target the modern .class file format. The recommendedsolution is to recompile the class from source, using an up-to-date compilerand without specifying any "-target" type options. The consequence of ignoringthis warning is that reflective operations on this class will incorrectlyindicate that it is *not* an inner class.warning: Ignoring InnerClasses attribute for an anonymous inner class(com.fyber.ads.videos.a) that doesn't come with anassociated EnclosingMethod attribute. This class was probably produced by acompiler that did not target the modern .class file format. The recommendedsolution is to recompile the class from source, using an up-to-date compilerand without specifying any "-target" type options. The consequence of ignoringthis warning is that reflective operations on this class will incorrectlyindicate that it is *not* an inner class.warning: Ignoring InnerClasses attribute for an anonymous inner class(com.fyber.ads.videos.a.e) that doesn't come with anassociated EnclosingMethod attribute. This class was probably produced by acompiler that did not target the modern .class file format. The recommendedsolution is to recompile the class from source, using an up-to-date compilerand without specifying any "-target" type options. The consequence of ignoringthis warning is that reflective operations on this class will incorrectlyindicate that it is *not* an inner class.warning: Ignoring InnerClasses attribute for an anonymous inner class(com.fyber.ads.videos.a.f) that doesn't come with anassociated EnclosingMethod attribute. This class was probably produced by acompiler that did not target the modern .class file format. The recommendedsolution is to recompile the class from source, using an up-to-date compilerand without specifying any "-target" type options. The consequence of ignoringthis warning is that reflective operations on this class will incorrectlyindicate that it is *not* an inner class.warning: Ignoring InnerClasses attribute for an anonymous inner class(com.fyber.ads.videos.a.g) that doesn't come with anassociated EnclosingMethod attribute. This class was probably produced by acompiler that did not target the modern .class file format. The recommendedsolution is to recompile the class from source, using an up-to-date compilerand without specifying any "-target" type options. The consequence of ignoringthis warning is that reflective operations on this class will incorrectlyindicate that it is *not* an inner class.warning: Ignoring InnerClasses attribute for an anonymous inner class(com.fyber.ads.videos.a.h) that doesn't come with anassociated EnclosingMethod attribute. This class was probably produced by acompiler that did not target the modern .class file format. The recommendedsolution is to recompile the class from source, using an up-to-date compilerand without specifying any "-target" type options. The consequence of ignoringthis warning is that reflective operations on this class will incorrectlyindicate that it is *not* an inner class.warning: Ignoring InnerClasses attribute for an anonymous inner class(com.fyber.ads.videos.a.d) that doesn't come with anassociated EnclosingMethod attribute. This class was probably produced by acompiler that did not target the modern .class file format. The recommendedsolution is to recompile the class from source, using an up-to-date compilerand without specifying any "-target" type options. The consequence of ignoringthis warning is that reflective operations on this class will incorrectlyindicate that it is *not* an inner class.warning: Ignoring InnerClasses attribute for an anonymous inner class(com.fyber.ads.videos.a.i) that doesn't come with anassociated EnclosingMethod attribute. This class was probably produced by acompiler that did not target the modern .class file format. The recommendedsolution is to recompile the class from source, using an up-to-date compilerand without specifying any "-target" type options. The consequence of ignoringthis warning is that reflective operations on this class will incorrectlyindicate that it is *not* an inner class.warning: Ignoring InnerClasses attribute for an anonymous inner class(com.fyber.ads.videos.a.j) that doesn't come with anassociated EnclosingMethod attribute. This class was probably produced by acompiler that did not target the modern .class file format. The recommendedsolution is to recompile the class from source, using an up-to-date compilerand without specifying any "-target" type options. The consequence of ignoringthis warning is that reflective operations on this class will incorrectlyindicate that it is *not* an inner class.warning: Ignoring InnerClasses attribute for an anonymous inner class(com.fyber.ads.videos.a.m) that doesn't come with anassociated EnclosingMethod attribute. This class was probably produced by acompiler that did not target the modern .class file format. The recommendedsolution is to recompile the class from source, using an up-to-date compilerand without specifying any "-target" type options. The consequence of ignoringthis warning is that reflective operations on this class will incorrectlyindicate that it is *not* an inner class.warning: Ignoring InnerClasses attribute for an anonymous inner class(com.fyber.ads.videos.a.n) that doesn't come with anassociated EnclosingMethod attribute. This class was probably produced by acompiler that did not target the modern .class file format. The recommendedsolution is to recompile the class from source, using an up-to-date compilerand without specifying any "-target" type options. The consequence of ignoringthis warning is that reflective operations on this class will incorrectlyindicate that it is *not* an inner class.warning: Ignoring InnerClasses attribute for an anonymous inner class(com.fyber.ads.videos.a.o) that doesn't come with anassociated EnclosingMethod attribute. This class was probably produced by acompiler that did not target the modern .class file format. The recommendedsolution is to recompile the class from source, using an up-to-date compilerand without specifying any "-target" type options. The consequence of ignoringthis warning is that reflective operations on this class will incorrectlyindicate that it is *not* an inner class.warning: Ignoring InnerClasses attribute for an anonymous inner class(com.fyber.ads.videos.b) that doesn't come with anassociated EnclosingMethod attribute. This class was probably produced by acompiler that did not target the modern .class file format. The recommendedsolution is to recompile the class from source, using an up-to-date compilerand without specifying any "-target" type options. The consequence of ignoringthis warning is that reflective operations on this class will incorrectlyindicate that it is *not* an inner class.warning: Ignoring InnerClasses attribute for an anonymous inner class(com.fyber.ads.videos.c) that doesn't come with anassociated EnclosingMethod attribute. This class was probably produced by acompiler that did not target the modern .class file format. The recommendedsolution is to recompile the class from source, using an up-to-date compilerand without specifying any "-target" type options. The consequence of ignoringthis warning is that reflective operations on this class will incorrectlyindicate that it is *not* an inner class.warning: Ignoring InnerClasses attribute for an anonymous inner class(com.fyber.ads.videos.e) that doesn't come with anassociated EnclosingMethod attribute. This class was probably produced by acompiler that did not target the modern .class file format. The recommendedsolution is to recompile the class from source, using an up-to-date compilerand without specifying any "-target" type options. The consequence of ignoringthis warning is that reflective operations on this class will incorrectlyindicate that it is *not* an inner class.warning: Ignoring InnerClasses attribute for an anonymous inner class(com.fyber.ads.videos.h) that doesn't come with anassociated EnclosingMethod attribute. This class was probably produced by acompiler that did not target the modern .class file format. The recommendedsolution is to recompile the class from source, using an up-to-date compilerand without specifying any "-target" type options. The consequence of ignoringthis warning is that reflective operations on this class will incorrectlyindicate that it is *not* an inner class.warning: Ignoring InnerClasses attribute for an anonymous inner class(com.fyber.ads.videos.f) that doesn't come with anassociated EnclosingMethod attribute. This class was probably produced by acompiler that did not target the modern .class file format. The recommendedsolution is to recompile the class from source, using an up-to-date compilerand without specifying any "-target" type options. The consequence of ignoringthis warning is that reflective operations on this class will incorrectlyindicate that it is *not* an inner class.warning: Ignoring InnerClasses attribute for an anonymous inner class(com.fyber.ads.videos.g) that doesn't come with anassociated EnclosingMethod attribute. This class was probably produced by acompiler that did not target the modern .class file format. The recommendedsolution is to recompile the class from source, using an up-to-date compilerand without specifying any "-target" type options. The consequence of ignoringthis warning is that reflective operations on this class will incorrectlyindicate that it is *not* an inner class.warning: Ignoring InnerClasses attribute for an anonymous inner class(com.fyber.ads.videos.k) that doesn't come with anassociated EnclosingMethod attribute. This class was probably produced by acompiler that did not target the modern .class file format. The recommendedsolution is to recompile the class from source, using an up-to-date compilerand without specifying any "-target" type options. The consequence of ignoringthis warning is that reflective operations on this class will incorrectlyindicate that it is *not* an inner class.warning: Ignoring InnerClasses attribute for an anonymous inner class(com.fyber.ads.videos.i) that doesn't come with anassociated EnclosingMethod attribute. This class was probably produced by acompiler that did not target the modern .class file format. The recommendedsolution is to recompile the class from source, using an up-to-date compilerand without specifying any "-target" type options. The consequence of ignoringthis warning is that reflective operations on this class will incorrectlyindicate that it is *not* an inner class.warning: Ignoring InnerClasses attribute for an anonymous inner class(com.fyber.ads.videos.j) that doesn't come with anassociated EnclosingMethod attribute. This class was probably produced by acompiler that did not target the modern .class file format. The recommendedsolution is to recompile the class from source, using an up-to-date compilerand without specifying any "-target" type options. The consequence of ignoringthis warning is that reflective operations on this class will incorrectlyindicate that it is *not* an inner class.warning: Ignoring InnerClasses attribute for an anonymous inner class(com.fyber.ads.videos.l) that doesn't come with<message truncated>

As mentioned previously, I can prevent this from happening by locating my play-services-base and play-services-basement files and unchecking them to be built for android. When I do this the APK builds, however the app will crash as soon as its opened.

Android App crashes when using SharedPreferences

$
0
0

I made this app to get list of friends and store it in sharedPreferences, when i run the application it doesn't show any error and crashes.Please Help

here's my code

package com.abhishek.sharedpreferances;import androidx.appcompat.app.AppCompatActivity;import android.content.Context;import android.content.SharedPreferences;import android.os.Bundle;import android.view.View;import android.widget.Button;import android.widget.EditText;import android.widget.TextView;import java.io.IOException;import java.util.ArrayList;public class MainActivity extends AppCompatActivity {    EditText editTextFriends = (EditText) findViewById(R.id.editTextFriends);    Button buttonSave = (Button) findViewById(R.id.buttonSave);    TextView textViewFriends = (TextView) findViewById(R.id.textViewFriends);    SharedPreferences sharedPreferences = this.getSharedPreferences("com.abhishek.sharedpreferances", Context.MODE_PRIVATE);    ArrayList<String> friends = new ArrayList<>();    ArrayList<String> newFriends = new ArrayList<>();    public void save(View view) throws IOException {        friends.add(editTextFriends.getText().toString());        //ObjectSerializer.serialize(friends);        try {            sharedPreferences.edit().putString("friends",ObjectSerializer.serialize(friends)).apply();        } catch (Exception e) {            e.printStackTrace();        }        newFriends = (ArrayList<String>) ObjectSerializer.deserialize(sharedPreferences.getString("friends",ObjectSerializer.serialize(new ArrayList<String>())));        assert newFriends != null;        textViewFriends.setText(newFriends.toString());    }    @Override    protected void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentView(R.layout.activity_main);    }}

And i created ObjectSerializer java class to store Array list into the sharedPreferences into the application i have provided the class below please check it outAnd this is my ObjectSerializer java class

package com.abhishek.sharedpreferances;import android.util.Log;import java.io.ByteArrayInputStream;import java.io.ByteArrayOutputStream;import java.io.IOException;import java.io.ObjectInputStream;import java.io.ObjectOutputStream;import java.io.Serializable;public class ObjectSerializer {    public static String serialize(Serializable obj) throws IOException {        if (obj == null) return "";        try {            ByteArrayOutputStream serialObj = new ByteArrayOutputStream();            ObjectOutputStream objStream = new ObjectOutputStream(serialObj);            objStream.writeObject(obj);            objStream.close();            return encodeBytes(serialObj.toByteArray());        } catch (Exception e) {            throw new RuntimeException(e);        }    }    public static Object deserialize(String str) throws IOException {        if (str == null || str.length() == 0) return null;        try {            ByteArrayInputStream serialObj = new ByteArrayInputStream(decodeBytes(str));            ObjectInputStream objStream = new ObjectInputStream(serialObj);            return objStream.readObject();        } catch (Exception e) {            throw new RuntimeException(e);        }    }    public static String encodeBytes(byte[] bytes) {        StringBuffer strBuf = new StringBuffer();        for (int i = 0; i < bytes.length; i++) {            strBuf.append((char) (((bytes[i] >> 4) & 0xF) + ((int) 'a')));            strBuf.append((char) (((bytes[i]) & 0xF) + ((int) 'a')));        }        return strBuf.toString();    }    public static byte[] decodeBytes(String str) {        byte[] bytes = new byte[str.length() / 2];        for (int i = 0; i < str.length(); i+=2) {            char c = str.charAt(i);            bytes[i/2] = (byte) ((c - 'a') << 4);            c = str.charAt(i+1);            bytes[i/2] += (c - 'a');        }        return bytes;    }}

I have this crash while testing my app. I am a complete beginner and cant understand how to fix this, any solution?

$
0
0

This is what the logcat is showing Me while Running the app,i cant understand what to do, please help me by telling me what to do.when i run my app the activity just pops up and closes in an instant.i dont get a 'app not responding' message too

--------- beginning of crash2020-06-29 11:47:22.592 24843-24843/com.example.passwordgenerator E/AndroidRuntime: FATAL EXCEPTION: main    Process: com.example.passwordgenerator, PID: 24843    java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.passwordgenerator/com.example.passwordgenerator.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.pm.ApplicationInfo android.content.Context.getApplicationInfo()' on a null object reference        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3355)        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3614)        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:86)        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2199)        at android.os.Handler.dispatchMessage(Handler.java:112)        at android.os.Looper.loop(Looper.java:216)        at android.app.ActivityThread.main(ActivityThread.java:7625)        at java.lang.reflect.Method.invoke(Native Method)        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)     Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.pm.ApplicationInfo android.content.Context.getApplicationInfo()' on a null object reference        at android.content.ContextWrapper.getApplicationInfo(ContextWrapper.java:159)        at android.view.ContextThemeWrapper.getTheme(ContextThemeWrapper.java:157)        at android.content.Context.obtainStyledAttributes(Context.java:679)        at androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor(AppCompatDelegateImpl.java:692)        at androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor(AppCompatDelegateImpl.java:659)        at androidx.appcompat.app.AppCompatDelegateImpl.findViewById(AppCompatDelegateImpl.java:479)        at androidx.appcompat.app.AppCompatActivity.findViewById(AppCompatActivity.java:214)        at com.example.passwordgenerator.MainActivity.<init>(MainActivity.java:16)        at java.lang.Class.newInstance(Native Method)        at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:69)        at androidx.core.app.CoreComponentFactory.instantiateActivity(CoreComponentFactory.java:41)        at android.app.Instrumentation.newActivity(Instrumentation.java:1224)        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3340)        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3614)         at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:86)         at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)         at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)         at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2199)         at android.os.Handler.dispatchMessage(Handler.java:112)         at android.os.Looper.loop(Looper.java:216)         at android.app.ActivityThread.main(ActivityThread.java:7625)         at java.lang.reflect.Method.invoke(Native Method)         at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987) 2020-06-29 11:47:22.638 24843-24843/? I/Process: Sending signal. PID: 24843 SIG: 9
Viewing all 7150 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>