Issues deploying for Android

Hello! I’m having trouble deploying an app for android that is using Zoom SDK ( https://github.com/zoom/zoom-sdk-ionic ) . I can build the project just fine in Android Studio but not inside of AppFlow.

FAILURE: Build failed with an exception.

  • 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 {

google()

jcenter()

mavenCentral()

flatDir{

    dirs 'src/main/libs', 'libs', '../capacitor-cordova-android-plugins/src/main/libs/android'

}

}

Then it builds just fine with Android Studio, but I still can’t make it build with AppFlow. Any suggestions?
Thanks in advance!

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.

flatDir{
    dirs '../capacitor-cordova-android-plugins/src/main/libs/android'
}

or edit the .gitignore inside android folder and remove the capacitor-cordova-android-plugins line

Thanks! That solved that issue. But now I’m having adMob errors, any chance you’re familiar with it?

AdMob.java:4: error: package android.support.design.widget does not exist

I found a thread with this issue with people getting it fixed but I’m still struggling.

see Capacitor can't build due to AndroidX conflicts, at a total loss on how to fix

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:

yarn remove capacitor-admob
yarn add https://github.com/rahadur/capacitor-admob#47c82fa998a6c5bd493217a05a9c99f421e9e817

And it builds fine in AppFlow now.

1 Like