不幸的是,申请已停止AVD

时间:2012-10-29 15:57:51

标签: android logcat avd

所以我正在创建一个显示googlemap的简单应用。我没有项目错误,但遗憾的是“应用程序”已经停止错误。

这是我的logcat

10-29 13:10:00.916: D/AndroidRuntime(458): Shutting down VM
10-29 13:10:00.916: W/dalvikvm(458): threadid=1: thread exiting with uncaught exception (group=0x409961f8)
10-29 13:10:00.936: E/AndroidRuntime(458): FATAL EXCEPTION: main
10-29 13:10:00.936: E/AndroidRuntime(458): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.bossapps.campusmapped/com.bossapps.campusmapped.MainActivity}: android.view.InflateException: Binary XML file line #1: Error inflating class android.widget.RelativeLayout
10-29 13:10:00.936: E/AndroidRuntime(458):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1955)
10-29 13:10:00.936: E/AndroidRuntime(458):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980)
10-29 13:10:00.936: E/AndroidRuntime(458):  at android.app.ActivityThread.access$600(ActivityThread.java:122)
10-29 13:10:00.936: E/AndroidRuntime(458):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146)
10-29 13:10:00.936: E/AndroidRuntime(458):  at android.os.Handler.dispatchMessage(Handler.java:99)
10-29 13:10:00.936: E/AndroidRuntime(458):  at android.os.Looper.loop(Looper.java:137)
10-29 13:10:00.936: E/AndroidRuntime(458):  at android.app.ActivityThread.main(ActivityThread.java:4340)
10-29 13:10:00.936: E/AndroidRuntime(458):  at java.lang.reflect.Method.invokeNative(Native Method)
10-29 13:10:00.936: E/AndroidRuntime(458):  at java.lang.reflect.Method.invoke(Method.java:511)
10-29 13:10:00.936: E/AndroidRuntime(458):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
10-29 13:10:00.936: E/AndroidRuntime(458):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
10-29 13:10:00.936: E/AndroidRuntime(458):  at dalvik.system.NativeStart.main(Native Method)
10-29 13:10:00.936: E/AndroidRuntime(458): Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class android.widget.RelativeLayout
10-29 13:10:00.936: E/AndroidRuntime(458):  at android.view.LayoutInflater.createView(LayoutInflater.java:606)
10-29 13:10:00.936: E/AndroidRuntime(458):  at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
10-29 13:10:00.936: E/AndroidRuntime(458):  at android.view.LayoutInflater.onCreateView(LayoutInflater.java:653)
10-29 13:10:00.936: E/AndroidRuntime(458):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:678)
10-29 13:10:00.936: E/AndroidRuntime(458):  at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
10-29 13:10:00.936: E/AndroidRuntime(458):  at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
10-29 13:10:00.936: E/AndroidRuntime(458):  at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
10-29 13:10:00.936: E/AndroidRuntime(458):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:251)
10-29 13:10:00.936: E/AndroidRuntime(458):  at android.app.Activity.setContentView(Activity.java:1835)
10-29 13:10:00.936: E/AndroidRuntime(458):  at com.bossapps.campusmapped.MainActivity.onCreate(MainActivity.java:12)
10-29 13:10:00.936: E/AndroidRuntime(458):  at android.app.Activity.performCreate(Activity.java:4465)
10-29 13:10:00.936: E/AndroidRuntime(458):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
10-29 13:10:00.936: E/AndroidRuntime(458):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1919)
10-29 13:10:00.936: E/AndroidRuntime(458):  ... 11 more
10-29 13:10:00.936: E/AndroidRuntime(458): Caused by: java.lang.reflect.InvocationTargetException
10-29 13:10:00.936: E/AndroidRuntime(458):  at java.lang.reflect.Constructor.constructNative(Native Method)
10-29 13:10:00.936: E/AndroidRuntime(458):  at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
10-29 13:10:00.936: E/AndroidRuntime(458):  at android.view.LayoutInflater.createView(LayoutInflater.java:586)
10-29 13:10:00.936: E/AndroidRuntime(458):  ... 23 more
10-29 13:10:00.936: E/AndroidRuntime(458): Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f050000 a=-1 r=0x7f050000}
10-29 13:10:00.936: E/AndroidRuntime(458):  at android.content.res.Resources.loadDrawable(Resources.java:1899)
10-29 13:10:00.936: E/AndroidRuntime(458):  at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
10-29 13:10:00.936: E/AndroidRuntime(458):  at android.view.View.<init>(View.java:2780)
10-29 13:10:00.936: E/AndroidRuntime(458):  at android.view.View.<init>(View.java:2717)
10-29 13:10:00.936: E/AndroidRuntime(458):  at android.view.ViewGroup.<init>(ViewGroup.java:379)
10-29 13:10:00.936: E/AndroidRuntime(458):  at android.widget.RelativeLayout.<init>(RelativeLayout.java:174)
10-29 13:10:00.936: E/AndroidRuntime(458):  ... 26 more

有人有什么想法吗?

编辑:     请记住,我只添加了一些虚拟按钮,用于测试它基本上是一个全新的应用程序。我创建的除了按钮之外唯一的东西是包含按钮上显示的字符串的字符串变量,除了它是一个全新的应用程序。

这是我的MainActivity.java

package com.bossapps.campusmapped;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;

public class MainActivity extends Activity {

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

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
}

在API版本16 AVD上运行

XML activity_main file

<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="@style/AppTheme" >

    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="14dp"
        android:text="@string/Welcome"
        tools:context=".MainActivity" />

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/textView2"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="30dp"
        android:text="@string/View_Mode"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <RadioButton
        android:id="@+id/radioButton1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/textView1"
        android:layout_marginLeft="34dp"
        android:layout_marginTop="23dp"
        android:text="@string/Regular" />

    <RadioButton
        android:id="@+id/radioButton2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/radioButton1"
        android:layout_below="@+id/radioButton1"
        android:text="@string/Augmented " />

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/radioButton2"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="33dp"
        android:text="@string/Go" />

</RelativeLayout>

3 个答案:

答案 0 :(得分:3)

您是否检查过Apptheme中有@style/Apptheme?因为它是解析器无法找到的唯一资源(即:not a drawable (color or path)):

10-29 13:10:00.936: E/AndroidRuntime(458): Caused by: 
  android.content.res.Resources$NotFoundException: Resource is not a Drawable 
  (color or path): TypedValue{t=0x1/d=0x7f050000 a=-1 r=0x7f050000}

答案 1 :(得分:0)

从您的跟踪中猜测,您的xml布局有问题.... android.view.InflateException:二进制XML文件行#1:错误膨胀类android.widget.RelativeLayout。

你能发布吗?

答案 2 :(得分:0)

 10-29 13:10:00.936: E/AndroidRuntime(458): Caused by: android.view.InflateException:     Binary XML file line #1: Error inflating class android.widget.RelativeLayout

 10-29 13:10:00.936: E/AndroidRuntime(458): Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f050000 a=-1 r=0x7f050000}

来自Drawable RelativeLayout方法的某些MainActivity中的一些setContentView()