0

I am working on Yfiles for Android 2.2. When i imported the tutorial, given by the library owners. It is showing me the following error and application is not running. If some one can understand the following exception please do me correct.

09-11 10:28:50.478: E/AndroidRuntime(11938): FATAL EXCEPTION: main
09-11 10:28:50.478: E/AndroidRuntime(11938): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.yworks.android/com.yworks.android.SampleApplication}: android.view.InflateException: Binary XML file line #8: Error inflating class com.yworks.yfiles.ui.GraphControl
09-11 10:28:50.478: E/AndroidRuntime(11938):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1872)
09-11 10:28:50.478: E/AndroidRuntime(11938):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1893)
09-11 10:28:50.478: E/AndroidRuntime(11938):    at android.app.ActivityThread.access$1500(ActivityThread.java:135)
09-11 10:28:50.478: E/AndroidRuntime(11938):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1054)
09-11 10:28:50.478: E/AndroidRuntime(11938):    at android.os.Handler.dispatchMessage(Handler.java:99)
09-11 10:28:50.478: E/AndroidRuntime(11938):    at android.os.Looper.loop(Looper.java:150)
09-11 10:28:50.478: E/AndroidRuntime(11938):    at android.app.ActivityThread.main(ActivityThread.java:4389)
09-11 10:28:50.478: E/AndroidRuntime(11938):    at java.lang.reflect.Method.invokeNative(Native Method)
09-11 10:28:50.478: E/AndroidRuntime(11938):    at java.lang.reflect.Method.invoke(Method.java:507)
09-11 10:28:50.478: E/AndroidRuntime(11938):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
09-11 10:28:50.478: E/AndroidRuntime(11938):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
09-11 10:28:50.478: E/AndroidRuntime(11938):    at dalvik.system.NativeStart.main(Native Method)
09-11 10:28:50.478: E/AndroidRuntime(11938): Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class com.yworks.yfiles.ui.GraphControl
09-11 10:28:50.478: E/AndroidRuntime(11938):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:581)
09-11 10:28:50.478: E/AndroidRuntime(11938):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
09-11 10:28:50.478: E/AndroidRuntime(11938):    at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
09-11 10:28:50.478: E/AndroidRuntime(11938):    at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
09-11 10:28:50.478: E/AndroidRuntime(11938):    at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
09-11 10:28:50.478: E/AndroidRuntime(11938):    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:250)
09-11 10:28:50.478: E/AndroidRuntime(11938):    at android.app.Activity.setContentView(Activity.java:1742)
09-11 10:28:50.478: E/AndroidRuntime(11938):    at com.yworks.android.SampleApplication.onCreate(SampleApplication.java:28)
09-11 10:28:50.478: E/AndroidRuntime(11938):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1072)
09-11 10:28:50.478: E/AndroidRuntime(11938):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1836)
09-11 10:28:50.478: E/AndroidRuntime(11938):    ... 11 more
09-11 10:28:50.478: E/AndroidRuntime(11938): Caused by: java.lang.ClassNotFoundException: com.yworks.yfiles.ui.GraphControl in loader dalvik.system.PathClassLoader[/data/app/com.yworks.android-1.apk]
09-11 10:28:50.478: E/AndroidRuntime(11938):    at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
09-11 10:28:50.478: E/AndroidRuntime(11938):    at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
09-11 10:28:50.478: E/AndroidRuntime(11938):    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
09-11 10:28:50.478: E/AndroidRuntime(11938):    at android.view.LayoutInflater.createView(LayoutInflater.java:471)
09-11 10:28:50.478: E/AndroidRuntime(11938):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:570)
09-11 10:28:50.478: E/AndroidRuntime(11938):    ... 20 more

The java file is:

package com.yworks.android;

import android.app.Activity;
import android.os.Bundle;
import com.yworks.yfiles.ui.GraphControl;
import com.yworks.yfiles.ui.model.GraphExtension;
import com.yworks.yfiles.ui.model.IGraph;

/**
 * Getting Started - 01 Creating the View
 *
 * This demo simply introduces class {@link GraphControl}, the
 * central UI element for working with graphs in @PRODUCT@,
 * and {@link GraphExtension}, which provides convenience
 * methods for working with IGraphs.
 */
public class SampleApplication extends Activity {

  private GraphControl graphControl;
  private GraphExtension graphExtension;

  @Override
  protected void onCreate( final Bundle savedInstanceState ) {

        super.onCreate(savedInstanceState);
        // Sets the content view to the main layout loaded from
        // res/layout/main.xml
        setContentView(R.layout.main);
        // The GraphControl is declared in the loaded layout,
        // so now we can retrieve a reference to it
        graphControl = (GraphControl) findViewById(R.id.graphControl);
        // GraphExtension provides convenience methods
        // which are used in the following demos.
        graphExtension = new GraphExtension(graphControl.getGraph());

    // We'll initialize the app here in the following demos.
  }

  /**
   * Convenience property for getting the GraphControl's Graph
   * @return The GraphControls Graph
   */
  public IGraph getGraph() {
    return graphControl.getGraph();
  }

}

Thanks Regards iambilloo

4

1 回答 1

0

在您的应用程序目录中创建一个名为“libs”的文件夹,并将您的外部 jar 放在那里。在 Eclipse 中更正 Java 构建路径,然后重建(清理+构建)您的应用程序!我有一个类似的问题,就这样消失了。

于 2012-09-11T05:40:15.747 回答