0

I have been developing a project for my client. It is a type of social media application. The database is firebase and it is written in java and some kotlin. The debug apk was fine. I have tested it and also used it but when I try to release the app on playstore, I have to generate a signed apk, but the signed apk is not like debug apk it has many bugs. I don’t know what’s happening, please help me.

                                          Thank you in advance.
  • 4
    It may be a lot more helpful if you can list down the errors you are getting. If you just say there are a lot of errors or bugs, no one will be able to help you, as we do not know what the error is. – iWantSimpleLife Oct 29 '21 at 01:40
  • 1
    Please provide enough code so others can better understand or reproduce the problem. – Community Oct 29 '21 at 03:14
  • As I said it's a social media app. There is a login and registration form. The registration form works fine The data is uploading on database and firebase authentication is also working fine. The problems come when I try to login it says incorrect password even when it's correct. Application crashes on uploading a post. The data in my profile page shows as null. But I don't get these kind of bugs in debug apk. – Mohammed Mustaq Oct 29 '21 at 05:14
  • try investigating with logcat for example to see any stack traces – Ivo Oct 29 '21 at 06:26
  • already tried but not quiet working – Mohammed Mustaq Oct 29 '21 at 09:00

1 Answers1

0

I had similar problem. Only now I discovered that the standard intellIj and Android Studio mode are debug mode.

I reviewed the threads of my application on release mode, and replaced the threads of type 1 for threads of type 2:

Threads Type 1:

class TimeCheckURL extends TimerTask
{
    @RequiresApi(api = Build.VERSION_CODES.M)
    public void run()
    {
        
        new Thread(new Runnable() {
            @Override
            public void run() {

                Data = null;       
                Data = new JsonTask().execute(urlBase);
                threadEnd = true;
            }
        }).start();        
    }
}

Threads Type 2:

Thread threadReadHexBsvTx = new Thread(new Runnable() {
    @Override
    public void run() {
        try {

            Data = JsonTask(urlBase);

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
});

private void renewThread()
{
    threadReadHexBsvTx = new Thread(new Runnable() {
        @Override
        public void run() {
            try {

                Data = JsonTask(urlBase);

            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
}

To monitor if threads type 1 were still alive I used the following approach;

    while (!threadEnd) {
        //do something
    } 

It worked very well when I unknowingly developed under Build Variant Debug, however when I put it on playstore I discovered that there was a release variant, and that my application did not worked properly on release mode.

It happened because everytime the processes using threads type 1 were called for the second time, the thread did not updated "threadEnd" and it looped forever.

I discovered that I could monitor the state of thread type 2 using this aproach.

 while (bsvTX.threadBroadCast.isAlive()) {
        //do something
    }

This solved the problem in my application. However, I could not use approach of thread type 2 on thread type 1.

It might sound very noob, but I also discovered that for threads type 2 to work the second time the processes called them, they had to be renewed, that is why I use the method renewThread().

  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 14 '22 at 17:58