6

I am creating two custom plugins for android use this plugin described in my plugin.xml. My plugin.xml file like

    <?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.my.mybiometric"
    version="1.2">

    <name>myBiometric</name>
    <description>myBiometric Plugin</description>
    <license>Apache 2.0</license>
    <keywords>media,upload</keywords>

<engines>
    <engine name="cordova-android" version=">=3.4.0" />
</engines>
    <js-module src="www/js/Media2.js" name="Media2">
        <clobbers target="mediaRec.startRecord" /> 
    </js-module>
    <js-module src="www/js/VoiceUpload.js" name="VoiceUpload">
         <clobbers target="VoiceUpload" />
    </js-module>

    <!-- android -->
    <platform name="android">
        <config-file target="res/xml/config.xml" parent="/*">
         <feature name="Media2">
    <param name="android-package" value="com.my.mybiometric.AudioHandler"/>
    </feature>
    <feature name="VoiceUpload">
      <param name="android-package" value="com.my.mybiometric.UploadHandler"/>
    </feature>
        </config-file>
        <config-file target="AndroidManifest.xml" parent="/manifest/application">
        <activity
            android:name="com.my.mybiometric.myBiometric"
            android:label="@string/app_name" 
            android:screenOrientation="portrait"
          android:configChanges="orientation|screenSize|keyboardHidden">
          </activity>
    </config-file>

        <source-file src="platforms/android/src/com/my/plugins/AudioHandler.java" target-dir="src/com/my/mybiometric" />
        <source-file src="platforms/android/src/com/my/plugins/UploadHandler.java" target-dir="src/com/my/mybiometric" />
        <source-file src="platforms/android/src/com/my/plugins/AppLog.java" target-dir="src/com/my/mybiometric" />
        <source-file src="platforms/android/src/com/my/plugins/MyResponseHandler.java" target-dir="src/com/my/mybiometric" />
        <source-file src="platforms/android/src/com/my/plugins/Recorder.java" target-dir="src/com/my/mybiometric" />

        <source-file src="platforms/android/src/com/my/plugins/VoiceBiometricClient.java" target-dir="src/com/my/mybiometric" />
        <source-file src="platforms/android/src/com/my/plugins/VoiceBiometricClientUsage.java" target-dir="src/com/my/mybiometric" />

     </platform>
</plugin>

after build and run the project the media2 plugin is working fine but when i call the voiceupload plugin its return the "class not found" error for voice upload i am using "android-async-http-1.4.4.jar". I add the jar file into libs folder i added manually. How to fix this issue?

Ben10
  • 3,221
  • 2
  • 34
  • 61

2 Answers2

4
  1. You put your jar file in your plugin in the folder platforms/android/src/libs
  2. In plugin.xml you add the line

    <source-file src="platforms/android/src/libs/android-async-http-1.4.4.jar" target-dir="libs" />

  3. no 3.

QuickFix
  • 11,661
  • 2
  • 38
  • 50
  • Does this actually work? I get an error because cordova looks from my jar in the plugins directory even though I specified a path in the directory folder. – Steven Wexler Sep 29 '15 at 19:14
  • are you installing your plugin using the cli/plugman or are you working directly in a java project in eclipse of android studio ? – QuickFix Sep 30 '15 at 09:41
  • I was just using the cli cordova plugin add /path/to/plugin. I was getting an error: Could not find my-library.jar because it was looking for the jar in the plugins directory rather than the platforms directory. – Steven Wexler Sep 30 '15 at 20:24
  • Thanks! This worked perfect for me but I put the JAR into `platforms/android/libs` instead. And, of course, changing to this path as `src` in ``. – Joaquin Iurchuk Jul 06 '16 at 12:36
0

Check my answer here

You need to go to Go to Project->Properties and make some changes as per the answer.

Hope this helps.

Community
  • 1
  • 1
Siddharth_Vyas
  • 9,972
  • 10
  • 39
  • 69