首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何将android库包含到cordova插件中

如何将android库包含到cordova插件中
EN

Stack Overflow用户
提问于 2020-11-06 01:14:52
回答 1查看 98关注 0票数 0

我需要一个自定义版本的爱奥尼的document-scanner插件。所以我创建了一个分支,并且我能够在我的ionic项目中使用我的分支。但我还需要一个自定义版本的库scanlibrary,以便在我的自定义文档扫描器插件中使用它。我遵循这个guide将这个库添加到我的cordova-plugin项目中。不幸的是,当我构建我的ionic项目时,这个库丢失了。文档扫描仪文件包含在ionic项目中,但AndroidStudio无法解析扫描库的导入:

这是我的plugin.xml文件:

代码语言:javascript
复制
<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文件:

代码语言:javascript
复制
allprojects {
    repositories {
        maven { 
            url 'https://jitpack.io' 
        }
    }
}

dependencies {
    compile project(':myScanLib')
}

有什么想法,需要什么才能让这项工作生效?

EN

回答 1

Stack Overflow用户

发布于 2020-11-06 01:31:19

据我所见,在Cordova项目中包含Android原生库是不可能的。您可以为此创建一个自定义的cordova库

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64702092

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档