0

I need a customized version of Ionic's document-scanner plugin. So i created a fork and i was able to use my fork in my ionic project. But I also need a customized version of the library scanlibrary to use it in my custom document-scanner plugin. I followed this guide to add the library to my cordova-plugin project. Unfortunately the library is missing, when i build my ionic project. The document-scanner files are included in the ionic project, but AndroidStudio can't resolve the imports of the scanlibrary: Screenshot of Scan.java file

This is my plugin.xml file:

<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0" id="cordova-plugin-document-scanner" version="4.2.5">

  <name>Scan</name>
  <engines>
    <engine name="cordova-android" version=">=6.4.0" />
  </engines>
  <asset src="www/scan.js" target="js/scan.js"/>
  <js-module src="www/scan.js" name="scan">
    <clobbers target="scan" />
  </js-module>


  <platform name="android">
    <config-file target="res/xml/config.xml" parent="/*">
      <feature name="Scan">
        <param name="android-package" value="com.neutrinos.plugin.Scan"/>
      </feature>
    </config-file>

    <source-file src="src/android/Scan.java" target-dir="src/com/neutrinos/plugin/" />
    <source-file src="src/android/FileHelper.java" target-dir="src/com/neutrinos/plugin/" />
    <framework src="src/android/build.gradle" custom="true" type="gradleReference"/>
  </platform>


  <platform name="ios">
    <config-file target="config.xml" parent="/*">
      <feature name="Scan">
        <param name="ios-package" value="Scan" />
      </feature>
    </config-file>

    <preference name="CAMERA_USAGE_DESCRIPTION" default="This app needs camera access"/>
    <config-file target="*-Info.plist" parent="NSCameraUsageDescription">
      <string>$CAMERA_USAGE_DESCRIPTION</string>
    </config-file>

    <preference name="PHOTOLIBRARY_USAGE_DESCRIPTION" default="This app needs read/write-access photo library access"/>
    <config-file target="*-Info.plist" parent="NSPhotoLibraryUsageDescription">
      <string>$PHOTOLIBRARY_USAGE_DESCRIPTION</string>
    </config-file>

    <header-file src="src/ios/Scan.h" target-dir="ScanPlugin"/>
    <source-file src="src/ios/Scan.m" target-dir="ScanPlugin"/>
    <framework src="src/ios/TOCropViewController.framework" custom="true" embed="true"/>
    <framework src="src/ios/IRLDocumentScanner.framework" custom="true" embed="true"/>
  </platform>

</plugin>

build.gradle file:

allprojects {
    repositories {
        maven { 
            url 'https://jitpack.io' 
        }
    }
}

dependencies {
    compile project(':myScanLib')
}

Any ideas, what is missing to get this work?

F. Scholz
  • 45
  • 4

1 Answers1

0

from what am seeing it will not be possible to include an Android native library in a Cordova project. you can create a custom cordova library for that

wise4rmgod
  • 33
  • 1
  • 6