我正在尝试从他们的教程(第一篇)中学习TeeChart的一个例子。 出于某种原因,当我运行下面的代码时,会导致发生UnsupportedOperationException。 任何人都可以提供有关可能发生这种情况的任何帮助。
以下是相关文件。
的AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.teeChart02"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="15"/>
<application android:label="@string/app_name" android:icon="@drawable/ic_launcher">
<activity android:name="MyActivity"
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>
main.xml中
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/mylayout">
</LinearLayout>
MyActivity.java
package com.example.teeChart02;
import android.app.Activity;
import android.os.Bundle;
import android.widget.LinearLayout;
import com.steema.teechart.TChart;
import com.steema.teechart.drawing.Color;
import com.steema.teechart.styles.Bar;
import com.steema.teechart.styles.Series;
public class MyActivity extends Activity
{
private TChart chart;
@Override
public void onCreate( Bundle savedInstanceState )
{
super.onCreate( savedInstanceState );
setContentView( R.layout.main );
LinearLayout ll = (LinearLayout) findViewById( R.id.mylayout );
chart = new TChart( this );
ll.addView( chart );
Series bar = new Bar( chart.getChart() );
chart.getAxes().getBottom().setIncrement( 1 );
bar.add( 123, "Apples", Color.green );
bar.add( 456, "Oranges", Color.red );
bar.add( 321, "Kiwis", Color.yellow );
bar.add( 78, "Bananas", Color.orange );
}
}
生成的异常是:
01-17 11:50:27.863: ERROR/AndroidRuntime(1631): FATAL EXCEPTION: main
java.lang.UnsupportedOperationException
at android.view.GLES20Canvas.clipPath(GLES20Canvas.java:413)
at com.steema.teechart.android.Graphics3DAndroid.clipPolygon(Graphics3DAndroid.java:312)
at com.steema.teechart.drawing.Graphics3D.clipToRight(Graphics3D.java:4575)
at com.steema.teechart.drawing.Graphics3D.clipCube(Graphics3D.java:4614)
at com.steema.teechart.styles.Series.clipRegionCreate(Series.java:2088)
at com.steema.teechart.styles.Series.drawSeries(Series.java:2311)
at com.steema.teechart.Chart.drawAllSeries(Chart.java:790)
at com.steema.teechart.Chart.drawAxesSeries(Chart.java:752)
at com.steema.teechart.Chart.internalDraw(Chart.java:732)
at com.steema.teechart.Chart.paint(Chart.java:2080)
at com.steema.teechart.Chart.paint(Chart.java:2096)
at com.steema.teechart.TChart.onDraw(TChart.java:322)
at android.view.View.draw(View.java:10978)
at android.view.View.getDisplayList(View.java:10417)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.getDisplayList(View.java:10415)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.getDisplayList(View.java:10415)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.getDisplayList(View.java:10415)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.draw(View.java:10981)
at android.widget.FrameLayout.draw(FrameLayout.java:450)
at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2126)
at android.view.View.getDisplayList(View.java:10417)
at android.view.HardwareRenderer$GlRenderer.draw(HardwareRenderer.java:842)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:1910)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1634)
at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2442)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
答案 0 :(得分:2)
请检查您是否在“项目属性 - &gt; Java构建路径 - &gt;订单和导出”选项卡中选择了TeeChart.Android.jar库
答案 1 :(得分:1)
我正在和TeeChart一起工作,minSdkVersion为11,目标为13.一旦切换到12的minSdkVersion和15的目标,我就开始收到完全相同的错误。我还没有花时间弄清问题是哪个,但一旦我切换回11和13,问题就消失了