cordova-plugin-safariviewcontroller icon indicating copy to clipboard operation
cordova-plugin-safariviewcontroller copied to clipboard

How do I disable this plugin for Android?

Open brianarpie opened this issue 5 years ago • 4 comments

I don't want to use this plugin for the Android platform and I'm getting build errors that I'd rather not debug. How can I only use this plugin for iOS and disable it for Android? Thank you

brianarpie avatar Oct 02 '19 15:10 brianarpie

Here are the build failures I'm getting in case it's not possible to disable this plugin and you'd like to help me debug. It seems like the android support package is not being loaded properly. The wiki explaining to turn on Android Support is no longer relevant since it's not available to add under SDK Tools in the latest version of Android and it has moved to "Android X". I will note that I do see the implementation definition for custom tabs 23.2.0 in the gradle build file.

cordova 9.0.0 android 8.0.0

import android.support.customtabs.CustomTabsClient;
                                 ^
  symbol:   class CustomTabsClient
  location: package android.support.customtabs
/Users/brianarpie/repos/aloe/cxm/cxm-mobile/platforms/android/app/src/main/java/org/chromium/customtabsclient/shared/ServiceConnectionCallback.java:27: error: cannot find symbol
    void onServiceConnected(CustomTabsClient client);
                            ^
  symbol:   class CustomTabsClient
  location: interface ServiceConnectionCallback
/Users/brianarpie/repos/aloe/cxm/cxm-mobile/platforms/android/app/src/main/java/org/chromium/customtabsclient/shared/ServiceConnection.java:18: error: cannot find symbol
import android.support.customtabs.CustomTabsClient;
                                 ^
  symbol:   class CustomTabsClient
  location: package android.support.customtabs
/Users/brianarpie/repos/aloe/cxm/cxm-mobile/platforms/android/app/src/main/java/org/chromium/customtabsclient/shared/ServiceConnection.java:19: error: cannot find symbol
import android.support.customtabs.CustomTabsServiceConnection;
                                 ^
  symbol:   class CustomTabsServiceConnection
  location: package android.support.customtabs
/Users/brianarpie/repos/aloe/cxm/cxm-mobile/platforms/android/app/src/main/java/org/chromium/customtabsclient/shared/ServiceConnection.java:27: error: cannot find symbol
public class ServiceConnection extends CustomTabsServiceConnection {
                                       ^
  symbol: class CustomTabsServiceConnection
/Users/brianarpie/repos/aloe/cxm/cxm-mobile/platforms/android/app/src/main/java/org/chromium/customtabsclient/shared/ServiceConnection.java:36: error: cannot find symbol
    public void onCustomTabsServiceConnected(ComponentName name, CustomTabsClient client) {
                                                                 ^
  symbol:   class CustomTabsClient
  location: class ServiceConnection
/Users/brianarpie/repos/aloe/cxm/cxm-mobile/platforms/android/app/src/main/java/com/customtabplugin/CustomTabServiceHelper.java:10: error: cannot find symbol
import android.support.customtabs.CustomTabsClient;
                                 ^
  symbol:   class CustomTabsClient
  location: package android.support.customtabs
/Users/brianarpie/repos/aloe/cxm/cxm-mobile/platforms/android/app/src/main/java/com/customtabplugin/CustomTabServiceHelper.java:11: error: cannot find symbol
import android.support.customtabs.CustomTabsIntent;
                                 ^
  symbol:   class CustomTabsIntent
  location: package android.support.customtabs
/Users/brianarpie/repos/aloe/cxm/cxm-mobile/platforms/android/app/src/main/java/com/customtabplugin/CustomTabServiceHelper.java:12: error: cannot find symbol
import android.support.customtabs.CustomTabsServiceConnection;
                                 ^
  symbol:   class CustomTabsServiceConnection
  location: package android.support.customtabs
/Users/brianarpie/repos/aloe/cxm/cxm-mobile/platforms/android/app/src/main/java/com/customtabplugin/CustomTabServiceHelper.java:13: error: cannot find symbol
import android.support.customtabs.CustomTabsSession;
                                 ^
  symbol:   class CustomTabsSession
  location: package android.support.customtabs
/Users/brianarpie/repos/aloe/cxm/cxm-mobile/platforms/android/app/src/main/java/com/customtabplugin/CustomTabServiceHelper.java:28: error: cannot find symbol
    private CustomTabsSession mCustomTabsSession;
            ^
  symbol:   class CustomTabsSession
  location: class CustomTabServiceHelper
/Users/brianarpie/repos/aloe/cxm/cxm-mobile/platforms/android/app/src/main/java/com/customtabplugin/CustomTabServiceHelper.java:29: error: cannot find symbol
    private CustomTabsClient mClient;
            ^
  symbol:   class CustomTabsClient
  location: class CustomTabServiceHelper
/Users/brianarpie/repos/aloe/cxm/cxm-mobile/platforms/android/app/src/main/java/com/customtabplugin/CustomTabServiceHelper.java:30: error: cannot find symbol
    private CustomTabsServiceConnection mConnection;
            ^
  symbol:   class CustomTabsServiceConnection
  location: class CustomTabServiceHelper
/Users/brianarpie/repos/aloe/cxm/cxm-mobile/platforms/android/app/src/main/java/com/customtabplugin/CustomTabServiceHelper.java:64: error: cannot find symbol
    public CustomTabsSession getSession() {
           ^
  symbol:   class CustomTabsSession
  location: class CustomTabServiceHelper
/Users/brianarpie/repos/aloe/cxm/cxm-mobile/platforms/android/app/src/main/java/com/customtabplugin/CustomTabServiceHelper.java:109: error: cannot find symbol
    public void onServiceConnected(CustomTabsClient client) {
                                   ^
  symbol:   class CustomTabsClient
  location: class CustomTabServiceHelper
/Users/brianarpie/repos/aloe/cxm/cxm-mobile/platforms/android/app/src/main/java/com/customtabplugin/CustomTabServiceHelper.java:121: error: cannot find symbol
    public CustomTabsClient getClient() {
           ^
  symbol:   class CustomTabsClient
  location: class CustomTabServiceHelper
/Users/brianarpie/repos/aloe/cxm/cxm-mobile/platforms/android/app/src/main/java/com/customtabplugin/ChromeCustomTabPlugin.java:10: error: package android.support.annotation does not exist
import android.support.annotation.ColorInt;
                                 ^
/Users/brianarpie/repos/aloe/cxm/cxm-mobile/platforms/android/app/src/main/java/com/customtabplugin/ChromeCustomTabPlugin.java:11: error: cannot find symbol
import android.support.customtabs.CustomTabsClient;
                                 ^
  symbol:   class CustomTabsClient
  location: package android.support.customtabs
/Users/brianarpie/repos/aloe/cxm/cxm-mobile/platforms/android/app/src/main/java/com/customtabplugin/ChromeCustomTabPlugin.java:12: error: cannot find symbol
import android.support.customtabs.CustomTabsIntent;
                                 ^
  symbol:   class CustomTabsIntent
  location: package android.support.customtabs
/Users/brianarpie/repos/aloe/cxm/cxm-mobile/platforms/android/app/src/main/java/com/customtabplugin/ChromeCustomTabPlugin.java:13: error: cannot find symbol
import android.support.customtabs.CustomTabsSession;
                                 ^
  symbol:   class CustomTabsSession
  location: package android.support.customtabs
/Users/brianarpie/repos/aloe/cxm/cxm-mobile/platforms/android/app/src/main/java/com/customtabplugin/ChromeCustomTabPlugin.java:14: error: cannot find symbol
import android.support.v4.app.ActivityCompat;
                             ^
  symbol:   class ActivityCompat
  location: package android.support.v4.app
/Users/brianarpie/repos/aloe/cxm/cxm-mobile/platforms/android/app/src/main/java/com/customtabplugin/ChromeCustomTabPlugin.java:15: error: cannot find symbol
import android.support.v4.app.ActivityOptionsCompat;
                             ^
  symbol:   class ActivityOptionsCompat
  location: package android.support.v4.app
/Users/brianarpie/repos/aloe/cxm/cxm-mobile/platforms/android/app/src/main/java/com/customtabplugin/ChromeCustomTabPlugin.java:169: error: package CustomTabsIntent does not exist
    private void addTransition(CustomTabsIntent.Builder builder, String transition) {
                                               ^
/Users/brianarpie/repos/aloe/cxm/cxm-mobile/platforms/android/app/src/main/java/com/customtabplugin/ChromeCustomTabPlugin.java:218: error: cannot find symbol
    private CustomTabsSession getSession() {
            ^
  symbol:   class CustomTabsSession
  location: class ChromeCustomTabPlugin
/Users/brianarpie/repos/aloe/cxm/cxm-mobile/platforms/android/app/src/main/java/com/customtabplugin/ChromeCustomTabPlugin.java:150: error: cannot find symbol
    private void show(String url, @ColorInt int toolbarColor, boolean showDefaultShareMenuItem, String transition) {
                                   ^
  symbol:   class ColorInt
  location: class ChromeCustomTabPlugin
/Users/brianarpie/repos/aloe/cxm/cxm-mobile/platforms/android/app/src/main/java/org/chromium/customtabsclient/shared/ServiceConnection.java:35: error: method does not override or implement a method from a supertype
    @Override
    ^
/Users/brianarpie/repos/aloe/cxm/cxm-mobile/platforms/android/app/src/main/java/org/chromium/customtabsclient/shared/ServiceConnection.java:41: error: method does not override or implement a method from a supertype
    @Override
    ^
/Users/brianarpie/repos/aloe/cxm/cxm-mobile/platforms/android/app/src/main/java/com/customtabplugin/CustomTabServiceHelper.java:91: error: cannot find symbol
        CustomTabsClient.bindCustomTabsService(activity, mPackageNameToBind, mConnection);
        ^
  symbol:   variable CustomTabsClient
  location: class CustomTabServiceHelper
/Users/brianarpie/repos/aloe/cxm/cxm-mobile/platforms/android/app/src/main/java/com/customtabplugin/CustomTabServiceHelper.java:102: error: cannot find symbol
        CustomTabsSession session = getSession();
        ^
  symbol:   class CustomTabsSession
  location: class CustomTabServiceHelper
/Users/brianarpie/repos/aloe/cxm/cxm-mobile/platforms/android/app/src/main/java/com/customtabplugin/ChromeCustomTabPlugin.java:151: error: package CustomTabsIntent does not exist
        CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder(getSession())
                        ^
/Users/brianarpie/repos/aloe/cxm/cxm-mobile/platforms/android/app/src/main/java/com/customtabplugin/ChromeCustomTabPlugin.java:151: error: package CustomTabsIntent does not exist
        CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder(getSession())
                                                               ^
/Users/brianarpie/repos/aloe/cxm/cxm-mobile/platforms/android/app/src/main/java/com/customtabplugin/ChromeCustomTabPlugin.java:159: error: cannot find symbol
        CustomTabsIntent customTabsIntent = builder.build();
        ^
  symbol:   class CustomTabsIntent
  location: class ChromeCustomTabPlugin
/Users/brianarpie/repos/aloe/cxm/cxm-mobile/platforms/android/app/src/main/java/com/customtabplugin/ChromeCustomTabPlugin.java:174: error: cannot find symbol
                mStartAnimationBundle = ActivityOptionsCompat.makeCustomAnimation(
                                        ^
  symbol:   variable ActivityOptionsCompat
  location: class ChromeCustomTabPlugin
/Users/brianarpie/repos/aloe/cxm/cxm-mobile/platforms/android/app/src/main/java/com/customtabplugin/ChromeCustomTabPlugin.java:186: error: cannot find symbol
            ActivityCompat.startActivityForResult(cordova.getActivity(), intent, CUSTOM_TAB_REQUEST_CODE, mStartAnimationBundle);
            ^
  symbol:   variable ActivityCompat
  location: class ChromeCustomTabPlugin
/Users/brianarpie/repos/aloe/cxm/cxm-mobile/platforms/android/app/src/main/java/com/customtabplugin/ChromeCustomTabPlugin.java:192: error: cannot find symbol
        final CustomTabsClient client = mCustomTabPluginHelper.getClient();
              ^
  symbol:   class CustomTabsClient
  location: class ChromeCustomTabPlugin
/Users/brianarpie/repos/aloe/cxm/cxm-mobile/platforms/android/app/src/main/java/com/customtabplugin/ChromeCustomTabPlugin.java:200: error: cannot find symbol
            CustomTabsSession session = getSession();
            ^
  symbol:   class CustomTabsSession
  location: class ChromeCustomTabPlugin
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/brianarpie/repos/aloe/cxm/cxm-mobile/platforms/android/app/src/main/java/org/apache/cordova/file/AssetFilesystem.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
36 errors

brianarpie avatar Oct 02 '19 19:10 brianarpie

I second this, is it possible to disable the plugin for Android. Ive managed to do it manually by commenting out the whole section in cordova-plugin-safariviewcontroller/plugin.xml, but I need to get this automatically done for the build server. Is there some config.xml foo that does this for me?

cheers

mg avatar Oct 18 '19 17:10 mg

You can use plugman to install plugins only for selected platforms: https://cordova.apache.org/docs/de/latest/plugin_ref/plugman.html

simegger avatar Nov 19 '19 15:11 simegger

Do I still have to manually disable this plugin on Android (We would like to use it out of convenience) or will it somehow get fixed for Android X?

olidotjpeg avatar Oct 07 '20 13:10 olidotjpeg