Click here to Skip to main content
14,837,089 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello, Guys, I am working on an android app with PHP MySQL am getting an error when I press button register so my app automatically closes and I am getting some errors please help me how can I solve it.Thanks
......................................................................................
Error
......................................................................................
$ adb shell pm install -r "/data/local/tmp/com.example.sajid.complainprotectioncell"
Success


$ adb shell am start -n "com.example.sajid.complainprotectioncell/com.example.sajid.complainprotectioncell.Register" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Connected to process 2346 on device Digisoft_10_inch_emulator [emulator-5554]
I/art: Not late-enabling -Xcheck:jni (already on)
W/art: Unexpected CPU variant for X86 using defaults: x86
W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
W/art: Long monitor contention with owner GoogleApiHandler (2364) at boolean android.os.BinderProxy.transactNative(int, android.os.Parcel, android.os.Parcel, int)(Binder.java:-2) waiters=0 in int com.google.android.gms.dynamite.DynamiteModule.zzb(android.content.Context, java.lang.String, boolean) for 1.525s
W/System: ClassLoader referenced unknown path: /system/priv-app/PrebuiltGmsCore/lib/x86
D/ApplicationLoaders: ignored Vulkan layer search path /system/priv-app/PrebuiltGmsCore/lib/x86:/system/fake-libs:/system/priv-app/PrebuiltGmsCore/PrebuiltGmsCore.apk!/lib/x86:/system/lib:/vendor/lib for namespace 0xa8e94090
W/art: Long monitor contention with owner main (2346) at com.google.android.gms.dynamite.zza com.google.android.gms.dynamite.DynamiteModule.zzbm(android.content.Context)(:-1) waiters=0 in com.google.android.gms.dynamite.zza com.google.android.gms.dynamite.DynamiteModule.zzbm(android.content.Context) for 394ms
W/System: ClassLoader referenced unknown path:
W/System: ClassLoader referenced unknown path: /system/priv-app/PrebuiltGmsCore/lib/x86
D/ApplicationLoaders: ignored Vulkan layer search path /system/priv-app/PrebuiltGmsCore/lib/x86:/system/fake-libs:/system/priv-app/PrebuiltGmsCore/PrebuiltGmsCore.apk!/lib/x86:/system/lib:/vendor/lib for namespace 0xa8e940d0
W/DynamiteLoaderImpl: Failed to load module version: module com.google.android.gms.flags not found
I/DynamiteModule: Considering local module com.google.android.gms.flags:2 and remote module com.google.android.gms.flags:0
I/DynamiteModule: Selected local version of com.google.android.gms.flags
W/DynamiteModule: Local module descriptor class for com.google.android.gms.crash not found.
I/DynamiteModule: Considering local module com.google.android.gms.crash:0 and remote module com.google.android.gms.crash:4
I/DynamiteModule: Selected remote version of com.google.android.gms.crash, version >= 4
W/System: ClassLoader referenced unknown path: /data/user_de/0/com.google.android.gms/app_chimera/m/00000003/n/x86
I/FirebaseCrashApiImpl: FirebaseCrashApiImpl created by ClassLoader bzi[DexPathList[[zip file "/system/priv-app/PrebuiltGmsCore/app_chimera/m/DynamiteModulesC.apk"],nativeLibraryDirectories=[/data/user_de/0/com.google.android.gms/app_chimera/m/00000003/n/x86, /system/lib, /vendor/lib]]]
W/DynamiteLoaderImpl: Failed to load module version: module com.google.android.gms.flags not found
I/DynamiteModule: Considering local module com.google.android.gms.flags:2 and remote module com.google.android.gms.flags:0
I/DynamiteModule: Selected local version of com.google.android.gms.flags
W/DynamiteModule: Local module descriptor class for com.google.android.gms.crash not found.
I/FA: App measurement is starting up, version: 10298
I/FA: To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
V/FA: Collection enabled
V/FA: App package, google app id: com.example.sajid.complainprotectioncell, 1:880272272061:android:cb340b49dd317c88
I/FA: To enable faster debug mode event logging run:
adb shell setprop debug.firebase.analytics.app com.example.sajid.complainprotectioncell
D/FA: Debug-level message logging enabled
V/FA: Registered activity lifecycle callback
I/FirebaseCrash: FirebaseCrash reporting initialized com.google.android.gms.internal.zzbnq@642a897
I/FirebaseInitProvider: FirebaseApp initialization successful
V/FA: Using measurement service
V/FA: Connecting to remote service
W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
V/FA: onActivityCreated
I/TextInputLayout: EditText added is not a TextInputEditText. Please switch to using that class instead.
I/TextInputLayout: EditText added is not a TextInputEditText. Please switch to using that class instead.
I/TextInputLayout: EditText added is not a TextInputEditText. Please switch to using that class instead.
I/TextInputLayout: EditText added is not a TextInputEditText. Please switch to using that class instead.
I/TextInputLayout: EditText added is not a TextInputEditText. Please switch to using that class instead.
V/FA: Using measurement service
V/FA: Connection attempt already in progress
V/FA: Activity resumed, time: 52501
I/OpenGLRenderer: Initialized EGL, version 1.4
D/OpenGLRenderer: Swap behavior 1
I/Choreographer: Skipped 135 frames! The application may be doing too much work on its main thread.
D/FA: Connected to remote service
V/FA: Processing queued up service tasks: 2
W/IInputConnectionWrapper: finishComposingText on inactive InputConnection
V/FA: Inactivity, disconnecting from the service
D/NetworkSecurityConfig: No Network Security Config specified, using platform default
V/FA: Session started, time: 62504
I/DynamiteModule: Considering local module com.google.android.gms.tagmanager:9 and remote module com.google.android.gms.tagmanager:9
I/DynamiteModule: Selected remote version of com.google.android.gms.tagmanager, version >= 9
W/GoogleTagManager: No container asset found in /assets/containers. Checking top level /assets directory for container assets.
W/GoogleTagManager: Tag Manager's event handler WILL NOT be installed (no container loaded)
I/GoogleTagManager: Tag Manager initilization took 7ms
D/FA: Logging event (FE): _s, Bundle[{_o=auto, _sc=Register, _si=1495871139949734027}]
V/FA: Using measurement service
V/FA: Connecting to remote service
D/FA: Connected to remote service
V/FA: Processing queued up service tasks: 1
W/IInputConnectionWrapper: finishComposingText on inactive InputConnection
W/IInputConnectionWrapper: finishComposingText on inactive InputConnection
V/FA: Inactivity, disconnecting from the service
W/IInputConnectionWrapper: finishComposingText on inactive InputConnection
D/AndroidRuntime: Shutting down VM
E/UncaughtException: java.lang.NullPointerException: Attempt to invoke virtual method 'android.text.Editable android.widget.EditText.getText()' on a null object reference
at com.example.sajid.complainprotectioncell.Register.CheckEditTextIsEmptyOrNot(Register.java:88)
at com.example.sajid.complainprotectioncell.Register$1.onClick(Register.java:53)
at android.view.View.performClick(View.java:5637)
at android.view.View$PerformClick.run(View.java:22429)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
D/FA: Logging event (FE): _ae, Bundle[{_o=crash, _sc=Register, _si=1495871139949734027, timestamp=1514832264264, fatal=1}]
V/FA: Using measurement service
V/FA: Connecting to remote service
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.sajid.complainprotectioncell, PID: 2346
java.lang.NullPointerException: Attempt to invoke virtual method 'android.text.Editable android.widget.EditText.getText()' on a null object reference
at com.example.sajid.complainprotectioncell.Register.CheckEditTextIsEmptyOrNot(Register.java:88)
at com.example.sajid.complainprotectioncell.Register$1.onClick(Register.java:53)
at android.view.View.performClick(View.java:5637)
at android.view.View$PerformClick.run(View.java:22429)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
I/art: Background sticky concurrent mark sweep GC freed 29047(2MB) AllocSpace objects, 11(324KB) LOS objects, 55% free, 2MB/6MB, paused 1.997ms total 429.545ms

What I have tried:

package com.example.sajid.complainprotectioncell;

import android.app.ProgressDialog;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import java.util.HashMap;


public class Register extends AppCompatActivity {
// public static final String URL = "https://interactivebookfyp.000webhostapp.com/user/signUp.php";
// AsyncHttpClient client = new AsyncHttpClient();

Button register, log_in;
EditText U_Name, Email, Password,Cnic,Phone ;
String F_Name_Holder, L_Name_Holder, EmailHolder, PasswordHolder;
String finalResult ;
String HttpURL = "http://localhost:83/panel/UserRegistration.php";
Boolean CheckEditText ;
ProgressDialog progressDialog;
HashMap<String,String> hashMap = new HashMap<>();
HttpParse httpParse = new HttpParse();


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.register);

//Assign Id'S
U_Name = (EditText)findViewById(R.id.input_name);
Email = (EditText)findViewById(R.id.input_email);
Password = (EditText)findViewById(R.id.input_password);
Cnic = (EditText)findViewById(R.id.input_cnic);
Phone= (EditText)findViewById(R.id.input_phone);
register = (Button)findViewById(R.id.BtnGo);

log_in = (Button)findViewById(R.id.login);

//Adding Click Listener on button.
register.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {

// Checking whether EditText is Empty or Not
CheckEditTextIsEmptyOrNot();

if(CheckEditText){

// If EditText is not empty and CheckEditText = True then this block will execute.

UserRegisterFunction(F_Name_Holder,L_Name_Holder, EmailHolder, PasswordHolder);

}
else {

// If EditText is empty then this block will execute.
Toast.makeText(Register.this, "Please fill all form fields.", Toast.LENGTH_LONG).show();

}


}
});

log_in.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {

Intent intent = new Intent(Register.this,Login.class);
startActivity(intent);

}
});

}

public void CheckEditTextIsEmptyOrNot(){

F_Name_Holder = U_Name.getText().toString();
L_Name_Holder = Email.getText().toString();
EmailHolder = Email.getText().toString();
PasswordHolder = Password.getText().toString();


if(TextUtils.isEmpty(F_Name_Holder) || TextUtils.isEmpty(L_Name_Holder) || TextUtils.isEmpty(EmailHolder) || TextUtils.isEmpty(PasswordHolder))
{

CheckEditText = false;

}
else {

CheckEditText = true ;
}

}

public void UserRegisterFunction(final String F_Name, final String L_Name, final String email, final String password){

class UserRegisterFunctionClass extends AsyncTask<String,Void,String> {

@Override
protected void onPreExecute() {
super.onPreExecute();

progressDialog = ProgressDialog.show(Register.this,"Loading Data",null,true,true);
}

@Override
protected void onPostExecute(String httpResponseMsg) {

super.onPostExecute(httpResponseMsg);

progressDialog.dismiss();

Toast.makeText(Register.this,httpResponseMsg.toString(), Toast.LENGTH_LONG).show();

}

@Override
protected String doInBackground(String... params) {

hashMap.put("U_Name",params[0]);

hashMap.put("Email",params[1]);

hashMap.put("Password",params[2]);

hashMap.put("Cnic",params[3]);

hashMap.put("Phone",params[3]);

finalResult = httpParse.postRequest(hashMap, HttpURL);

return finalResult;
}
}

UserRegisterFunctionClass userRegisterFunctionClass = new UserRegisterFunctionClass();

userRegisterFunctionClass.execute(F_Name,L_Name,email,password);
}

}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900