Andoroid studio上でコンパイルは通るのですが、実機にて、「問題が発生したため、終了します」とメッセージが表示され、強制終了してしまいます。原因わかりますでしょうか?
※変更したソース
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button btn = (Button)findViewById(R.id.button2);
btn.setText("Hello");
btn.setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View arg0) { Button b = (Button) arg0; b.setText("こんにちは"); } }); }
※logcat
11-03 03:56:46.132 411-411/com.example.yusuket.myfirstapp E/AndroidRuntime: FATAL EXCEPTION: main
11-03 03:56:46.132 411-411/com.example.yusuket.myfirstapp E/AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.yusuket.myfirstapp/com.example.yusuket.myfirstapp.MainActivity}: android.view.InflateException: Binary XML file line #12: Error inflating class <unknown>
11-03 03:56:46.132 411-411/com.example.yusuket.myfirstapp E/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
11-03 03:56:46.132 411-411/com.example.yusuket.myfirstapp E/AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
11-03 03:56:46.132 411-411/com.example.yusuket.myfirstapp E/AndroidRuntime: at android.app.ActivityThread.access$2300(ActivityThread.java:125)
11-03 03:56:46.132 411-411/com.example.yusuket.myfirstapp E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
11-03 03:56:46.132 411-411/com.example.yusuket.myfirstapp E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99)
11-03 03:56:46.132 411-411/com.example.yusuket.myfirstapp E/AndroidRuntime: at android.os.Looper.loop(Looper.java:123)
11-03 03:56:46.132 411-411/com.example.yusuket.myfirstapp E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:4627)
11-03 03:56:46.132 411-411/com.example.yusuket.myfirstapp E/AndroidRuntime: at java.lang.reflect.Method.invokeNative(Native Method)
11-03 03:56:46.132 411-411/com.example.yusuket.myfirstapp E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:521)
11-03 03:56:46.132 411-411/com.example.yusuket.myfirstapp E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-03 03:56:46.132 411-411/com.example.yusuket.myfirstapp E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-03 03:56:46.132 411-411/com.example.yusuket.myfirstapp E/AndroidRuntime: at dalvik.system.NativeStart.main(Native Method)
11-03 03:56:46.132 411-411/com.example.yusuket.myfirstapp E/AndroidRuntime: Caused by: android.view.InflateException: Binary XML file line #12: Error inflating class <unknown>
11-03 03:56:46.132 411-411/com.example.yusuket.myfirstapp E/AndroidRuntime: at android.view.LayoutInflater.createView(LayoutInflater.java:513)
11-03 03:56:46.132 411-411/com.example.yusuket.myfirstapp E/AndroidRuntime: at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
11-03 03:56:46.132 411-411/com.example.yusuket.myfirstapp E/AndroidRuntime: at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
11-03 03:56:46.132 411-411/com.example.yusuket.myfirstapp E/AndroidRuntime: at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。