IT Share you

Android Webview :“Uncaught TypeError : Cannot read property 'getItem'of null”

shareyou 2020. 12. 13. 11:24
반응형

Android Webview :“Uncaught TypeError : Cannot read property 'getItem'of null”


URL을 표시해야하는 웹뷰가있는 간단한 안드로이드 앱을 만들고 있습니다. URL을 google.com 또는 facebook.com으로 지정하면 제대로로드되지만 내 url (qbo.intuit.com)을 지정하면로드되지 않고 "Uncaught TypeError : Cannot read property 'getItem'of null "오류. 여기에 코드를 잘 붙여넣고 있습니다. Compile sdk 버전 : API 22 : Android 5.1 (Lollipop), 버전-Android Studio 1.4, 빌드 번호 : AI-141.2288178, Android SDK 도구 : 24.4.0, jdk1.7.0_80을 사용하고 있습니다. 비슷한 질문이 있지만 도움이되지 않았습니다. 내가 안드로이드를 처음 사용하도록 도와주세요. MainActivity.java

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

    String url= "https://qbo.intuit.com/";
    WebView view= (WebView) this.findViewById(R.id.webView);

     final WebViewClient client = new WebViewClient() {

        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            view.loadUrl(url);
            return false;
        }

    };

        WebSettings settings = view.getSettings();
        settings.setJavaScriptEnabled(true);
    view.setWebViewClient(client);
        view.loadUrl(url);


}

AndriodManifest.xml

<?xml version="1.0" encoding="utf-8"?>

<uses-permission android:name="android.permission.INTERNET"/>

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".MainActivity"
        android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>


당신은해야합니다

WebSettings settings = webView.getSettings();
settings.setDomStorageEnabled(true);

see details ERROR/Web Console: Uncaught TypeError: Cannot call method 'getItem' of null at http://m.youtube.com/:844

참고URL : https://stackoverflow.com/questions/33079762/android-webview-uncaught-typeerror-cannot-read-property-getitem-of-null

반응형