메뉴 건너뛰기

app

안드로이드 스튜디오 사용 및 웹뷰 ssl(https) 에러

lispro062015.05.15 11:25조회 수 2578댓글 0

    • 글자 크기

안드로이드 스튜디오를 설치하고 실행했는데, VM 어쩌고 에러가 발생했다.


파일 > 세팅 > 컴파일러에 가면 VM options 가 있다.


-Xmx512m -XX:MaxPermSize=512m


위 값을 넣어 준다.


activity_main.xml을 design으로 보려는데, rendering error 가 발생했다.


아래 그림처럼, 레벨을 낮추면 보인다.


 그림 (복구하지 못함)


웹뷰를 이용해 https 경로를 호출했는데, 인증서 에러로 접근이 되지 않는다.


    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_main);

        webview = (WebView)findViewById(R.id.webView);


        webview.setWebViewClient(new WebViewClient() {

                                     public void onReceivedSslError (WebView view, SslErrorHandler handler, SslError error) {

                                         handler.proceed();

                                     }

                                 });


~~~~~~~~~~~~~~~~~~~~~~~~~~하략~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

웹뷰 클라이언트 생성 부분을 sslerror 에 대한 함수를 오버라이드 시켜 넘겨 버린다.


일반적으로는 아래와 같은 코드였는데, 오버라이드 함수를 넣어 생성한 것이다.


webview.setWebViewClient(new WebViewClient());


->

webview.setWebViewClient(new WebViewClient() {

                                     public void onReceivedSslError (WebView view, SslErrorHandler handler, SslError error) {

                                         handler.proceed();

                                     }

                                 });

lispro06 (비회원)
    • 글자 크기
[PHP] prime number generator (by 박영식) [SWIFT] 아이콘 뱃지(숫자) 표시 (by lispro06)

댓글 달기

이전 1 2 3 4 5 6 7 8 9 10... 14다음
첨부 (0)
위로