更新时间:2022-01-11 22:08:06
根据我的经验,您需要创建一个自定义插件,并在自定义插件中使用您的 .aar 文件.
As per my experience, you need to create a custom plugin and use your .aar file in your custom plugin.
按照以下步骤在Ionic项目中使用ur .aar 文件.
Follow the below steps to use ur .aar file in Ionic project.
步骤1:.创建一个插件.
您可以使用 Plugman 创建您的自定义插件.
You can use Plugman to create your custom plugin.
第2步:设置所有Android依赖项
Step 2: Setup All Android dependencies
为您的 .aar 文件设置所有必需的依赖性,以通过Gradle支持本机依赖性.
Setup all required dependency for your .aar file to support native dependencies through Gradle.
步骤3:配置API
需要在导出到Cordova应用程序的 .JS 文件中定义所需的包装器API.
Need to define required wrapper API in your .JS file which is exported to the Cordova application.
通过这三个步骤,您将通过自定义插件包装获得 .aar 功能,并公开Ionic应用程序所需的所有方法.
By these 3 steps, you will get your .aar functionality through custom plugin wrapper and expose all required methods for Ionic app.
在下面找到有用的链接,以实现您的要求.
Find below useful links to achieve your requirements.
希望您能找到上述答案&链接很有帮助.
I hope you will find the above answer & link helpful.