Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add External Jar file in cordova 3.4.0 application

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?

like image 821
Ben10 Avatar asked Apr 01 '14 06:04

Ben10


1 Answers

  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.

like image 65
QuickFix Avatar answered Oct 20 '22 01:10

QuickFix