1
私はユーザーデータを更新できる形式のように、その背後にあるすべてのロジックを忘れて、inputTextに何かを書き、firebaseに保存したいだけです。問題は私が原因を知らないというエラーが出ることです。私はたくさんのログを作成し、ユーザーが存在するかどうかを確認するifステートメントを入力しません。auth.getInstanceが正しく動作しない
コード
public class UserSettings extends AppCompatActivity {
FirebaseDatabase database;
private FirebaseAuth auth;
EditText usernameTxt;
EditText ageTxt;
String userId;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_user_settings);
usernameTxt = (EditText)findViewById(R.id.username);
ageTxt = (EditText)findViewById(R.id.age);
auth = FirebaseAuth.getInstance();
}
public void user(View view){
String username = usernameTxt.getText().toString();
int age = Integer.parseInt(ageTxt.getText().toString());
Log.d("task21",auth.getCurrentUser().toString());
if (auth.getCurrentUser() == null) {
Log.d("task","fail2");
}
else{
Log.d("task","fail3");
userId = auth.getCurrentUser().getUid();
}
Log.d("task","fail4");
DatabaseReference myRef = database.getReference();
myRef.child("Users").child(userId).child("username").setValue(username);
}
}
のStackTrace
04-12 08:11:30.551 19662-19662/com.android.email E/ActivityThread: Service com.android.email.service.EmailBroadcastProcessorService has leaked ServiceConnection [email protected]9859a that was originally bound here
android.app.ServiceConnectionLeaked: Service com.android.email.service.EmailBroadcastProcessorService has leaked ServiceConnection [email protected]9859a that was originally bound here
at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:1077)
at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:971)
at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1774)
at android.app.ContextImpl.bindService(ContextImpl.java:1757)
at android.content.ContextWrapper.bindService(ContextWrapper.java:539)
at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:181)
at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:224)
at com.android.email.service.EmailServiceUtils.isServiceAvailable(EmailServiceUtils.java:160)
at com.android.email.provider.AccountReconciler.reconcileAccountsInternal(AccountReconciler.java:171)
at com.android.email.provider.AccountReconciler.reconcileAccounts(AccountReconciler.java:115)
at com.android.email.service.EmailBroadcastProcessorService.reconcileAndStartServices(EmailBroadcastProcessorService.java:305)
at com.android.email.service.EmailBroadcastProcessorService.onBootCompleted(EmailBroadcastProcessorService.java:295)
at com.android.email.service.EmailBroadcastProcessorService.onHandleIntent(EmailBroadcastProcessorService.java:130)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.os.HandlerThread.run(HandlerThread.java:61)
04-12 08:11:30.562 19662-19717/com.android.email E/EmailServiceProxy: RuntimeException when trying to unbind from service
java.lang.IllegalArgumentException: Service not registered: [email protected]9859a
at android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:1029)
at android.app.ContextImpl.unbindService(ContextImpl.java:1808)
at android.content.ContextWrapper.unbindService(ContextWrapper.java:551)
at com.android.emailcommon.service.ServiceProxy$ProxyConnection$1.doInBackground(ServiceProxy.java:124)
at com.android.emailcommon.service.ServiceProxy$ProxyConnection$1.doInBackground(ServiceProxy.java:111)
at android.os.AsyncTask$2.call(AsyncTask.java:292)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)04-12 08:11:30.551 19662-19662/com.android.email E/ActivityThread: Service com.android.email.service.EmailBroadcastProcessorService has leaked ServiceConnection [email protected]9859a that was originally bound here
android.app.ServiceConnectionLeaked: Service com.android.email.service.EmailBroadcastProcessorService has leaked ServiceConnection [email protected]9859a that was originally bound here
at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:1077)
at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:971)
at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1774)
at android.app.ContextImpl.bindService(ContextImpl.java:1757)
at android.content.ContextWrapper.bindService(ContextWrapper.java:539)
at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:181)
at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:224)
at com.android.email.service.EmailServiceUtils.isServiceAvailable(EmailServiceUtils.java:160)
at com.android.email.provider.AccountReconciler.reconcileAccountsInternal(AccountReconciler.java:171)
at com.android.email.provider.AccountReconciler.reconcileAccounts(AccountReconciler.java:115)
at com.android.email.service.EmailBroadcastProcessorService.reconcileAndStartServices(EmailBroadcastProcessorService.java:305)
at com.android.email.service.EmailBroadcastProcessorService.onBootCompleted(EmailBroadcastProcessorService.java:295)
at com.android.email.service.EmailBroadcastProcessorService.onHandleIntent(EmailBroadcastProcessorService.java:130)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.os.HandlerThread.run(HandlerThread.java:61)
04-12 08:11:30.562 19662-19717/com.android.email E/EmailServiceProxy: RuntimeException when trying to unbind from service
java.lang.IllegalArgumentException: Service not registered: [email protected]9859a
at android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:1029)
at android.app.ContextImpl.unbindService(ContextImpl.java:1808)
at android.content.ContextWrapper.unbindService(ContextWrapper.java:551)
at com.android.emailcommon.service.ServiceProxy$ProxyConnection$1.doInBackground(ServiceProxy.java:124)
at com.android.emailcommon.service.ServiceProxy$ProxyConnection$1.doInBackground(ServiceProxy.java:111)
at android.os.AsyncTask$2.call(AsyncTask.java:292)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)