What went wrong:
Could not determine the dependencies of task ‘:capacitor-cordova-android-plugins:compileDebugAidl’.
Could not resolve all task dependencies for configuration ‘:capacitor-cordova-android-plugins:debugCompileClasspath’.
Could not find :commonlib:.
Required by:
project :capacitor-cordova-android-plugins
Could not find :mobilertc:.
Required by:
project :capacitor-cordova-android-plugins
This issue can be fixed in Android Studio by adding additional library path inside of capacitor-cordova-android-plugins/build.gradle:
repositories {
capacitor-cordova-android-plugins folder is not commited by default, so instead of editing capacitor-cordova-android-plugins content, try adding this in the build.gradle that is in the root of the android folder, in the -> repositories section that is inside allprojects section.
Thanks but it didn’t help, not that I can see at least. I feel like I’ve tried everything but on AppFlow I still get the error.
npx jetify just writes “Jetifier found 172 file(s) to forward-jetify. Using 12 workers…” but doesn’t change any files, and adding dependencies to build.gradle doesn’t solve the problem either. I guess I’m really stuck on this one and will have to drop capacitor-admob and take a different route if I don’t get it to work.
Thanks for the help, I really appreciate it! Since I’m still new to the ionic ecosystem.
I managed to build with AdMob with Android Studio at least, but the same project won’t build in AppFlow. Any ideas why?
> Task :capacitor-admob:compileDebugJavaWithJavac FAILED
/builds/TheoXD/voteid/node_modules/capacitor-admob/android/src/main/java/app/xplatform/capacitor/plugins/AdMob.java:4: error: package android.support.design.widget does not exist
import android.support.design.widget.CoordinatorLayout;
^
/builds/TheoXD/voteid/node_modules/capacitor-admob/android/src/main/java/app/xplatform/capacitor/plugins/AdMob.java:128: error: package CoordinatorLayout does not exist
final CoordinatorLayout.LayoutParams mAdViewLayoutParams = new CoordinatorLayout.LayoutParams(
^
/builds/TheoXD/voteid/node_modules/capacitor-admob/android/src/main/java/app/xplatform/capacitor/plugins/AdMob.java:128: error: package CoordinatorLayout does not exist
final CoordinatorLayout.LayoutParams mAdViewLayoutParams = new CoordinatorLayout.LayoutParams(
^
/builds/TheoXD/voteid/node_modules/capacitor-admob/android/src/main/java/app/xplatform/capacitor/plugins/AdMob.java:129: error: package CoordinatorLayout does not exist
CoordinatorLayout.LayoutParams.WRAP_CONTENT,
^
/builds/TheoXD/voteid/node_modules/capacitor-admob/android/src/main/java/app/xplatform/capacitor/plugins/AdMob.java:130: error: package CoordinatorLayout does not exist
CoordinatorLayout.LayoutParams.WRAP_CONTENT
^
5 errors
Adding this line implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0' in node_modules/capacitor-admob/android/build.gradle as well as npx jetify is what makes it build in Android Studio, but how can I add this dependency outside of node_modules? Because it is a bad practice to do so, and it doesn’t work with AppFlow which is a dealbreaker for me. Any suggestions on how to properly add the dependency?
Just a quick update to everyone who is having this issue, just use the master branch of capacitor-admob until a new release comes out. All you need to do is this:
@TheoXD Thanks for the feedback, it helped me a lot regarding admob build on AppFlow.
On my side, using the master commit as a module resulted in an error : Cannot find module: 'capacitor-admob'. Make sure this package is installed.
I had to follow these steps to basically fork the module and build it’s dist directory :