Android ツールによって作成されたアプリで xml を編集しただけで、アプリが起動に失敗し、パースペクティブ ビューに送られ、ActivityThread.performLaunchActivity(ActivityThread$ActivityClientRecord, Intent) 行がポップアップ表示されます: 2306
これは Logcat です。
03-22 20:47:09.865: E/ActivityThread(14977): Failed to inflate
03-22 20:47:09.865: E/ActivityThread(14977): android.view.InflateException: Binary XML file line #113: Error inflating class <unknown>
03-22 20:47:09.865: E/ActivityThread(14977): at android.view.LayoutInflater.createView(LayoutInflater.java:613)
03-22 20:47:09.865: E/ActivityThread(14977): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
03-22 20:47:09.865: E/ActivityThread(14977): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
03-22 20:47:09.865: E/ActivityThread(14977): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
03-22 20:47:09.865: E/ActivityThread(14977): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
03-22 20:47:09.865: E/ActivityThread(14977): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
03-22 20:47:09.865: E/ActivityThread(14977): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
03-22 20:47:09.865: E/ActivityThread(14977): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
03-22 20:47:09.865: E/ActivityThread(14977): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:282)
03-22 20:47:09.865: E/ActivityThread(14977): at android.app.Activity.setContentView(Activity.java:1881)
03-22 20:47:09.865: E/ActivityThread(14977): at com.timmo.tampmusicplayer.NowPlaying.onCreate(NowPlaying.java:12)
03-22 20:47:09.865: E/ActivityThread(14977): at android.app.Activity.performCreate(Activity.java:5104)
03-22 20:47:09.865: E/ActivityThread(14977): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
03-22 20:47:09.865: E/ActivityThread(14977): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2260)
03-22 20:47:09.865: E/ActivityThread(14977): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2356)
03-22 20:47:09.865: E/ActivityThread(14977): at android.app.ActivityThread.access$600(ActivityThread.java:150)
03-22 20:47:09.865: E/ActivityThread(14977): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1244)
03-22 20:47:09.865: E/ActivityThread(14977): at android.os.Handler.dispatchMessage(Handler.java:99)
03-22 20:47:09.865: E/ActivityThread(14977): at android.os.Looper.loop(Looper.java:137)
03-22 20:47:09.865: E/ActivityThread(14977): at android.app.ActivityThread.main(ActivityThread.java:5195)
03-22 20:47:09.865: E/ActivityThread(14977): at java.lang.reflect.Method.invokeNative(Native Method)
03-22 20:47:09.865: E/ActivityThread(14977): at java.lang.reflect.Method.invoke(Method.java:511)
03-22 20:47:09.865: E/ActivityThread(14977): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
03-22 20:47:09.865: E/ActivityThread(14977): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
03-22 20:47:09.865: E/ActivityThread(14977): at dalvik.system.NativeStart.main(Native Method)
03-22 20:47:09.865: E/ActivityThread(14977): Caused by: java.lang.reflect.InvocationTargetException
03-22 20:47:09.865: E/ActivityThread(14977): at java.lang.reflect.Constructor.constructNative(Native Method)
03-22 20:47:09.865: E/ActivityThread(14977): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
03-22 20:47:09.865: E/ActivityThread(14977): at android.view.LayoutInflater.createView(LayoutInflater.java:587)
03-22 20:47:09.865: E/ActivityThread(14977): ... 24 more
03-22 20:47:09.865: E/ActivityThread(14977): Caused by: java.lang.OutOfMemoryError
03-22 20:47:09.865: E/ActivityThread(14977): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
03-22 20:47:09.865: E/ActivityThread(14977): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:502)
03-22 20:47:09.865: E/ActivityThread(14977): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:355)
03-22 20:47:09.865: E/ActivityThread(14977): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:785)
03-22 20:47:09.865: E/ActivityThread(14977): at android.content.res.Resources.loadDrawable(Resources.java:1991)
03-22 20:47:09.865: E/ActivityThread(14977): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
03-22 20:47:09.865: E/ActivityThread(14977): at android.widget.ImageView.<init>(ImageView.java:120)
03-22 20:47:09.865: E/ActivityThread(14977): at android.widget.ImageView.<init>(ImageView.java:110)
03-22 20:47:09.865: E/ActivityThread(14977): ... 27 more
XML:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#111111"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".NowPlaying" >
<RelativeLayout
android:id="@+id/rlcontrols"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
<Button
android:id="@+id/bplay"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_below="@+id/tvalbum"
android:layout_centerHorizontal="true"
android:background="@drawable/play"
android:contentDescription="@+string/play" />
<Button
android:id="@+id/bprevious"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_below="@id/tvalbum"
android:layout_marginRight="10dp"
android:layout_toLeftOf="@id/bplay"
android:background="@drawable/previous"
android:contentDescription="@+string/play" />
<Button
android:id="@+id/bnext"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_below="@id/tvalbum"
android:layout_marginLeft="10dp"
android:layout_toRightOf="@id/bplay"
android:background="@drawable/next"
android:contentDescription="@+string/play" />
<Button
android:id="@+id/brepeat"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignBottom="@id/bnext"
android:layout_marginLeft="10dp"
android:layout_toRightOf="@id/bnext"
android:background="@drawable/repeat"
android:contentDescription="@+string/play" />
<Button
android:id="@+id/bshuffle"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignBottom="@id/bprevious"
android:layout_marginRight="10dp"
android:layout_toLeftOf="@id/bprevious"
android:background="@drawable/shuffle"
android:contentDescription="@+string/play" />
<SeekBar
android:id="@+id/songProgressBar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/bplay"
android:layout_marginTop="10dp"
android:progressDrawable="@drawable/progress"
android:thumb="@drawable/seeker" />
<TextView
android:id="@+id/tvtime"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/songProgressBar"
android:gravity="right"
android:text="@string/time"
android:textSize="20sp" />
</RelativeLayout>
<TextView
android:id="@+id/tvalbum"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="@id/rlcontrols"
android:gravity="center"
android:text="@string/album"
android:textSize="20sp" />
<TextView
android:id="@+id/tvartist"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="@id/tvalbum"
android:gravity="center"
android:text="@string/artist"
android:textSize="20sp" />
<TextView
android:id="@+id/tvtitle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="@id/tvartist"
android:gravity="center"
android:text="@string/title"
android:textSize="25sp" />
<ImageView
android:id="@+id/ivalbumart"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@id/tvtitle"
android:contentDescription="@+string/albumart"
android:src="@drawable/albumart" />
</RelativeLayout>
必要に応じてマニフェスト:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.timmo.tampmusicplayer"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.timmo.tampmusicplayer.NowPlaying"
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>
</manifest>
クラスの理由:
public class NowPlaying extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.nowplaying);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.now_playing, menu);
return true;
}
}
誰かが私に何が間違っていたのか説明してください。なぜなら、私にはこれがまったくわからずlayoutinflater
、Logcatの読み方さえもわからないからです..助けてくれてありがとう