YOUNG_0
20
2018-10-11 21:24:53
12
151

안드로이드스튜디오 DB연동 도와주세요


안드로이드스튜디오와 mariadb를 jsp를 통해서 연동을 시도하고있는 학생입니다.

jsp로 통신하는 과정에서 안드로이드스튜디오에서 jsp로 값이 넘어가야하는데 안넘어가서 질문드립니다.

어떻게 값을 보내고 받아야하나요?


먼저 안드로이드 스튜디오 java코드입니다

package com.example.admin.test2;

import android.app.Activity;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import java.io.*;
import java.net.*;

public class MainActivity extends Activity {
    EditText userId, userPwd;
    Button loginBtn, joinBtn;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        userId = (EditText) findViewById(R.id.userId);
        userPwd = (EditText) findViewById(R.id.userPwd);
        loginBtn = (Button) findViewById(R.id.loginBtn);
        joinBtn = (Button) findViewById(R.id.joinBtn);
        loginBtn.setOnClickListener(btnListener);
        joinBtn.setOnClickListener(btnListener);
    }
    class CustomTask extends AsyncTask<String, Void, String> {
        String sendMsg, receiveMsg;
        @Override
        protected String doInBackground(String... strings) {
            try {
                String str;
                URL url = new URL("http://localhost:8181/Test/data.jsp");
                HttpURLConnection conn = (HttpURLConnection) url.openConnection();
                conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
                conn.setRequestMethod("POST");
                OutputStreamWriter osw = new OutputStreamWriter(conn.getOutputStream());
                sendMsg = "id="+strings[0]+"&pwd="+strings[1]+"&type="+strings[2];
                osw.write(sendMsg);
                osw.flush();
                if(conn.getResponseCode() == conn.HTTP_OK) {
                    InputStreamReader tmp = new InputStreamReader(conn.getInputStream(), "UTF-8");
                    BufferedReader reader = new BufferedReader(tmp);
                    StringBuffer buffer = new StringBuffer();
                    while ((str = reader.readLine()) != null) {
                        buffer.append(str);
                    }
                    receiveMsg = buffer.toString();

                } else {
                    Log.i("통신 결과", conn.getResponseCode()+"에러");
                }

            } catch (MalformedURLException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return receiveMsg;
        }
    }

    View.OnClickListener btnListener = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            switch (view.getId()) {
                case R.id.loginBtn : // 로그인 버튼 눌렀을 경우
                    String loginid = userId.getText().toString();
                    String loginpwd = userPwd.getText().toString();
                    try {
                        String result  = new CustomTask().execute(loginid,loginpwd,"login").get();
                        if(result.equals("true")) {
                            Toast.makeText(MainActivity.this,"로그인",Toast.LENGTH_SHORT).show();
                            Intent intent = new Intent(MainActivity.this, SubActivity.class);
                            //현재액티비티 , 전환할액티비티
                            startActivity(intent);
                            finish();
                        } else if(result.equals("false")) {
                            Toast.makeText(MainActivity.this,"아이디or 비밀번호가 다름",Toast.LENGTH_SHORT).show();
                            userId.setText("");
                            userPwd.setText("");
                        } else if(result.equals("noId")) {
                            Toast.makeText(MainActivity.this,"존재하지 않는 아이디",Toast.LENGTH_SHORT).show();
                            userId.setText("");
                            userPwd.setText("");
                        }
                    }catch (Exception e) {}
                    break;
                case R.id.joinBtn : // 회원가입
                    String joinid = userId.getText().toString();
                    String joinpwd = userPwd.getText().toString();
                    try {
                        String result  = new CustomTask().execute(joinid,joinpwd,"join").get();
                        if(result.equals("id")) {
                            Toast.makeText(MainActivity.this,"존재하는 아이디입니다.",Toast.LENGTH_SHORT).show();
                            userId.setText("");
                            userPwd.setText("");
                        } else if(result.equals("ok")) {
                            userId.setText("");
                            userPwd.setText("");
                            Toast.makeText(MainActivity.this,"회원가입을 축하합니다.",Toast.LENGTH_SHORT).show();
                        }
                    }catch (Exception e) {}
                    break;
            }
        }
    };
}




다음은 jsp 소스입니다.


<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="ex.ConnectDB"%>
<%
	// 자바파일이 필요하므로 위 코드처럼 임포트합니다.
%>
<%
	request.setCharacterEncoding("UTF-8");
	String id = request.getParameter("id");
	String pwd = request.getParameter("pwd");
	String type = request.getParameter("type");
	//로그인 요청인지 회원가입 요청인지를 구분하여 메서드를 실행하도록합니다.
	//싱글톤 방식으로 자바 클래스를 불러옵니다.
	ConnectDB connectDB = ConnectDB.getInstance();
	if(type.equals("login")) {
		String returns = connectDB.logindb(id, pwd);
		out.print(returns);
	} else if(type.equals("join")) {
		String returns = connectDB.joindb(id, pwd);
		out.print(returns);
	}
%>


0
0
  • 답변 12

  • 너부리
    670
    2018-10-11 21:37:41

    앱에서 서버로 전송이 안된다는 말인가요,

    DB에 저장이 안된다는 말인가요?

    오류가 발생했다면 로그도 함께 첨부해주세요.

    0
  • YOUNG_0
    20
    2018-10-11 21:45:09

    안드로이드에서 jsp로 전송이안됩니다!

    로그가 밑에 첨부된거 말씀하시는거 맞나요..? 잘 몰라서 죄송합니다ㅜㅜ

    2018-10-11 21:40:36.011 1666-2702/system_process W/AlarmManagerService: Unable to set rtc to 1539261636: No such device
    2018-10-11 21:40:36.016 1666-1666/system_process D/ConditionProviders.SCP: onReceive android.intent.action.TIME_SET
    2018-10-11 21:40:36.016 1666-1666/system_process D/ConditionProviders.SCP: notifyCondition condition://android/schedule?days=6.7&start=23.30&end=10.0&exitAtAlarm=false STATE_FALSE reason=!meetsSchedule
    2018-10-11 21:40:36.016 1666-1666/system_process D/ConditionProviders.SCP: notifyCondition condition://android/schedule?days=1.2.3.4.5&start=22.0&end=7.0&exitAtAlarm=false STATE_FALSE reason=!meetsSchedule
    2018-10-11 21:40:36.020 1666-1666/system_process D/ConditionProviders.SCP: Scheduling evaluate for Thu Oct 11 22:00:00 GMT+00:00 2018 (1539295200000), in +9h19m23s984ms, now=Thu Oct 11 12:40:36 GMT+00:00 2018 (1539261636016)
    2018-10-11 21:40:36.026 1666-1681/system_process I/UsageStatsService: Time changed in UsageStats by 1553 seconds
    2018-10-11 21:40:36.026 1666-1681/system_process I/UsageStatsService: User[0] Flushing usage stats to disk
    2018-10-11 21:40:36.047 1781-1990/com.android.systemui D/EGL_emulation: eglMakeCurrent: 0xca0f5860: ver 3 1 (tinfo 0xdc1f0be0)
    2018-10-11 21:40:36.050 10750-10750/com.google.android.deskclock I/AlarmClock: AlarmInitReceiver android.intent.action.TIME_SET
    2018-10-11 21:40:36.059 1666-1681/system_process I/UsageStatsDatabase: Time changed by +25m53s877ms. files deleted: 0 files moved: 20
    2018-10-11 21:40:36.059 10750-11227/com.google.android.deskclock I/AlarmClock: Removing AlarmClockInfo
    2018-10-11 21:40:36.060 1666-1681/system_process I/UsageStatsService: User[0] Rollover scheduled @ 2018-10-12 08:37:15(1539347835945)
    2018-10-11 21:40:36.065 10750-10750/com.google.android.deskclock I/DigitalWidgetProvider: onReceive: Intent { act=android.intent.action.TIME_SET flg=0x25200010 cmp=com.google.android.deskclock/com.android.alarmclock.DigitalAppWidgetProvider }
    2018-10-11 21:40:36.084 10750-10750/com.google.android.deskclock I/DigitalWidgetProvider: onReceive: Intent { act=com.android.deskclock.ALARM_CHANGED flg=0x10 cmp=com.google.android.deskclock/com.android.alarmclock.DigitalAppWidgetProvider }
    2018-10-11 21:40:36.087 2361-11230/com.google.android.gms I/SystemUpdate: [Installation,ReceiverIntentOperation] Received intent: Intent { act=android.intent.action.TIME_SET flg=0x25200010 cmp=com.google.android.gms/.chimera.GmsIntentOperationService$PersistentTrustedReceiver }.
    2018-10-11 21:40:36.099 2361-11233/com.google.android.gms I/SystemUpdate: [Execution,InstallationEventIntentOperation] Handling event of type 6.
    2018-10-11 21:40:36.103 2361-11231/com.google.android.gms I/SystemUpdate: [Execution,InstallationIntentOperation] Received intent: Intent { act=com.google.android.gms.update.INSTALL_UPDATE cat=[targeted_intent_op_prefix:.update.execution.InstallationIntentOperation] cmp=com.google.android.gms/.chimera.GmsIntentOperationService }.
    2018-10-11 21:40:36.111 2361-11231/com.google.android.gms I/SystemUpdate: [Execution,ExecutionManager] Action finished-execution executed for 0.01 seconds.
    2018-10-11 21:40:36.351 1666-3528/system_process D/AlarmManagerService: Kernel timezone updated to 0 minutes west of GMT
    2018-10-11 21:40:36.354 1666-3528/system_process D/AlarmManagerService: Setting time of day to sec=1539261636
    2018-10-11 21:40:36.003 1666-3528/system_process W/AlarmManagerService: Unable to set rtc to 1539261636: No such device
    2018-10-11 21:40:36.623 7638-7638/com.google.android.inputmethod.latin W/GInputConnectionWrapper: Fixing selection indices to 0, 0
    2018-10-11 21:40:38.037 1666-1681/system_process E/memtrack: Couldn't load memtrack module
    2018-10-11 21:40:38.037 1666-1681/system_process W/android.os.Debug: failed to get memory consumption info: -1
    2018-10-11 21:40:42.036 1431-2911/? W/audio_hw_generic: Not supplying enough data to HAL, expected position 5567964 , only wrote 5567760
    2018-10-11 21:40:42.047 1781-1990/com.android.systemui D/EGL_emulation: eglMakeCurrent: 0xca0f5860: ver 3 1 (tinfo 0xdc1f0be0)
    2018-10-11 21:40:42.109 1666-1683/system_process D/AutofillManagerService: onBackKeyPressed()
    2018-10-11 21:40:42.112 11190-11195/com.example.admin.test2 I/zygote: Do partial code cache collection, code=29KB, data=24KB
    2018-10-11 21:40:42.113 11190-11195/com.example.admin.test2 I/zygote: After code cache collection, code=29KB, data=24KB
    2018-10-11 21:40:42.113 11190-11195/com.example.admin.test2 I/zygote: Increasing code cache capacity to 128KB
    2018-10-11 21:40:42.119 7638-7898/com.google.android.inputmethod.latin D/EGL_emulation: eglMakeCurrent: 0xdee075e0: ver 3 1 (tinfo 0xc7b85d90)
    2018-10-11 21:40:42.688 1666-1681/system_process E/memtrack: Couldn't load memtrack module
    2018-10-11 21:40:42.688 1666-1681/system_process W/android.os.Debug: failed to get memory consumption info: -1
    2018-10-11 21:40:43.844 11190-11216/com.example.admin.test2 D/NetworkSecurityConfig: No Network Security Config specified, using platform default
    2018-10-11 21:40:43.852 11190-11216/com.example.admin.test2 W/System.err: java.net.ConnectException: Failed to connect to localhost/127.0.0.1:8181
    2018-10-11 21:40:43.852 11190-11216/com.example.admin.test2 W/System.err:     at com.android.okhttp.internal.io.RealConnection.connectSocket(RealConnection.java:143)
    2018-10-11 21:40:43.852 11190-11216/com.example.admin.test2 W/System.err:     at com.android.okhttp.internal.io.RealConnection.connect(RealConnection.java:112)
    2018-10-11 21:40:43.852 11190-11216/com.example.admin.test2 W/System.err:     at com.android.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:184)
    2018-10-11 21:40:43.852 11190-11216/com.example.admin.test2 W/System.err:     at com.android.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:126)
    2018-10-11 21:40:43.852 11190-11216/com.example.admin.test2 W/System.err:     at com.android.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:95)
    2018-10-11 21:40:43.852 11190-11216/com.example.admin.test2 W/System.err:     at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:281)
    2018-10-11 21:40:43.852 11190-11216/com.example.admin.test2 W/System.err:     at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:224)
    2018-10-11 21:40:43.852 11190-11216/com.example.admin.test2 W/System.err:     at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:461)
    2018-10-11 21:40:43.853 11190-11216/com.example.admin.test2 W/System.err:     at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:127)
    2018-10-11 21:40:43.853 11190-11216/com.example.admin.test2 W/System.err:     at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:258)
    2018-10-11 21:40:43.853 11190-11216/com.example.admin.test2 W/System.err:     at com.example.admin.test2.MainActivity$CustomTask.doInBackground(MainActivity.java:39)
    2018-10-11 21:40:43.853 11190-11216/com.example.admin.test2 W/System.err:     at com.example.admin.test2.MainActivity$CustomTask.doInBackground(MainActivity.java:29)
    2018-10-11 21:40:43.853 11190-11216/com.example.admin.test2 W/System.err:     at android.os.AsyncTask$2.call(AsyncTask.java:333)
    2018-10-11 21:40:43.854 11190-11216/com.example.admin.test2 W/System.err:     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    2018-10-11 21:40:43.854 11190-11216/com.example.admin.test2 W/System.err:     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
    2018-10-11 21:40:43.854 11190-11216/com.example.admin.test2 W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
    2018-10-11 21:40:43.854 11190-11216/com.example.admin.test2 W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
    2018-10-11 21:40:43.854 11190-11216/com.example.admin.test2 W/System.err:     at java.lang.Thread.run(Thread.java:764)
    2018-10-11 21:40:47.033 1431-1569/? W/audio_hw_generic: Not supplying enough data to HAL, expected position 6045547 , only wrote 5807520
    2018-10-11 21:40:48.816 1666-1681/system_process E/memtrack: Couldn't load memtrack module
    2018-10-11 21:40:48.816 1666-1681/system_process W/android.os.Debug: failed to get memory consumption info: -1
    2018-10-11 21:40:57.138 1666-2702/system_process I/ActivityManager: Killing 10774:android.process.media/u0a11 (adj 906): empty #17
    2018-10-11 21:40:57.139 1666-1684/system_process W/zygote: kill(-10774, 9) failed: No such process
    2018-10-11 21:40:57.184 1666-1684/system_process W/zygote: kill(-10774, 9) failed: No such process
    2018-10-11 21:40:57.185 1666-1684/system_process I/zygote: Successfully killed process cgroup uid 10011 pid 10774 in 46ms
    2018-10-11 21:40:59.650 1666-1681/system_process E/memtrack: Couldn't load memtrack module
    2018-10-11 21:40:59.650 1666-1681/system_process W/android.os.Debug: failed to get memory consumption info: -1
    2018-10-11 21:40:59.663 1781-1990/com.android.systemui D/EGL_emulation: eglMakeCurrent: 0xca0f5860: ver 3 1 (tinfo 0xdc1f0be0)
    2018-10-11 21:41:01.954 11190-11195/com.example.admin.test2 I/zygote: Do partial code cache collection, code=61KB, data=57KB
    2018-10-11 21:41:01.955 11190-11195/com.example.admin.test2 I/zygote: After code cache collection, code=61KB, data=57KB
    2018-10-11 21:41:01.955 11190-11195/com.example.admin.test2 I/zygote: Increasing code cache capacity to 256KB
    2018-10-11 21:41:08.731 1666-1681/system_process E/memtrack: Couldn't load memtrack module
    2018-10-11 21:41:08.731 1666-1681/system_process W/android.os.Debug: failed to get memory consumption info: -1
    2018-10-11 21:41:08.750 1666-1681/system_process E/memtrack: Couldn't load memtrack module
    2018-10-11 21:41:08.750 1666-1681/system_process W/android.os.Debug: failed to get memory consumption info: -1
    2018-10-11 21:41:08.760 1666-1681/system_process E/memtrack: Couldn't load memtrack module
    2018-10-11 21:41:08.760 1666-1681/system_process W/android.os.Debug: failed to get memory consumption info: -1
    2018-10-11 21:41:12.433 8148-10857/com.google.android.dialer I/Dialer: OmtpVvmCarrierCfgHlpr - OmtpEvent:CONFIG_STATUS_SMS_TIME_OUT
    2018-10-11 21:41:12.433 8148-8148/com.google.android.dialer I/Dialer: RetryPolicy - discarding deferred status: configuration_state=4
    2018-10-11 21:41:12.435 8148-8148/com.google.android.dialer I/Dialer: VvmTaskExecutor - no more tasks, stopping service if no task are added in 5000 millis
    2018-10-11 21:41:12.447 8148-8148/com.google.android.dialer I/Dialer: VvmTaskReceiver - task received
    2018-10-11 21:41:12.447 8148-8148/com.google.android.dialer I/Dialer: VvmTaskReceiver - TaskExecutor already running
    2018-10-11 21:41:12.447 8148-8148/com.google.android.dialer I/Dialer: Task.createTask - create task:com.android.voicemail.impl.ActivationTask
    2018-10-11 21:41:12.448 8148-8148/com.google.android.dialer I/Dialer: RetryPolicy - retry #4 for com.android.voicemail.impl.ActivationTask@4fb3cfd queued, executing in 5000
    2018-10-11 21:41:12.448 8148-8148/com.google.android.dialer I/Dialer: VvmTaskExecutor - com.android.voicemail.impl.ActivationTask@4fb3cfd added
    2018-10-11 21:41:12.449 8148-8148/com.google.android.dialer I/Dialer: VvmTaskExecutor - minimal wait time:4999
    2018-10-11 21:41:12.454 8148-8148/com.google.android.dialer I/Dialer: VvmTaskExecutor - sleep for 4999 millis
    2018-10-11 21:41:16.767 1447-1447/? I/boot-pipe: done populating /dev/random
    2018-10-11 21:41:17.459 8148-10857/com.google.android.dialer I/Dialer: VvmTaskExecutor - executing task com.android.voicemail.impl.ActivationTask@4fb3cfd
    2018-10-11 21:41:17.459 8148-10857/com.google.android.dialer I/Dialer: PreOMigrationHandler - ComponentInfo{com.android.phone/com.android.services.telephony.TelephonyConnectionService}, [Uninitialized SHA1], UserHandle{0} already migrated
    2018-10-11 21:41:17.495 8148-10857/com.google.android.dialer I/Dialer: VvmActivationTask - VVM content provider configured - vvm_type_cvvm
    2018-10-11 21:41:17.495 8148-10857/com.google.android.dialer I/Dialer: OmtpVvmCarrierCfgHlpr - OmtpEvent:CONFIG_ACTIVATING
    2018-10-11 21:41:17.516 8148-10857/com.google.android.dialer I/Dialer: TelephonyMangerCompat.setVisualVoicemailSmsFilterSettings - using TelephonyManager
    2018-10-11 21:41:17.521 8148-10857/com.google.android.dialer I/Dialer: TelephonyMangerCompat.sendVisualVoicemailSms - using TelephonyManager
    2018-10-11 21:41:23.119 1440-1465/? D/hwcomposer: hw_composer sent 14 syncs in 91s
    2018-10-11 21:41:40.824 2318-7923/com.google.android.googlequicksearchbox:search W/VelvetNetworkClient: Cannot connect to server without account
    2018-10-11 21:41:50.302 1666-1681/system_process E/memtrack: Couldn't load memtrack module
    2018-10-11 21:41:50.302 1666-1681/system_process W/android.os.Debug: failed to get memory consumption info: -1
    2018-10-11 21:42:07.056 1666-1685/system_process E/BatteryExternalStatsWorker: modem info is invalid: ModemActivityInfo{ mTimestamp=0 mSleepTimeMs=0 mIdleTimeMs=0 mTxTimeMs[]=[0, 0, 0, 0, 0] mRxTimeMs=0 mEnergyUsed=0}
    2018-10-11 21:42:14.689 1666-1681/system_process E/memtrack: Couldn't load memtrack module
    2018-10-11 21:42:14.689 1666-1681/system_process W/android.os.Debug: failed to get memory consumption info: -1
    2018-10-11 21:42:16.769 1447-1447/? I/boot-pipe: done populating /dev/random
    2018-10-11 21:42:17.556 8148-10857/com.google.android.dialer I/Dialer: OmtpVvmCarrierCfgHlpr - OmtpEvent:CONFIG_STATUS_SMS_TIME_OUT
    2018-10-11 21:42:17.557 8148-8148/com.google.android.dialer I/Dialer: RetryPolicy - Retry limit for com.android.voicemail.impl.ActivationTask@4fb3cfd reached
    2018-10-11 21:42:17.557 8148-8148/com.google.android.dialer I/Dialer: RetryPolicy - committing deferred status: configuration_state=4
    2018-10-11 21:42:17.597 8148-8148/com.google.android.dialer I/Dialer: VvmTaskExecutor - no more tasks, stopping service if no task are added in 5000 millis
    2018-10-11 21:42:22.605 8148-8148/com.google.android.dialer I/Dialer: VvmTaskExecutor - Stopping service
    2018-10-11 21:42:22.605 8148-8148/com.google.android.dialer I/Dialer: VvmTaskExecutor - finishing Job
    2018-10-11 21:42:22.605 8148-8148/com.google.android.dialer I/Dialer: TaskSchedulerJobService - finishing job
    2018-10-11 21:42:22.609 8148-8148/com.google.android.dialer I/Dialer: JobFinishedPoller.run - Job finished
    2018-10-11 21:42:22.610 8148-8148/com.google.android.dialer I/Dialer: VvmTaskExecutor - terminated
    2018-10-11 21:42:22.611 1666-2702/system_process I/ActivityManager: Killing 10679:com.android.settings/1000 (adj 906): empty #17
    2018-10-11 21:42:22.612 1666-1684/system_process W/zygote: kill(-10679, 9) failed: No such process
    2018-10-11 21:42:22.657 1666-1684/system_process W/zygote: kill(-10679, 9) failed: No such process
    2018-10-11 21:42:22.657 1666-1684/system_process I/zygote: Successfully killed process cgroup uid 1000 pid 10679 in 45ms
    2018-10-11 21:42:32.581 11190-11195/com.example.admin.test2 I/zygote: Do full code cache collection, code=121KB, data=92KB
    2018-10-11 21:42:32.581 11190-11195/com.example.admin.test2 I/zygote: After code cache collection, code=98KB, data=69KB
    2018-10-11 21:42:40.832 1666-4756/system_process I/ActivityManager: Killing 10831:com.android.cellbroadcastreceiver/u0a6 (adj 906): empty #17
    2018-10-11 21:42:40.833 1666-1684/system_process W/zygote: kill(-10831, 9) failed: No such process
    2018-10-11 21:42:40.834 1666-1681/system_process E/memtrack: Couldn't load memtrack module
    2018-10-11 21:42:40.834 1666-1681/system_process W/android.os.Debug: failed to get memory consumption info: -1
    2018-10-11 21:42:40.880 1666-1684/system_process W/zygote: kill(-10831, 9) failed: No such process
    2018-10-11 21:42:40.880 1666-1684/system_process I/zygote: Successfully killed process cgroup uid 10006 pid 10831 in 46ms
    2018-10-11 21:42:43.828 1666-2702/system_process D/WificondControl: Scan result ready event
    2018-10-11 21:42:43.834 2186-9486/com.google.android.gms.persistent W/ctxmgr: [AclManager]No 2 for (accnt=account#-517948760#, com.google.android.gms(10015):IndoorOutdoorProducer, vrsn=12874000, 0, 3pPkg = null ,  3pMdlId = null ,  pid = 2186). Was: 3 for 57, account#-517948760#
    2018-10-11 21:42:58.214 1440-1465/? D/hwcomposer: hw_composer sent 12 syncs in 95s
    2018-10-11 21:43:00.005 1666-1681/system_process E/memtrack: Couldn't load memtrack module
    2018-10-11 21:43:00.005 1666-1681/system_process W/android.os.Debug: failed to get memory consumption info: -1
    2018-10-11 21:43:00.017 1666-1681/system_process E/memtrack: Couldn't load memtrack module
    2018-10-11 21:43:00.017 1666-1681/system_process W/android.os.Debug: failed to get memory consumption info: -1
    2018-10-11 21:43:00.027 1666-1681/system_process E/memtrack: Couldn't load memtrack module
    2018-10-11 21:43:00.027 1666-1681/system_process W/android.os.Debug: failed to get memory consumption info: -1
    2018-10-11 21:43:00.470 1666-4756/system_process I/WifiService: getConnectionInfo uid=10015
    2018-10-11 21:43:00.473 2186-10995/com.google.android.gms.persistent E/WakeLock: GCM_HB_ALARM release without a matched acquire!
    2018-10-11 21:43:00.475 2186-11002/com.google.android.gms.persistent V/NativeCrypto: Read error: ssl=0xe6aae248: I/O error during system call, Connection reset by peer
    2018-10-11 21:43:00.477 2186-11002/com.google.android.gms.persistent V/NativeCrypto: SSL shutdown failed: ssl=0xe6aae248: I/O error during system call, Broken pipe
    2018-10-11 21:43:00.478 2186-11002/com.google.android.gms.persistent E/WakeLock: GCM_HB_ALARM release without a matched acquire!
    2018-10-11 21:43:00.491 1666-1748/system_process D/ConnectivityService: reportNetworkConnectivity(101, false) by 10015
    2018-10-11 21:43:00.492 1666-3762/system_process D/NetworkMonitor/NetworkAgentInfo [WIFI () - 101]: Forcing reevaluation for UID 10015
    2018-10-11 21:43:00.528 1666-11265/system_process D/NetworkMonitor/NetworkAgentInfo [WIFI () - 101]: PROBE_DNS connectivitycheck.gstatic.com 35ms OK 172.217.25.3,2404:6800:4005:809::2003
    2018-10-11 21:43:00.529 1666-11264/system_process D/NetworkMonitor/NetworkAgentInfo [WIFI () - 101]: PROBE_DNS www.google.com 31ms OK 172.217.25.68,2404:6800:4004:80e::2004
    2018-10-11 21:43:00.570 2186-2636/com.google.android.gms.persistent E/ahon: Phenotype API error. Event a: 218


    0
  • 너부리
    670
    2018-10-11 21:50:22

    java.net.ConnectException: Failed to connect to localhost/127.0.0.1:8181

    위와 같이 하면 접속 할 수 없습니다.

    앱의 입장에서 보면 localhost는 앱이 있는 폰이 됩니다.

    폰에는 서버가 없으니 당연히 안되겠죠.

    PC ip:8181로 해보세요.

    0
  • 너부리
    670
    2018-10-11 21:51:30

    그리고 모르는 건 죄송한 게 아닙니다.

    잘 해결되면 고맙다는 말 한마디면 됩니다.

    0
  • YOUNG_0
    20
    2018-10-11 22:11:15


    URL url = new URL("http://localhost:8181/Test/data.jsp");

    안드로이드 스튜디오 소스에서 여기 localhost부분을 제pc아이피로 바꾸고 실행을했는데 아래와같은 로그가 떴는데 어떻게 해야하나요 ?

    2018-10-11 22:05:02.034 1532-1580/? E/AudioFlinger: not enough memory for AudioTrack size=131296
    2018-10-11 22:05:02.034 1532-1580/? E/AudioFlinger: createRecordTrack_l() initCheck failed -12; no control block?
    2018-10-11 22:05:02.034 2318-11755/com.google.android.googlequicksearchbox:search E/AudioRecord: AudioFlinger could not create record track, status: -12
    2018-10-11 22:05:02.036 2318-11755/com.google.android.googlequicksearchbox:search E/AudioRecord-JNI: Error creating AudioRecord instance: initialization check failed with status -12.
    2018-10-11 22:05:02.037 2318-11755/com.google.android.googlequicksearchbox:search E/android.media.AudioRecord: Error code -20 when initializing native AudioRecord object.
    2018-10-11 22:05:07.078 1532-1580/? E/AudioFlinger: not enough memory for AudioTrack size=131296
    2018-10-11 22:05:07.079 1532-1580/? E/AudioFlinger: createRecordTrack_l() initCheck failed -12; no control block?
    2018-10-11 22:05:07.079 2318-11755/com.google.android.googlequicksearchbox:search E/AudioRecord: AudioFlinger could not create record track, status: -12
    2018-10-11 22:05:07.080 2318-11755/com.google.android.googlequicksearchbox:search E/AudioRecord-JNI: Error creating AudioRecord instance: initialization check failed with status -12.
    2018-10-11 22:05:07.080 2318-11755/com.google.android.googlequicksearchbox:search E/android.media.AudioRecord: Error code -20 when initializing native AudioRecord object.
    2018-10-11 22:05:10.622 1454-1454/? E/adbd: failed to connect to socket 'localabstract:com.example.admin.test2': Connection refused
    2018-10-11 22:05:12.127 1532-5171/? E/AudioFlinger: not enough memory for AudioTrack size=131296
    2018-10-11 22:05:12.127 1532-5171/? E/AudioFlinger: createRecordTrack_l() initCheck failed -12; no control block?
    2018-10-11 22:05:12.127 2318-11755/com.google.android.googlequicksearchbox:search E/AudioRecord: AudioFlinger could not create record track, status: -12
    2018-10-11 22:05:12.131 2318-11755/com.google.android.googlequicksearchbox:search E/AudioRecord-JNI: Error creating AudioRecord instance: initialization check failed with status -12.
    2018-10-11 22:05:12.131 2318-11755/com.google.android.googlequicksearchbox:search E/android.media.AudioRecord: Error code -20 when initializing native AudioRecord object.
    2018-10-11 22:05:12.799 1535-1709/? E/installd: Failed to delete /data/app/vmdl206890650.tmp: No such file or directory
    2018-10-11 22:05:13.393 1449-1737/? E/SurfaceFlinger: ro.sf.lcd_density must be defined as a build property
    2018-10-11 22:05:13.484 12369-12392/com.example.admin.test2 E/eglCodecCommon: glUtilsParamSize: unknow param 0x000082da
    2018-10-11 22:05:13.484 12369-12392/com.example.admin.test2 E/eglCodecCommon: glUtilsParamSize: unknow param 0x000082da
    2018-10-11 22:05:13.485 1449-1529/? E/SurfaceFlinger: ro.sf.lcd_density must be defined as a build property
    2018-10-11 22:05:16.556 1666-1765/system_process E/TaskPersister: File error accessing recents directory (directory doesn't exist?).
    2018-10-11 22:05:28.183 1666-1681/system_process E/memtrack: Couldn't load memtrack module
    2018-10-11 22:05:34.128 1666-1681/system_process E/memtrack: Couldn't load memtrack module
    2018-10-11 22:05:47.255 1666-1681/system_process E/memtrack: Couldn't load memtrack module
    2018-10-11 22:05:49.098 1666-1681/system_process E/memtrack: Couldn't load memtrack module
    2018-10-11 22:06:00.007 1666-1681/system_process E/memtrack: Couldn't load memtrack module
    2018-10-11 22:06:00.021 1666-1681/system_process E/memtrack: Couldn't load memtrack module
    2018-10-11 22:06:23.386 1666-1685/system_process E/BatteryExternalStatsWorker: modem info is invalid: ModemActivityInfo{ mTimestamp=0 mSleepTimeMs=0 mIdleTimeMs=0 mTxTimeMs[]=[0, 0, 0, 0, 0] mRxTimeMs=0 mEnergyUsed=0}
    2018-10-11 22:06:30.333 2186-12005/com.google.android.gms.persistent E/WakeLock: GCM_HB_ALARM release without a matched acquire!
    2018-10-11 22:07:07.642 1666-1681/system_process E/memtrack: Couldn't load memtrack module
    2018-10-11 22:07:07.676 1666-1681/system_process E/memtrack: Couldn't load memtrack module


    그리고 혹시 테스트를 진행할때 이클립스에서 톰캣 서버만 시작해놓고 가상머신으로 테스트하면 되는거 맞나요? 

    0
  • 너부리
    670
    2018-10-11 22:22:55

    특별한 점은 없는 것 같습니다.

    톰캣 띄워 놓고 에뮬레이터로 해도 상관 없습니다.

    data.jsp와 관련한 클래스에서 이상이 없는지, 데이터는 수신이 되는지 확인하셔야 합니다.

    에러가 발생하면 tomcat에 로그에 나타날 겁니다.

    0
  • YOUNG_0
    20
    2018-10-11 22:48:03

    tomcat 로그는 실시간으로 어디서 확인할수있나요?

    0
  • 너부리
    670
    2018-10-11 22:54:54

    이클립스 톰켓 플러그인으로 사용하시면 이클립스 콘솔에 나옵니다.

    0
  • YOUNG_0
    20
    2018-10-11 23:26:38


    위에 보이는거처럼 plugins폴더에 넣고 이클립스를 재시작했는데 저기 고양이 3마리가 안보이는건 어떻게 해결해야하나요..?

    0
  • YOUNG_0
    20
    2018-10-12 06:45:17

    안드로이드 가상머신실행하고 아이디 비밀번호 입력후 회원가입이나 로그인버튼을 누르면


    E/zygote: Failed sending reply to debugger: Broken pipe


    이런 에러가 뜨는데, 혹시 어떻게 해결해야하는지 아시나요? 

    이부분에서 jsp로 데이터가 전송이 안되는건가요?

    0
  • 옥강이
    732
    2018-10-12 09:57:50

    매니페스트 인터넷 권한 주신거 맞죠?

    혹시 모르니 빌드툴 버전이랑 sdk버전도 확인한번 해보세용~


    아니면 아예 에뮬 말고 그냥 핸드폰으로 디버깅 해보세요.


    0
  • YOUNG_0
    20
    2018-10-12 15:15:50
    <uses-permission android:name="android.permission.INTERNET"/>

    매니페스트 인터넷권한주는게 이거 아닌가요?


    빌드툴 버전이랑 sdk버전은 gradle 확인하면 되는거죠?


    // Top-level build file where you can add configuration options common to all sub-projects/modules.
    
    buildscript {
        
        repositories {
            google()
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.2.0'
            
    
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }
    
    allprojects {
        repositories {
            google()
            jcenter()
        }
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }
    



    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 28
        defaultConfig {
            applicationId "com.example.admin.test2"
            minSdkVersion 15
            targetSdkVersion 28
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }
    
    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation 'com.android.support:appcompat-v7:28.0.0'
        implementation 'com.android.support.constraint:constraint-layout:1.1.3'
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'com.android.support.test:runner:1.0.2'
        androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    }
    


    이런식으로 되어있는데 혹시 잘못된부분이 있을까요?

    0
  • 로그인을 하시면 답변을 등록할 수 있습니다.