2

I am getting error messages when I try building a release apk and this has only started happening since I changed the build variant to release instead of debug.

So I have had a look at this post and I had a look at all the things that could be causing my error but I just can't seem to find the problem with my code. I assume this post is going to get flagged as a duplicate but I prefer having another programmer look at my code and then I can resolve the problem from there. I really would appreciate if someone could do that for me. Here is the code, the errors I receive from the Gradle Build and my import library:

public class LoginActivity extends AppCompatActivity {
private static final String TAG = LoginActivity.class.getSimpleName();
private Button mbtnLogin;
private Button mbtnForgetPassword;
private TextView mTextStateOnline;
private EditText minputEmail;
private EditText minputPassword;
private ProgressDialog mpDialog;
private Switch mSwitch;
public static SQLiteHandler sDb;
public static FileManager fileManager;
public static User sUserco;
public static int sRank;
public static boolean sOnline=true;


@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);

    //-----------------Set up manager--------------
    fileManager = new FileManager(this);

    //-----------------Find View--------------
    minputEmail = (EditText) findViewById(R.id.email);
    minputPassword = (EditText) findViewById(R.id.password);
    mbtnLogin = (Button) findViewById(R.id.btnLogin);
    mbtnForgetPassword = (Button) findViewById (R.id.Login_forget_pasword);
    mTextStateOnline = (TextView) findViewById(R.id.Login_state_online);
    mSwitch = (Switch) findViewById(R.id.switch2);

Messages from Gradle Build:

M:\Live Projects\IT\Projects\Ghana app\Source Code\Mednet_Ghana\app\src\main\java\co\uk\mednet\mednet_ghana\activity\LoginActivity.java
Error:(81, 32) error: cannot find symbol variable activity_login
Error:(87, 51) error: cannot find symbol variable email
Error:(88, 54) error: cannot find symbol variable password
Error:(89, 47) error: cannot find symbol variable btnLogin
Error:(90, 57) error: cannot find symbol variable Login_forget_pasword
Error:(91, 56) error: cannot find symbol variable Login_state_online
Error:(92, 45) error: cannot find symbol variable switch2

Import Libs:

import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.RadioGroup;
import android.widget.Switch;
import android.widget.TextClock;
import android.widget.TextView;
import android.widget.Toast;

import com.android.volley.Request.Method;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.google.gson.Gson;

import org.json.JSONException;
import org.json.JSONObject;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

import co.uk.mednet.mednet_ghana.R;
import co.uk.mednet.mednet_ghana.app.AppConfig;
import co.uk.mednet.mednet_ghana.app.AppController;
import co.uk.mednet.mednet_ghana.helper.FileManager;
import co.uk.mednet.mednet_ghana.helper.SQLiteHandler;
import co.uk.mednet.mednet_ghana.model.Answer;
import co.uk.mednet.mednet_ghana.model.AssessmentFile;
import co.uk.mednet.mednet_ghana.model.Lesson;
import co.uk.mednet.mednet_ghana.model.Question;
import co.uk.mednet.mednet_ghana.model.User;

1 Answers1

1

I simply fixed this by going to my Project_Name\Module_Name\build\outputs\apk\. I then deleted the apk that was in there, restarted android studio and went to Build>Generate Signed APK. I chose Generate Signed APK because that is what I needed to upload the APK to Google Play Console. I'm sure this will be transferable to the same problem, just as long as you Build Apk instead of the signed apk which requires more steps.