I have written my own plugin for cordova and the building process works without problems 'cordova run android' (BUILD SUCCESSFUL).
For starting purpose I just want to open another activity after clicking a button in my index.html. Unfortunately the app crashes as soon as it calls the other activity; I think there might be a mistake in my plugin.xml (it does maybe not include everything). The activity that I want to start works perfectly fine in Android Studio and on my real android device.
Here is my 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>
And this is the original 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>
As soon as I press the button, the called app crashes. I can see the error in Android Studio, because my phone is connected:
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)
Does anyone have an idea how I can solve this issue or if I have done any errors before that could cause this one?