Java Android无法启动活动Android.view.inflate异常。应用程序在`setContentView()上崩溃`

Java Android无法启动活动Android.view.inflate异常。应用程序在`setContentView()上崩溃`,java,android,Java,Android,我从android编程开始。这些应用程序启动崩溃让我抓狂。目前我在eclipse中有一个Android应用程序和一个Android库项目。我在logcat中发现以下错误 Logcat 01-22 06:00:33.167: E/AndroidRuntime(25666): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.camerafilters/com.example.camerafi

我从android编程开始。这些应用程序启动崩溃让我抓狂。目前我在eclipse中有一个Android应用程序和一个Android库项目。我在logcat中发现以下错误

Logcat

01-22 06:00:33.167: E/AndroidRuntime(25666): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.camerafilters/com.example.camerafilters.CameraMainActivity}: android.view.InflateException: Binary XML file line #12: Error inflating class org.lucasr.twowayview.TwoWayView
01-22 06:00:33.167: E/AndroidRuntime(25666):    at com.example.camerafilters.CameraMainActivity.onCreate(CameraMainActivity.java:44)`
该库是双向视图。这是我的
activity\u main.xml
文件

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

<com.example.camerafilters.CameraGLSurfaceView
    android:id="@+id/CameraGLSurfaceView"
    android:layout_width="fill_parent"
    android:layout_height="0dp"
    android:layout_weight="8"/>

<org.lucasr.twowayview.TwoWayView
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/ShaderList"
    style="@style/TwoWayView"
    android:layout_width="wrap_content"
    android:layout_height="0dp"
    android:layout_weight="2"
    android:drawSelectorOnTop="false"
    tools:context=".CameraMainActivity"  />

</LinearLayout>
如果需要更多代码,请告诉我。
setContentView()函数中的应用程序崩溃。我在同一个工作区中还有一个使用相同配置的项目。该项目还使用一个
GLSurfaceView
TwoWayView
列表来显示该项目工作正常

这是stacktrace

CameraFilters [Android Application] 
DalvikVM[localhost:8617]    
    Thread [<1> main] (Suspended (exception RuntimeException))  
        <VM does not provide monitor information>   
        ActivityThread.performLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 2308    
        ActivityThread.handleLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 2362 
        ActivityThread.access$700(ActivityThread, ActivityThread$ActivityClientRecord, Intent) line: 168    
        ActivityThread$H.handleMessage(Message) line: 1329  
        ActivityThread$H(Handler).dispatchMessage(Message) line: 99 
        Looper.loop() line: 177 
        ActivityThread.main(String[]) line: 5493    
        Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]  
        Method.invoke(Object, Object...) line: 525  
        ZygoteInit$MethodAndArgsCaller.run() line: 1225 
        ZygoteInit.main(String[]) line: 1041    
        NativeStart.main(String[]) line: not available [native method]  
    Thread [<10> Binder_2] (Running)    
    Thread [<9> Binder_1] (Running) 
    Thread [<11> GLThread 22597] (Running)  
CameraFilters[Android应用程序]
DalvikVM[localhost:8617]
线程[main](挂起(异常运行时异常))
ActivityThread.performLaunchActivity(ActivityThread$ActivityClientRecord,Intent)行:2308
ActivityThread.handleLaunchActivity(ActivityThread$ActivityClientRecord,Intent)行:2362
ActivityThread.access$700(ActivityThread,ActivityThread$ActivityClientRecord,Intent)行:168
ActivityThread$H.handleMessage(消息)行:1329
ActivityThread$H(处理程序)。dispatchMessage(消息)行:99
Looper.loop()行:177
ActivityThread.main(字符串[])行:5493
invokenactive(Object,Object[],Class,Class[],Class,int,boolean)行:不可用[本机方法]
调用(对象,对象…)行:525
ZygoteInit$MethodAndArgsCaller.run()行:1225
颧骨单位。主(字符串[])行:1041
NativeStart.main(字符串[])行:不可用[本机方法]
螺纹[Binder_2](运行)
螺纹[Binder_1](运行)
线程[GLThread 22597](正在运行)
更新
所以我做了更多的调试,发现这两个项目位于不同的驱动器中。这有什么区别吗?正在成功运行的项目位于
TwoWayView
所在的同一驱动器中。当这个项目在eclipse工作区中时,不同的驱动器是双向视图

更新2
我把图书馆移到了同一个目录下,但仍然没有运气。即使是现在,工作的那一个仍然在工作:(.这两个项目之间的更多调查和比较提供了一些指导。虽然我做了相同的配置,但我可以在
Project Properties->Android
Library部分看到这个
TwoWayView
,而在这个项目中我看不到。当我从那里删除这个库时,以前的项目也开始崩溃

更改为:

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

<com.example.camerafilters.CameraGLSurfaceView
    android:id="@+id/CameraGLSurfaceView"
    android:layout_width="fill_parent"
    android:layout_height="0dp"
    android:layout_weight="8"/>

<org.lucasr.twowayview.TwoWayView

    android:id="@+id/ShaderList"
    style="@style/TwoWayView"
    android:layout_width="wrap_content"
    android:layout_height="0dp"
    android:layout_weight="2"
    android:drawSelectorOnTop="false"
    tools:context=".CameraMainActivity"  />

</LinearLayout>


发布完整的堆栈跟踪。

post org.lucasr.twowayview.twowayview这是我的layout.xml文件——它不应该是
activity\u main.xml
?是的,对不起!它的
activity\u main.xml
onlyAs@blackbelt说,你无论如何都应该发布
twowayview
类。看起来那里可能有问题,可能是你的其他项目只是不要触发问题。@Joffrey TwoWayView太大了,无法发布。这是链接
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

<com.example.camerafilters.CameraGLSurfaceView
    android:id="@+id/CameraGLSurfaceView"
    android:layout_width="fill_parent"
    android:layout_height="0dp"
    android:layout_weight="8"/>

<org.lucasr.twowayview.TwoWayView

    android:id="@+id/ShaderList"
    style="@style/TwoWayView"
    android:layout_width="wrap_content"
    android:layout_height="0dp"
    android:layout_weight="2"
    android:drawSelectorOnTop="false"
    tools:context=".CameraMainActivity"  />

</LinearLayout>