Cordova App在开启另一项活动时崩溃。 plugin.xml中的错误?

时间:2016-03-29 12:02:05

标签: android cordova phonegap-plugins cordova-plugins

我已经为cordova编写了自己的插件,并且构建过程正常运行并且没有问题&#cord;运行android' (建立成功)。

出于启动目的,我只想在点击index.html中的按钮后打开另一个活动。不幸的是,一旦它调用其他活动,应用程序就会崩溃;我认为我的plugin.xml中可能存在错误(它可能不包含所有内容)。 我想要开始的活动在Android Studio和我真正的Android设备上完美运行。

这是我的plugin.xml:

<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
    xmlns:android="http://schemas.android.com/apk/res/android"
    id="com.matd.coolplugin"
    version="0.2.11">
    <name>CoolPlugin</name>
    <description>The coolest Plugin ever implemented</description>
    <license>Apache 2.0</license>
    <keywords>cordova,coolest</keywords>
    <repo></repo>
    <issue></issue>

    <js-module src="www/CoolPlugin.js" name="CoolPlugin">
        <clobbers target="CoolPlugin" />
    </js-module>

    <!-- android -->
    <platform name="android">
        <config-file target="res/xml/config.xml" parent="/*">
            <feature name="CoolPlugin" >
                <param name="android-package" value="theUser.multibarcode.CoolPlugin"/>
            </feature>
        </config-file>

        <!-- manifest einstellungen -->
        <config-file target="AndroidManifest.xml" parent="/manifest/application">
        <activity
            android:name="theUser.multibarcode.MultiTrackerActivity"
            android:label="Multi-Tracker"
            android:screenOrientation="fullSensor">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

     </config-file>
     <config-file>
     <meta-data
            android:name="com.google.android.gms.vision.DEPENDENCIES"
            android:value="barcode,face" />
     </config-file>

     <config-file target="AndroidManifest.xml" parent="/manifest">

     <uses-feature android:name="android.hardware.camera" />
     <uses-permission android:name="android.permission.CAMERA" />

     </config-file>


        <source-file src="src/android/src/theUser/multibarcode/CoolPlugin.java" target-dir="src/" />
        <source-file src="src/android/src/theUser/multibarcode/BarcodeTrackerFactory.java" target-dir="src/" />
        <source-file src="src/android/src/theUser/multibarcode/FaceTrackerFactory.java" target-dir="src/" />
        <source-file src="src/android/src/theUser/multibarcode/GraphicTracker.java" target-dir="src/" />
        <source-file src="src/android/src/theUser/multibarcode/MultiTrackerActivity.java" target-dir="src/" />
        <source-file src="src/android/src/theUser/multibarcode/TrackedGraphic.java" target-dir="src/" />
        <source-file src="src/android/src/theUser/multibarcode/ui/camera/CameraSourcePreview.java" target-dir="src/ui/camera/" />
        <source-file src="src/android/src/theUser/multibarcode/ui/camera/GraphicOverlay.java" target-dir="src/ui/camera/" />

        <source-file src="src/android/libs/google-play-services.jar" target-dir="libs/" />
        <source-file src="src/android/libs/android-support-v4.jar" target-dir="libs/" />
        <source-file src="src/android/libs/android-support-v7-appcompat.jar" target-dir="libs/" />
        <source-file src="src/android/libs/android-support-design.jar" target-dir="libs/" />
    </platform>

</plugin>

这是最初的Android Manifest:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="theUser.multibarcode">

    <uses-feature android:name="android.hardware.camera" />

    <uses-permission android:name="android.permission.CAMERA" />

    <application
        android:allowBackup="true"
        android:hardwareAccelerated="true"
        android:icon="@drawable/icon"
        android:theme="@style/Theme.AppCompat"
        android:label="MultiTrackerApp">

        <meta-data
            android:name="com.google.android.gms.vision.DEPENDENCIES"
            android:value="barcode,face" />

        <activity
            android:name="theUser.multibarcode.MultiTrackerActivity"
            android:icon="@drawable/icon"
            android:label="Multi-Tracker"
            android:theme="@style/Theme.AppCompat.NoActionBar"
            android:screenOrientation="fullSensor">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

只要按下按钮,被叫应用程序就会崩溃。我可以在Android Studio中看到错误,因为我的手机已连接:

03-29 13:53:27.107  10131-10131/com.henning E/﹕ appName=com.henning, acAppName=/system/bin/surfaceflinger
03-29 13:53:27.108  10131-10131/com.henning E/﹕ 0
03-29 13:53:27.374  10131-10131/com.henning E/﹕ appName=com.henning, acAppName=/system/bin/surfaceflinger
03-29 13:53:27.374  10131-10131/com.henning E/﹕ 0
03-29 13:53:46.740  10131-10131/com.henning E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.henning, PID: 10131
    java.lang.NoClassDefFoundError: android.support.v7.appcompat.R$styleable
            at android.support.v7.app.AppCompatDelegateImplV7.createSubDecor(AppCompatDelegateImplV7.java:336)
            at android.support.v7.app.AppCompatDelegateImplV7.ensureSubDecor(AppCompatDelegateImplV7.java:309)
            at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:273)
            at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
            at roesner.multibarcode.MultiTrackerActivity.onCreate(MultiTrackerActivity.java:70)
            at android.app.Activity.performCreate(Activity.java:5264)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1088)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2302)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390)
            at android.app.ActivityThread.access$800(ActivityThread.java:151)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321)
            at android.os.Handler.dispatchMessage(Handler.java:110)
            at android.os.Looper.loop(Looper.java:193)
            at android.app.ActivityThread.main(ActivityThread.java:5299)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:641)
            at dalvik.system.NativeStart.main(Native Method)

有没有人知道如何解决这个问题,或者我之前是否做过任何错误可能导致这个问题?

0 个答案:

没有答案