Reputation: 71
im very new to ionic and to hybrid framework. im sorry if my question here is very newbie question
i have a plugin that works on cordova. Im trying to integrate this plugin in my Ionic project. So i have downloaded the plugin files. then add it to my ionic project using npm i ../my-plugins
. as part of the plugin integration, i have to include the .aar file in android/app/build.gradle which i already did like so
implementation files("src/main/libs/mypluginsdk.aar")
the aar file have been copied to the specified directory
then i run the app using ionic capacitor run android
. When building it starts to show error at this part:
[capacitor] > Task :capacitor-haptics:javaPreCompileDebug UP-TO-DATE
[capacitor] > Task :capacitor-cordova-android-plugins:javaPreCompileDebug
[capacitor]
[capacitor] > Task :capacitor-cordova-android-plugins:compileDebugJavaWithJavac FAILED
[capacitor] /Users/rslr/capacitorProject/iontest/android/capacitor-cordova-android-plugins/src/main/java/org/apache/cordova/myplugin/MyPlugin.java:7: error: package com.myplugin.thetoast does not exist
so i noticed that inside the android folder. there is another folder generated called capacitor-cordova-android-plugins
inside is where there is another build.gradle. i added the implementation line again on this gradle file and then run the android folder using Android Studio(to avoid the build.gradle from being overwritten) and there are no error and the plugin works and able to run on my phone
so technically, i actually have to add the implementation...
on this build.gradle not on android/app/build.gradle. i cannot change it manually like i just did because it will get overwritten when i run the app using ionic capacitor run android
. i did some digging and i may need to change the plugin.xml on the plugin folder but i have no idea how to do this. please help how i can properly integrate this. thanks in advance
Upvotes: 0
Views: 50