0

我正在尝试以 custom 显示图像GPUImageView。当我尝试将应用程序运行到 android 设备中时,它工作正常并且没有显示任何布局错误。

但是当我尝试将它运行到模拟器中时,它显示如下错误:

08-27 12:18:37.887: E/AndroidRuntime(551): java.lang.RuntimeException: Unable to start activity ComponentInfo{jp.co.cyberagent.android.gpuimage.sample/jp.co.cyberagent.android.gpuimage.sample.activity.ActivityGallery}: android.view.InflateException: Binary XML file line #12: Error inflating class jp.co.cyberagent.android.gpuimage.GPUImageView
08-27 12:18:37.887: E/AndroidRuntime(551):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
08-27 12:18:37.887: E/AndroidRuntime(551):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
08-27 12:18:37.887: E/AndroidRuntime(551):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
08-27 12:18:37.887: E/AndroidRuntime(551):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
08-27 12:18:37.887: E/AndroidRuntime(551):  at android.os.Handler.dispatchMessage(Handler.java:99)
08-27 12:18:37.887: E/AndroidRuntime(551):  at android.os.Looper.loop(Looper.java:123)
08-27 12:18:37.887: E/AndroidRuntime(551):  at android.app.ActivityThread.main(ActivityThread.java:4627)
08-27 12:18:37.887: E/AndroidRuntime(551):  at java.lang.reflect.Method.invokeNative(Native Method)
08-27 12:18:37.887: E/AndroidRuntime(551):  at java.lang.reflect.Method.invoke(Method.java:521)
08-27 12:18:37.887: E/AndroidRuntime(551):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
08-27 12:18:37.887: E/AndroidRuntime(551):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
08-27 12:18:37.887: E/AndroidRuntime(551):  at dalvik.system.NativeStart.main(Native Method)
08-27 12:18:37.887: E/AndroidRuntime(551): Caused by: android.view.InflateException: Binary XML file line #12: Error inflating class jp.co.cyberagent.android.gpuimage.GPUImageView
08-27 12:18:37.887: E/AndroidRuntime(551):  at android.view.LayoutInflater.createView(LayoutInflater.java:513)
08-27 12:18:37.887: E/AndroidRuntime(551):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
08-27 12:18:37.887: E/AndroidRuntime(551):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
08-27 12:18:37.887: E/AndroidRuntime(551):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
08-27 12:18:37.887: E/AndroidRuntime(551):  at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
08-27 12:18:37.887: E/AndroidRuntime(551):  at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
08-27 12:18:37.887: E/AndroidRuntime(551):  at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
08-27 12:18:37.887: E/AndroidRuntime(551):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
08-27 12:18:37.887: E/AndroidRuntime(551):  at android.app.Activity.setContentView(Activity.java:1647)
08-27 12:18:37.887: E/AndroidRuntime(551):  at jp.co.cyberagent.android.gpuimage.sample.activity.ActivityGallery.onCreate(ActivityGallery.java:49)
08-27 12:18:37.887: E/AndroidRuntime(551):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
08-27 12:18:37.887: E/AndroidRuntime(551):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
08-27 12:18:37.887: E/AndroidRuntime(551):  ... 11 more
08-27 12:18:37.887: E/AndroidRuntime(551): Caused by: java.lang.reflect.InvocationTargetException
08-27 12:18:37.887: E/AndroidRuntime(551):  at jp.co.cyberagent.android.gpuimage.GPUImageView.<init>(GPUImageView.java:40)
08-27 12:18:37.887: E/AndroidRuntime(551):  at java.lang.reflect.Constructor.constructNative(Native Method)
08-27 12:18:37.887: E/AndroidRuntime(551):  at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
08-27 12:18:37.887: E/AndroidRuntime(551):  at android.view.LayoutInflater.createView(LayoutInflater.java:500)
08-27 12:18:37.887: E/AndroidRuntime(551):  ... 22 more
08-27 12:18:37.887: E/AndroidRuntime(551): Caused by: java.lang.IllegalStateException: OpenGL ES 2.0 is not supported on this phone.
08-27 12:18:37.887: E/AndroidRuntime(551):  at jp.co.cyberagent.android.gpuimage.GPUImage.<init>(GPUImage.java:66)
08-27 12:18:37.887: E/AndroidRuntime(551):  at jp.co.cyberagent.android.gpuimage.GPUImageView.init(GPUImageView.java:44)
08-27 12:18:37.887: E/AndroidRuntime(551):  ... 26 more

布局文件:

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
       android:layout_height="match_parent"
      android:background="#000000"
      android:orientation="vertical" >
<FrameLayout
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1" >
    <jp.co.cyberagent.android.gpuimage.GPUImageView
        android:id="@+id/gpuimage"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center" >
        </jp.co.cyberagent.android.gpuimage.GPUImageView>
    <SeekBar
        android:id="@+id/seekBar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:max="100" />
    <FrameLayout
        android:id="@+id/vidio"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
        <VideoView
            android:id="@+id/vidoplayer"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />
    </FrameLayout>
</FrameLayout>
<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal" >
    <Button
        android:id="@+id/button_choose_filter"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Choose filter" />
    <Button
        android:id="@+id/button_save"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Save" />
</LinearLayout>
 </LinearLayout>

请指导我如何让这个东西在模拟器中运行。

任何帮助将不胜感激。

谢谢你。

4

1 回答 1

2

错误在那里说:

原因:java.lang.IllegalStateException:此手机不支持 OpenGL ES 2.0。

Android 模拟器还不支持 OpenGL ES 2.0!查看官方网站上的此链接以获取更多信息。

你可以看看Genymotion,它是我使用的,而不是默认的模拟器。它的运行速度更快,并且支持 OpenGL ES 2.0。请注意,我不认可它们或任何东西,但它是免费的并且有效。

于 2013-08-27T07:18:44.283 回答