Das Einbetten von Knopflerfish in Android funktioniert nicht

Ich versuche, das Knopflerfish-Framework in eine Android-Anwendung einzubetten, um Bundles dynamisch zu laden und zu entladen. ich folgtediese Tutorial

Der erste Schritt, den ich gemacht habe, ist das Herunterladen von framework.jar vondiese verknüpfen und zu meinem Klassenpfad in meinem Eclipse-Projekt hinzufügen.

Darüber hinaus ist unten meine onCreate () -Methode:

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



    Map fwprops = new Hashtable(); //CHANGED
    // add any framework properties to fwprops
    FrameworkFactory ff = new FrameworkFactoryImpl();
    mFramework = ff.newFramework(fwprops);
    try {

        mFramework.init(); //ERROR HERE!!

    } catch (BundleException be) {
        // framework initialization failed

        Log.d(TAG, be.getStackTrace().toString());
    }



}

Beachten Sie, dass ich eine Codezeile geändert habe, da sie einen Syntaxfehler aufweist.

Welches ist:

Dictionary fwprops = new Hashtable();
to
Map fwprops = new Hashtable(); //CHANGED

Der Syntaxfehler:The method newFramework(Map) in the type FrameworkFactory is not applicable for the arguments (Dictionary)

Nun, laut @ldx indiese "Die Patches, die ich für eine bessere Android / Dalvik-Unterstützung in Knopflerfish eingereicht habe, wurden zusammengeführt, so dass das Patchen und Neukompilieren von KF nicht mehr erforderlich sein sollte:"

und deshalb habe ich nichts hinzugefügt, vorausgesetzt mein Code ist genug, wie es jetzt ist.

Wenn ich die App starte. Ich bekomme sofort:Unfortunately, Knopflerfish_Android has stopped auf dem Bildschirm.

Kann jemand helfen? Unten ist der LogCat:

08-04 18:25:35.233: E/Trace(7018): error opening trace file: No such file or directory (2)
08-04 18:25:36.793: D/AndroidRuntime(7018): Shutting down VM
08-04 18:25:36.793: W/dalvikvm(7018): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
08-04 18:25:36.813: E/AndroidRuntime(7018): FATAL EXCEPTION: main
08-04 18:25:36.813: E/AndroidRuntime(7018): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.knopflerfish_android/com.example.knopflerfish_android.MainActivity}: java.lang.RuntimeException: Failed to initialize storage org.knopflerfish.framework.bundlestorage.file.BundleStorageImpl
08-04 18:25:36.813: E/AndroidRuntime(7018):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
08-04 18:25:36.813: E/AndroidRuntime(7018):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
08-04 18:25:36.813: E/AndroidRuntime(7018):     at android.app.ActivityThread.access$600(ActivityThread.java:141)
08-04 18:25:36.813: E/AndroidRuntime(7018):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
08-04 18:25:36.813: E/AndroidRuntime(7018):     at android.os.Handler.dispatchMessage(Handler.java:99)
08-04 18:25:36.813: E/AndroidRuntime(7018):     at android.os.Looper.loop(Looper.java:137)
08-04 18:25:36.813: E/AndroidRuntime(7018):     at android.app.ActivityThread.main(ActivityThread.java:5041)
08-04 18:25:36.813: E/AndroidRuntime(7018):     at java.lang.reflect.Method.invokeNative(Native Method)
08-04 18:25:36.813: E/AndroidRuntime(7018):     at java.lang.reflect.Method.invoke(Method.java:511)
08-04 18:25:36.813: E/AndroidRuntime(7018):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
08-04 18:25:36.813: E/AndroidRuntime(7018):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
08-04 18:25:36.813: E/AndroidRuntime(7018):     at dalvik.system.NativeStart.main(Native Method)
08-04 18:25:36.813: E/AndroidRuntime(7018): Caused by: java.lang.RuntimeException: Failed to initialize storage org.knopflerfish.framework.bundlestorage.file.BundleStorageImpl
08-04 18:25:36.813: E/AndroidRuntime(7018):     at org.knopflerfish.framework.FrameworkContext.init(FrameworkContext.java:343)
08-04 18:25:36.813: E/AndroidRuntime(7018):     at org.knopflerfish.framework.SystemBundle.doInit(SystemBundle.java:513)
08-04 18:25:36.813: E/AndroidRuntime(7018):     at org.knopflerfish.framework.SystemBundle.init(SystemBundle.java:125)
08-04 18:25:36.813: E/AndroidRuntime(7018):     at com.example.knopflerfish_android.MainActivity.onCreate(MainActivity.java:39)
08-04 18:25:36.813: E/AndroidRuntime(7018):     at android.app.Activity.performCreate(Activity.java:5104)
08-04 18:25:36.813: E/AndroidRuntime(7018):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
08-04 18:25:36.813: E/AndroidRuntime(7018):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
08-04 18:25:36.813: E/AndroidRuntime(7018):     ... 11 more
08-04 18:25:36.813: E/AndroidRuntime(7018): Caused by: java.lang.reflect.InvocationTargetException
08-04 18:25:36.813: E/AndroidRuntime(7018):     at java.lang.reflect.Constructor.constructNative(Native Method)
08-04 18:25:36.813: E/AndroidRuntime(7018):     at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
08-04 18:25:36.813: E/AndroidRuntime(7018):     at org.knopflerfish.framework.FrameworkContext.init(FrameworkContext.java:341)
08-04 18:25:36.813: E/AndroidRuntime(7018):     ... 17 more
08-04 18:25:36.813: E/AndroidRuntime(7018): Caused by: java.lang.RuntimeException: Cannot create directory: /fwdir/bs
08-04 18:25:36.813: E/AndroidRuntime(7018):     at org.knopflerfish.framework.Util.getFileStorage(Util.java:99)
08-04 18:25:36.813: E/AndroidRuntime(7018):     at org.knopflerfish.framework.bundlestorage.file.BundleStorageImpl.<init>(BundleStorageImpl.java:127)
08-04 18:25:36.813: E/AndroidRuntime(7018):     ... 20 more
08-04 18:25:39.543: I/Process(7018): Sending signal. PID: 7018 SIG: 9

Antworten auf die Frage(1)

Ihre Antwort auf die Frage