質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
Android

Androidは、Google社が開発したスマートフォンやタブレットなど携帯端末向けのプラットフォームです。 カーネル・ミドルウェア・ユーザーインターフェイス・ウェブブラウザ・電話帳などのアプリケーションやソフトウェアをひとつにまとめて構成。 カーネル・ライブラリ・ランタイムはほとんどがC言語/C++、アプリケーションなどはJavaSEのサブセットとAndroid環境で書かれています。

WebKit

WebKitはAppleのSafariとAndroid, iOS, RIM Blackberry, SymbianとWebOSを含むインストール済みのモバイルブラウザの動力となっているオープンソースのウェブブラウザエンジンです。

Android Studio

Android Studioは、 Google社によって開発された、 Androidのネイティブアプリケーション開発に特化した統合開発ツールです。

Android Emulator

Android EmulatorはアンドロイドのOSで起動しているアンドロイドのデバイスの機能をシミュレートするソフトウェアです。Emulatorは開発者に複数の違う設定を持ったデバイスを必要とすることなくアプリケーションを開発しテストすることが可能になります。

Q&A

解決済

1回答

1400閲覧

inflating class android.webkit.WebViewでエラー

sarasa_38765

総合スコア34

Android

Androidは、Google社が開発したスマートフォンやタブレットなど携帯端末向けのプラットフォームです。 カーネル・ミドルウェア・ユーザーインターフェイス・ウェブブラウザ・電話帳などのアプリケーションやソフトウェアをひとつにまとめて構成。 カーネル・ライブラリ・ランタイムはほとんどがC言語/C++、アプリケーションなどはJavaSEのサブセットとAndroid環境で書かれています。

WebKit

WebKitはAppleのSafariとAndroid, iOS, RIM Blackberry, SymbianとWebOSを含むインストール済みのモバイルブラウザの動力となっているオープンソースのウェブブラウザエンジンです。

Android Studio

Android Studioは、 Google社によって開発された、 Androidのネイティブアプリケーション開発に特化した統合開発ツールです。

Android Emulator

Android EmulatorはアンドロイドのOSで起動しているアンドロイドのデバイスの機能をシミュレートするソフトウェアです。Emulatorは開発者に複数の違う設定を持ったデバイスを必要とすることなくアプリケーションを開発しテストすることが可能になります。

0グッド

0クリップ

投稿2020/01/08 02:29

#アンドロイド初心者です。端末よりあるサイトを表示し更新あれば再読み込みする簡単なプログラムです。(ソース記載は文字数制限で一部のみとなります)

#最初OS ver9で作成して正常に動作する事を確認したのですが、ver5.1対応分を作成したところUnforunalyで終了してしまいます。

xml

1<?xml version="1.0" encoding="utf-8"?> 2<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 xmlns:app="http://schemas.android.com/apk/res-auto" 4 xmlns:tools="http://schemas.android.com/tools" 5 android:layout_width="match_parent" 6 android:layout_height="match_parent" 7 tools:context=".MainActivity"> 8 9 <WebView 10 android:id="@+id/webview" 11 app:layout_constraintRight_toRightOf="parent" 12 app:layout_constraintLeft_toLeftOf="parent" 13 app:layout_constraintBottom_toBottomOf="parent" 14 app:layout_constraintTop_toTopOf="parent" 15 android:layout_width="match_parent" 16 android:layout_height="match_parent" 17 android:layout_alignParentLeft="true" 18 /> 19 20</androidx.constraintlayout.widget.ConstraintLayout> 21

xml

1<?xml version="1.0" encoding="utf-8"?> 2<manifest xmlns:android="http://schemas.android.com/apk/res/android" 3 package="com.example.theater"> 4 <uses-permission android:name="android.permission.INTERNET"/> 5 6 <application 7 android:usesCleartextTraffic="true" 8 android:allowBackup="true" 9 android:icon="@mipmap/ic_launcher" 10 android:label="@string/app_name" 11 android:roundIcon="@mipmap/ic_launcher_round" 12 android:supportsRtl="true" 13 android:theme="@style/Theme.AppCompat.Light.NoActionBar"> 14 <activity android:name=".MainActivity" 15 android:screenOrientation="landscape"> 16 <intent-filter> 17 <action android:name="android.intent.action.MAIN" /> 18 19 <category android:name="android.intent.category.LAUNCHER" /> 20 </intent-filter> 21 </activity> 22 </application> 23 24</manifest>

java

1package com.example.theater; 2 3import androidx.appcompat.app.AppCompatActivity; 4 5import android.os.Bundle; 6import android.os.Handler; 7import android.util.Log; 8import android.view.View; 9import android.webkit.CookieManager; 10import android.webkit.WebView; 11import android.webkit.WebViewClient; 12 13import java.io.BufferedReader; 14import java.io.IOException; 15import java.io.InputStream; 16import java.io.InputStreamReader; 17import java.net.HttpURLConnection; 18import java.net.URL; 19import java.text.SimpleDateFormat; 20import java.util.Locale; 21import android.os.AsyncTask; 22 23import org.json.JSONException; 24import org.json.JSONObject; 25 26public class MainActivity extends AppCompatActivity { 27 28 private Handler handler = new Handler(); 29 private WebView myWebView; 30 private int story_no = -1; 31 private int busy_flg = 0; 32 33 34 private int count, period; 35 36 @Override 37 protected void onCreate(Bundle savedInstanceState) { 38 super.onCreate(savedInstanceState); 39 setContentView(R.layout.activity_main); 40 41 String url = "http://***.***.***.***/theater/Mainmenu/view"; 42 String cookie = ""; 43 44 myWebView = (WebView)findViewById(R.id.webview); 45 myWebView.getSettings().setJavaScriptEnabled(true); 46 myWebView.getSettings().setLoadWithOverviewMode(true); 47 myWebView.getSettings().setUseWideViewPort(true); 48 myWebView.setInitialScale(1); 49 myWebView.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY); 50 myWebView.getSettings().setSaveFormData(false); 51 52 53 CookieManager cookieManager = CookieManager.getInstance(); 54 cookieManager.setAcceptCookie(true); 55 cookieManager.setCookie(url, cookie); 56 cookieManager.setAcceptThirdPartyCookies(myWebView, true); 57 58 59 myWebView.setWebViewClient(new WebViewClient()); 60 String data = "email=***@***&password=******"; 61 myWebView.postUrl(url, data.getBytes()); 62 63 period = 4000; 64 65 handler.post(runnable); 66 } 67 68 69} 70

text

101-08 01:54:59.471 4179-4179/? E/libprocessgroup: failed to make and chown /acct/uid_10058: Read-only file system 201-08 01:54:59.726 4179-4179/? E/AndroidRuntime: FATAL EXCEPTION: main 3 Process: com.example.theater, PID: 4179 4 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.theater/com.example.theater.MainActivity}: android.view.InflateException: Binary XML file line #9: Error inflating class android.webkit.WebView 5 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325) 6 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) 7 at android.app.ActivityThread.access$800(ActivityThread.java:151) 8 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) 9 at android.os.Handler.dispatchMessage(Handler.java:102) 10 at android.os.Looper.loop(Looper.java:135) 11 at android.app.ActivityThread.main(ActivityThread.java:5254) 12 at java.lang.reflect.Method.invoke(Native Method) 13 at java.lang.reflect.Method.invoke(Method.java:372) 14 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) 15 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) 16 Caused by: android.view.InflateException: Binary XML file line #9: Error inflating class android.webkit.WebView 17 at android.view.LayoutInflater.createView(LayoutInflater.java:633) 18 at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55) 19 20

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

androidx.appcompat:appcompat:1.1.0 のバグではありませんか?
「"Error inflating class android.webkit.WebView"」などで検索されてみては如何でしょうか.

投稿2020/01/08 05:40

jimbe

総合スコア12543

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

sarasa_38765

2020/01/09 06:43

頂いた情報から検索したところ build.gradle(モジュール:app)の androidx.appcompat:appcompat:1.0.2に変更したところ 正常に表示できました。android studioのバグなんですね。
jimbe

2020/01/09 07:07

いえ, android studio のバグではなく, Google のライブラリのバグです. 結構放置されているようなので, 直せないのか直す気がない類のようです.
sarasa_38765

2020/01/09 07:16

なるほど。放置ってのは痛いですね。(^^;
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問