Code Monkey home page Code Monkey logo

flutter_custom_tabs's Introduction

Flutter Custom Tabs Plugin

A Flutter plugin to launch a URL in Custom Tabs with a similar feel to url_launcher,
which allows you to add the browser experience that Custom Tabs provides to your mobile apps.

This plugin is built as federated plugins, see the app facing package flutter_custom_tabs for details.

flutter_custom_tabs's People

Contributors

adityabirangal avatar crushv avatar daniellampl avatar davidmigloz avatar droibit avatar em-yhoshino avatar gurkengewuerz avatar itsanubhav avatar mattisbrizard avatar petermnt avatar sputnikplop avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

flutter_custom_tabs's Issues

Doesn't work in Flutter module

Getting this exception when using Flutter as a module in a native app

Unhandled Exception: PlatformException(LAUNCH_ERROR, Launching a CustomTabs requires a foreground activity., null, null)

app not closed after getting the response.

I have a problem when I am getting the response after that browser is not closed automatically. any better suggestions? for closing the browser automatically.

Am trying to google sign using keycloak allset fine now am struggling with auto close browser.

app crush on ios

  try {
    await launch(url);
  } catch (e) {}

if the String url has a space at the beginning, the app crushes on IOS, on android nothing happens.

  • maybe trim() the string before use, incase human forgot to do so

Not show directly

I use flutter_custom_tabs 0.6.0 on android emulate and my mobile phone.

In emulate (Android 8) it works well (although the system is not support browser exactly).
But in my own mobile phone (Android 10), a single launch() action has no effect.
If I invoke launch() twice, the last action has no effect also, but after I press the back button, the first page will be shown (navigator changed only when pressed back button).

There is my code: (nearly is same with demo)

Future launchInBrowser({BuildContext context, String url}) async {
  try {
    await launch(
      url,
      option: CustomTabsOption(
        toolbarColor: Theme.of(context).primaryColor,
        enableDefaultShare: true,
        enableUrlBarHiding: false,
        showPageTitle: true,
        animation: CustomTabsAnimation(
          startEnter: 'slide_up',
          startExit: 'android:anim/fade_out',
          endEnter: 'android:anim/fade_in',
          endExit: 'slide_down',
        ),
        extraCustomTabs: [
          'org.mozilla.firefox',
          'com.microsoft.emmx',
        ],
      ),
    );
  } catch (ex) {
    return Future.error(ex);
  }
}
ListTile(
  onTap: () => launchInBrowser(context: context, url: xxx),
  xxx
)

Get notified when custom_tabs is closed

I need to detect and do something when custom_tabs were closed.

For example, I need to open the payment window. After payment is being made the window will be closed and I want to check payment status and navigate the user to a successful/failed screen.

For now, this method ("on closed" callback) is not provided by flutter_custom_tabs, due that I need to move to flutter_inappwebview but this package is simpler than that one. So I might come back if that functionality is added.

Tab Not Opening in Release Mode I am getting black screen.

My Tabs are working fine in debug mode but in release mode tabs are not opening.I am getting only black screen.

this is my flutter doctor output
C:\Users\user\AndroidStudioProjects\Flutter Projects\hind_news>flutter doctor -v
[√] Flutter (Channel stable, v1.12.13+hotfix.5, on Microsoft Windows [Version 10.0.18362.592], locale en-IN)
• Flutter version 1.12.13+hotfix.5 at C:\src\flutter\flutter
• Framework revision 27321ebbad (9 weeks ago), 2019-12-10 18:15:01 -0800
• Engine revision 2994f7e1e6
• Dart version 2.7.0

[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at C:\Users\user\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 28.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
• All Android licenses accepted.

[√] Android Studio (version 3.5)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 40.0.2
• Dart plugin version 191.8423
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)

[√] VS Code (version 1.41.1)
• VS Code at C:\Users\user\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.7.1

[√] Connected device (1 available)
• SM G610F • 33006936147764cd • android-arm • Android 8.1.0 (API 27)

• No issues found!

and my pubspec.yaml is.......

name: hind_news
description: A new Flutter project.

version: 1.0.0+1

environment:
sdk: ">=2.2.0 <3.0.0"

dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
http: ^0.12.0+2
webview_flutter: ^0.3.19+5
flutter_custom_tabs: ^0.6.0
shared_preferences: ^0.5.6
dynamic_theme: ^1.0.0
cached_network_image: ^2.0.0
#pull_to_refresh: ^1.5.8

dev_dependencies:
flutter_test:
sdk: flutter

flutter:

uses-material-design: true
assets:

  • images/
    fonts:
    - family: Gelasio
    fonts:
    • asset: fonts/Gelasio-Medium.ttf

I am using this method for launching tabs..

static void launchURL(BuildContext context, String url) async {
try {
await launch(
url,
option: CustomTabsOption(
toolbarColor: Theme.of(context).primaryColor,
enableDefaultShare: true,
enableUrlBarHiding: true,
showPageTitle: true,
animation: CustomTabsAnimation.slideIn(),
extraCustomTabs: [
// ref. https://play.google.com/store/apps/details?id=org.mozilla.firefox
'org.mozilla.firefox',
// ref. https://play.google.com/store/apps/details?id=com.microsoft.emmx
'com.microsoft.emmx',
],
),
);
} catch (e) {
debugPrint(e.toString());
}
}

Url with headers not working

I am trying to load PDF using web url that needs x-auth in headers. I am always getting authentication error using this package

Can not release the app

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring root project 'flutter_custom_tabs'.

SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 2s

The plugin flutter_custom_tabs could not be built due to the issue above.
Process finished with exit code 1

Cannot find symbol `CustomTabsFallback` with version 1.1.0 and 1.1.1

I upgraded my dependencies yesterday and cannot build the project unless I revert the upgrade for flutter_custom_tabs.
The following error is shown during the build process for Android:

/Users/user/.pub-cache/hosted/pub.dev/flutter_custom_tabs-1.1.1/android/src/main/java/com/github/droibit/flutter/plugins/customtabs/CustomTabsFactory.java:135: error: cannot find symbol
        final CustomTabsFallback fallback;
              ^
  symbol:   class CustomTabsFallback
  location: class CustomTabsFactory
/Users/user/.pub-cache/hosted/pub.dev/flutter_custom_tabs-1.1.1/android/src/main/java/com/github/droibit/flutter/plugins/customtabs/CustomTabsFactory.java:137: error: package CustomTabsLauncher does not exist
            fallback = new CustomTabsLauncher.LaunchNonChromeCustomTabs(extraCustomTabs);
                                             ^
/Users/user/.pub-cache/hosted/pub.dev/flutter_custom_tabs-1.1.1/android/src/main/java/com/github/droibit/flutter/plugins/customtabs/CustomTabsFactory.java:139: error: package CustomTabsLauncher does not exist
            fallback = new CustomTabsLauncher.LaunchNonChromeCustomTabs(context);
                                             ^
/Users/user/.pub-cache/hosted/pub.dev/flutter_custom_tabs-1.1.1/android/src/main/java/com/github/droibit/flutter/plugins/customtabs/CustomTabsPlugin.java:96: error: cannot find symbol
            final CustomTabsFallback fallback = factory.createFallback(options);
                  ^
  symbol:   class CustomTabsFallback
  location: class CustomTabsPlugin
/Users/user/.pub-cache/hosted/pub.dev/flutter_custom_tabs-1.1.1/android/src/main/java/com/github/droibit/flutter/plugins/customtabs/CustomTabsPlugin.java:97: error: cannot find symbol
            CustomTabsLauncher.launch(activity, customTabsIntent, uri, fallback);
            ^

for iOS the issue is:

Modules Issue (Xcode): Declaration of 'CustomTabsPlugin' must be imported from module 'flutter_custom_tabs.Swift' before it is required
/app/ios/Runner/GeneratedPluginRegistrant.m:255:3

Could not build the application for the simulator.
Error launching application on iPhone 14 Pro Max.

Neither running dart pub cache repair nor dart pub cache clean did solve the issue.

Only downgrading to flutter_custom_tabs: 1.0.4 solves the issue for now.

Running In App

Hello
Is it possible to run in inside the app, in a container or a box widget?

Thanks.

v0.6.0 freezes on open

Since 0.6.0, every time I try to launch a URL, the app and phone totally freeze. I have to lock and unlock the screen, and only then do I see the loaded custom tab.

Happens on multiple devices and versions of Android. Does not have this issue on 0.5.0

The code I use to launch

  void launchURL(String url) async {
    try {
      await launch(
        url,
        option: new CustomTabsOption(
            toolbarColor: mainColor,
            enableDefaultShare: true,
            enableUrlBarHiding: true,
            showPageTitle: true,
            animation: new CustomTabsAnimation.slideIn()),
      );
    } catch (e) {
      debugPrint(e.toString());
    }
  }

Execution failed for task ':app:compileDebugJavaWithJavac' at custom tab plugin

android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java:29: error: package com.github.droibit.flutter.plugins.customtabs does not exist
flutterEngine.getPlugins().add(new com.github.droibit.flutter.plugins.customtabs.CustomTabsPlugin());
^
1 error

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:compileDebugJavaWithJavac'.

Compilation failed; see the compiler error output for details.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 15s
Exception: Gradle task assembleDebug failed with exit code 1

background color?

Is it possible to set a background color as long as the website isn't loaded?

My Flutter app has a white background and the website has also a white background. But when the custom tab slides in (on Android as well as on iOS), it shows a dark background until the website starts loading.

So it looks white -> dark gray -> white :(

Is it possible to change this background color?

How to close the in-app browser programmatically

Hey,
I have been using this package for a while. I want to know (if it's already available\request a feature) how to close the in-app webview called using launch function.

Function:

  try {
    await launch(
      'URL_HERE',
      customTabsOption: const CustomTabsOption(
        toolbarColor: Color(0xff000000),
        enableDefaultShare: false,
        enableUrlBarHiding: true,
        showPageTitle: true,
        extraCustomTabs: <String>[
          'org.mozilla.firefox',
          'com.microsoft.emmx',
        ],
      ),
      safariVCOption: const SafariViewControllerOption(
        preferredBarTintColor: Color(0xff000000),
        preferredControlTintColor: Colors.white,
        barCollapsingEnabled: true,
        entersReaderIfAvailable: false,
        dismissButtonStyle: SafariViewControllerDismissButtonStyle.close,
      ),
    );
  } catch (e) {
    print(e.toString());
  }

Screenshot 2022-11-21 101451

I'hv marked it in the above image. The event called when the X button is clicked should be called programmatically.

Hide Appbar

Hi there,
How Can I hide the appbar, and only show the webview.

Cannot build on Mac Mini M1

Project made with Android Studio, had no issues until used this lib.

When use Xcode run button:

fatal error: module map file '/Users/suser/Library/Developer/Xcode/DerivedData/Runner-apowyhreykdokqgcyelbhhgqjexu/Build/Products/Debug-iphonesimulator/flutter_custom_tabs/flutter_custom_tabs.modulemap' not found
1 error generated.

When use Android Studio run button:
error: the following command failed with exit code 0 but produced no further output
CompileC /Users/suser/Library/Developer/Xcode/DerivedData/Runner-apowyhreykdokqgcyelbhhgqjexu/Build/Intermediates.noindex/Pods.build/Release-iphoneos/FMDB.build/Objects-normal/arm64/FMDatabaseQueue.o
/Users/suser/StudioProjects/Mobin/Sources/trunk/ios/Pods/FMDB/src/fmdb/FMDatabaseQueue.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'FMDB' from project 'Pods')

and some warnings

Tried tons of solutions with no luck.

After disabling lib, project run with no problem.

Attempt to invoke virtual method 'boolean java.lang.Boolean.booleanValue()' on a null object reference

The Problem

When I try to open an url with launch I get the following error and the custom tab won't open:

E/MethodChannel#plugins.flutter.droibit.github.io/custom_tabs(14702): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:974)
E/flutter (14702): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: PlatformException(error, Attempt to invoke virtual method 'boolean java.lang.Boolean.booleanValue()' on a null object reference, null, java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Boolean.booleanValue()' on a null object reference
E/flutter (14702): at com.github.droibit.flutter.plugins.customtabs.CustomTabsFactory.createIntent(CustomTabsFactory.java:56)
E/flutter (14702): at com.github.droibit.flutter.plugins.customtabs.CustomTabsPlugin.launch(CustomTabsPlugin.java:92)
E/flutter (14702): at com.github.droibit.flutter.plugins.customtabs.CustomTabsPlugin.onMethodCall(CustomTabsPlugin.java:75)
E/flutter (14702): at #io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
E/flutter (14702): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/flutter (14702): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:818)
E/flutter (14702): at android.os.MessageQueue.nativePollOnce(Native Method)
E/flutter (14702): at android.os.MessageQueue.next(MessageQueue.java:335)
E/flutter (14702): at android.os.Looper.loopOnce(Looper.java:161)
E/flutter (14702): at android.os.Looper.loop(Looper.java:288)
E/flutter (14702): at android.app.ActivityThread.main(ActivityThread.java:7796)
E/flutter (14702): at java.lang.reflect.Method.invoke(Native Method)
E/flutter (14702): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
E/flutter (14702): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:974)
E/flutter (14702): )

Additional Information

The gradle version of my project is 3.5.4. I mention this because in older versions the application is not able to build in release mode.

I call launch without any option parameter values.

Flutter Doctor Output

[✓] Flutter (Channel stable, 2.2.2, on macOS 11.4 20F71 darwin-x64, locale de-AT)
• Flutter version 2.2.2 at /Users/daniellampl/development/src/flutter
• Framework revision d79295af24 (10 days ago), 2021-06-11 08:56:01 -0700
• Engine revision 91c9fc8fe0
• Dart version 2.13.3

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/daniellampl/Library/Android/sdk
• Platform android-30, build-tools 30.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.5, Build version 12E262
• CocoaPods version 1.10.1

[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] IntelliJ IDEA Ultimate Edition (version 2021.1.1)
• IntelliJ at /Applications/IntelliJ IDEA.app
• Flutter plugin version 57.0.5
• Dart plugin version 211.7233

[✓] VS Code (version 1.57.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.23.0

[✓] Connected device (2 available)
• Pixel 5 (mobile) • 0B021FDD4001RX • android-arm64 • Android 11 (API 30)
• Chrome (web) • chrome • web-javascript • Google Chrome 91.0.4472.106

• No issues found!

Incognito Mode

Is there any way I can open the browsers in incognito mode? I don't want to save cache/cookies, preferably on iOS

Target SDK 30 support

Hi, custom tabs is not working in version 0.6.0 when targeting SDK 30, it just launches chrome app. Is there any workaround for that?

Can't open the URL with view-source

I tried to open the URL like view-source:https://www.google.com/ but I can't open the URL its says
" Flutter Custom Tabs only supports URL of http or https scheme."

Then I open the file custom_tabs_launcher.dart and commented on the code
if (url.scheme != 'http' && url.scheme != 'https') { throw PlatformException( code: 'NOT_A_WEB_SCHEME', message: 'Flutter Custom Tabs only supports URL of http or https scheme.', ); }
Then it gives me the error
" PlatformException(LAUNCH_ERROR, No Activity found to handle Intent { act=android.intent.action.VIEW dat=view-source:https://google.com }, null)"

I try to open the URL using the webview_flutter, then it's working fine.

the view-source also works in the chrome browser.

Is there is any way to open that URL by using custom tabs?

MissingPluginException

Hello, im getting this error

(No implementation found for method launch on channel plugins.flutter.droibit.github.io/custom_tabs)

I"am building my project with :
API level 21
minSdkVersion 21
CompileSdkVersion & targetSdkVersion 32
and classpath 'com.android.tools.build:gradle:4.1.0'

Package needs updating

flutter_custom_tabs 0.4.0 depends on url_launcher 0.3.0, because APP_NAME depends on url_launcher 4.0.1 version solving failed.

App crash when using plugin

[FlutterEngine view]: unrecognized selector sent to instance

[✓] Flutter (Channel beta, v0.11.3, on Mac OS X 10.14 18A391, locale fr-FR)
• Flutter version 0.11.3 at /Users/fvisticot/Tools/flutter
• Framework revision 72bf075e8d (6 days ago), 2018-11-09 20:36:17 -0800
• Engine revision 5646e86a6f
• Dart version 2.1.0 (build 2.1.0-dev.9.3 9c07fb64c4)

Custom tabs does not respect default browser

Issue
Custom tabs prioritizes Chrome over the default browser's custom tabs. When setting a default browser with support for custom tabs (e.g., Firefox), triggering custom tabs will attempt to open the custom tab in Chrome. Only when Chrome is disabled, custom tabs will open using the default browser's custom tab.

To reproduce this issue:

  1. Install a browser that is compatible with custom tabs (Firefox)
  2. Set the default browser to the new browser
  3. Trigger custom tab to open
  4. See error

Expected result
Custom tabs should open using the system's default browser if the default browser supports custom tabs.

Notes
This seems to happen both on the latest version 1.2.1 and the latest beta 2.0.0-beta

How to close launched Url in opened browser window ?

you launch url like this. But how do you close it programmatically.

    try {
      await launch(
        'https://flutter.dev',
        customTabsOption: CustomTabsOption(
          toolbarColor: Theme.of(context).primaryColor,
          enableDefaultShare: true,
          enableUrlBarHiding: true,
          showPageTitle: true,
          animation: CustomTabsAnimation.slideIn(),
          // or user defined animation.
          animation: const CustomTabsAnimation(
            startEnter: 'slide_up',
            startExit: 'android:anim/fade_out',
            endEnter: 'android:anim/fade_in',
            endExit: 'slide_down',
          ),
          extraCustomTabs: const <String>[
            // ref. https://play.google.com/store/apps/details?id=org.mozilla.firefox
            'org.mozilla.firefox',
            // ref. https://play.google.com/store/apps/details?id=com.microsoft.emmx
            'com.microsoft.emmx',
          ],
        ),                    
        safariVCOption: SafariViewControllerOption(
          preferredBarTintColor: Theme.of(context).primaryColor,
          preferredControlTintColor: Colors.white,
          barCollapsingEnabled: true,
          entersReaderIfAvailable: false,
          dismissButtonStyle: SafariViewControllerDismissButtonStyle.close,        
        ),
      );
    } catch (e) {
      // An exception is thrown if browser app is not installed on Android device.
      debugPrint(e.toString());
    }
  }
}

Is there a similar package that does this ?
"*Custom Tabs is a feature that works seamlessly with apps and web content,
and requires browsers such as Chrome on Android."

Listen to when custom tabs closes

Is there a way of knowing when the user has selected done or cancel in the chrome tab or better still, is there a way to close the tab manually?

Publish latest

Please update to 0.3.0 and push latest to pub. Currently to get it to work with Flutter 0.6.0, I have to include it as a submodule.

No signature of method

App fails to build.

Launching lib/main.dart on Android SDK built for x86 in debug mode...
lib/main.dart:1

FAILURE: Build failed with an exception.

* Where:
Build file '/home/unknown/.pub-cache/hosted/pub.dartlang.org/flutter_custom_tabs-1.0.3/android/build.gradle' line: 25

* What went wrong:

A problem occurred evaluating project ':flutter_custom_tabs'.
> No signature of method: build_5j3mke80mlase395y1phokujd.android() is applicable for argument types: (build_5j3mke80mlase395y1phokujd$_run_closure2) values: [build_5j3mke80mlase395y1phokujd$_run_closure2@5479451b]

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 636ms
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

package android.support.annotation does not exist

when use flutter_html_view that have dependency with this library, I get error like this:

/Users/anu/app/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_custom_tabs-0.4.0/android/src/main/java/com/github/droibit/flutter/plugins/customtabs/internal/Launcher.java:6: error: package android.support.annotation does not exist
import android.support.annotation.AnimRes;
                                 ^
/Users/anu/app/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_custom_tabs-0.4.0/android/src/main/java/com/github/droibit/flutter/plugins/customtabs/internal/Launcher.java:7: error: package android.support.annotation does not exist
import android.support.annotation.NonNull;
                                 ^
/Users/anu/app/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_custom_tabs-0.4.0/android/src/main/java/com/github/droibit/flutter/plugins/customtabs/internal/Launcher.java:8: error: package android.support.annotation does not exist
import android.support.annotation.Nullable;
                                 ^
/Users/anu/app/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_custom_tabs-0.4.0/android/src/main/java/com/github/droibit/flutter/plugins/customtabs/internal/Launcher.java:9: error: package android.support.annotation does not exist
import android.support.annotation.RestrictTo;
                                 ^
/Users/anu/app/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_custom_tabs-0.4.0/android/src/main/java/com/github/droibit/flutter/plugins/customtabs/internal/Launcher.java:10: error: cannot find symbol
import android.support.customtabs.CustomTabsIntent;
                                 ^
  symbol:   class CustomTabsIntent
  location: package android.support.customtabs
/Users/anu/app/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_custom_tabs-0.4.0/android/src/main/java/com/github/droibit/flutter/plugins/customtabs/internal/Launcher.java:19: error: cannot find symbol
@RestrictTo(RestrictTo.Scope.LIBRARY) public class Launcher {
 ^
  symbol: class RestrictTo
/Users/anu/app/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_custom_tabs-0.4.0/android/src/main/java/com/github/droibit/flutter/plugins/customtabs/internal/Launcher.java:43: error: cannot find symbol
  public CustomTabsIntent buildIntent(@NonNull Map<String, Object> options) {
         ^
  symbol:   class CustomTabsIntent
  location: class Launcher
/Users/anu/app/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_custom_tabs-0.4.0/android/src/main/java/com/github/droibit/flutter/plugins/customtabs/internal/Launcher.java:74: error: package CustomTabsIntent does not exist
  private void applyAnimations(@NonNull CustomTabsIntent.Builder builder,
                                                        ^
/Users/anu/app/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_custom_tabs-0.4.0/android/src/main/java/com/github/droibit/flutter/plugins/customtabs/internal/Launcher.java:107: error: cannot find symbol
      @NonNull CustomTabsIntent customTabsIntent, @Nullable List<String> extraCustomTabs) {
               ^
  symbol:   class CustomTabsIntent
  location: class Launcher
/Users/anu/app/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_custom_tabs-0.4.0/android/src/main/java/com/github/droibit/flutter/plugins/customtabs/CustomTabsPlugin.java:7: error: package android.support.annotation does not exist
import android.support.annotation.NonNull;
                                 ^
/Users/anu/app/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_custom_tabs-0.4.0/android/src/main/java/com/github/droibit/flutter/plugins/customtabs/CustomTabsPlugin.java:8: error: cannot find symbol
import android.support.customtabs.CustomTabsIntent;
                                 ^
  symbol:   class CustomTabsIntent
  location: package android.support.customtabs
/Users/anu/app/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_custom_tabs-0.4.0/android/src/main/java/com/github/droibit/flutter/plugins/customtabs/internal/Launcher.java:38: error: cannot find symbol
  public Launcher(@NonNull Context context) {
                   ^
  symbol:   class NonNull
  location: class Launcher
/Users/anu/app/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_custom_tabs-0.4.0/android/src/main/java/com/github/droibit/flutter/plugins/customtabs/internal/Launcher.java:43: error: cannot find symbol
  public CustomTabsIntent buildIntent(@NonNull Map<String, Object> options) {
                                       ^
  symbol:   class NonNull
  location: class Launcher
/Users/anu/app/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_custom_tabs-0.4.0/android/src/main/java/com/github/droibit/flutter/plugins/customtabs/internal/Launcher.java:42: error: cannot find symbol
  @SuppressWarnings("unchecked") @NonNull
                                  ^
  symbol:   class NonNull
  location: class Launcher
/Users/anu/app/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_custom_tabs-0.4.0/android/src/main/java/com/github/droibit/flutter/plugins/customtabs/internal/Launcher.java:74: error: cannot find symbol
  private void applyAnimations(@NonNull CustomTabsIntent.Builder builder,
                                ^
  symbol:   class NonNull
  location: class Launcher
/Users/anu/app/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_custom_tabs-0.4.0/android/src/main/java/com/github/droibit/flutter/plugins/customtabs/internal/Launcher.java:75: error: cannot find symbol
      @NonNull Map<String, String> animations) {
       ^
  symbol:   class NonNull
  location: class Launcher
/Users/anu/app/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_custom_tabs-0.4.0/android/src/main/java/com/github/droibit/flutter/plugins/customtabs/internal/Launcher.java:98: error: cannot find symbol
  @AnimRes private int resolveAnimationIdentifierIfNeeded(@NonNull String identifier) {
                                                           ^
  symbol:   class NonNull
  location: class Launcher
/Users/anu/app/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_custom_tabs-0.4.0/android/src/main/java/com/github/droibit/flutter/plugins/customtabs/internal/Launcher.java:98: error: cannot find symbol
  @AnimRes private int resolveAnimationIdentifierIfNeeded(@NonNull String identifier) {
   ^
  symbol:   class AnimRes
  location: class Launcher
/Users/anu/app/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_custom_tabs-0.4.0/android/src/main/java/com/github/droibit/flutter/plugins/customtabs/internal/Launcher.java:106: error: cannot find symbol
  public void launch(@NonNull Context context, @NonNull Uri uri,
                      ^
  symbol:   class NonNull
  location: class Launcher
/Users/anu/app/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_custom_tabs-0.4.0/android/src/main/java/com/github/droibit/flutter/plugins/customtabs/internal/Launcher.java:106: error: cannot find symbol
  public void launch(@NonNull Context context, @NonNull Uri uri,
                                                ^
  symbol:   class NonNull
  location: class Launcher
/Users/anu/app/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_custom_tabs-0.4.0/android/src/main/java/com/github/droibit/flutter/plugins/customtabs/internal/Launcher.java:107: error: cannot find symbol
      @NonNull CustomTabsIntent customTabsIntent, @Nullable List<String> extraCustomTabs) {
       ^
  symbol:   class NonNull
  location: class Launcher
/Users/anu/app/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_custom_tabs-0.4.0/android/src/main/java/com/github/droibit/flutter/plugins/customtabs/internal/Launcher.java:107: error: cannot find symbol
      @NonNull CustomTabsIntent customTabsIntent, @Nullable List<String> extraCustomTabs) {
                                                   ^
  symbol:   class Nullable
  location: class Launcher
/Users/anu/app/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_custom_tabs-0.4.0/android/src/main/java/com/github/droibit/flutter/plugins/customtabs/CustomTabsPlugin.java:39: error: cannot find symbol
  private CustomTabsPlugin(@NonNull PluginRegistry.Registrar registrar) {
                            ^
  symbol:   class NonNull
  location: class CustomTabsPlugin
/Users/anu/app/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_custom_tabs-0.4.0/android/src/main/java/com/github/droibit/flutter/plugins/customtabs/CustomTabsPlugin.java:57: error: cannot find symbol
  private void launch(@NonNull Map<String, Object> args, @NonNull MethodChannel.Result result) {
                       ^
  symbol:   class NonNull
  location: class CustomTabsPlugin
/Users/anu/app/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_custom_tabs-0.4.0/android/src/main/java/com/github/droibit/flutter/plugins/customtabs/CustomTabsPlugin.java:57: error: cannot find symbol
  private void launch(@NonNull Map<String, Object> args, @NonNull MethodChannel.Result result) {
                                                          ^
  symbol:   class NonNull
  location: class CustomTabsPlugin
/Users/anu/app/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_custom_tabs-0.4.0/android/src/main/java/com/github/droibit/flutter/plugins/customtabs/internal/Launcher.java:44: error: package CustomTabsIntent does not exist
    final CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
                          ^
/Users/anu/app/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_custom_tabs-0.4.0/android/src/main/java/com/github/droibit/flutter/plugins/customtabs/internal/Launcher.java:44: error: package CustomTabsIntent does not exist
    final CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
                                                                 ^
/Users/anu/app/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_custom_tabs-0.4.0/android/src/main/java/com/github/droibit/flutter/plugins/customtabs/CustomTabsPlugin.java:60: error: cannot find symbol
    final CustomTabsIntent customTabsIntent = launcher.buildIntent(options);
          ^
  symbol:   class CustomTabsIntent
  location: class CustomTabsPlugin
28 errors

FAILURE: Build failed with an exception.

Only works with Chrome

Custom tabs should work with chromium and firefox but this implementation does not.

I'm looking into how this could be fixed.

Launcher.java uses unchecked or unsafe operations.

Hello,
thanks for the good job.

When I try to build the apk with the version 0.6.0 I get the error

Note: /Users/leonardorignanese/.pub-cache/hosted/pub.dartlang.org/flutter_custom_tabs-0.6.0/android/src/main/java/com/github/droibit/flutter/plugins/customtabs/internal/Launcher.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

Why? How can I fix it?

CustomTabsFactory Deprecated

pub.dartlang.org/flutter_custom_tabs-1.0.4/android/src/main/java/com/github/droibit/flutter/plugins/customtabs/CustomTabsFactory.java uses or overrides a deprecated API.

"Cannot find a version of 'androidx.browser:browser' that satisfies the version constraints" when building android app

I integrated flutter_custom_tabs: 2.0.0-beta into my pubspec.yaml. When building for Android I get

> Could not resolve all files for configuration ':app:appdevReleaseCompileClasspath'.
   > Could not resolve androidx.browser:browser:{strictly 1.5.0}.
     Required by:
         project :app > project :flutter_custom_tabs_android
      > Cannot find a version of 'androidx.browser:browser' that satisfies the version constraints:
           Dependency path 'android:app:unspecified' --> 'com.github.droibit.plugins.flutter.customtabs:flutter_custom_tabs_android:1.0-SNAPSHOT' (releaseApiElements) --> 'androidx.browser:browser:{strictly 1.5.0}'
           Dependency path 'android:app:unspecified' --> 'com.github.droibit.plugins.flutter.customtabs:flutter_custom_tabs_android:1.0-SNAPSHOT' (releaseApiElements) --> 'com.github.droibit:customtabslauncher:2.0.0-beta01' (releaseApiElements-published) --> 'androidx.browser:browser:1.6.0'

   > Could not resolve androidx.browser:browser:1.6.0.
     Required by:
         project :app > com.github.droibit:customtabslauncher:2.0.0-beta01
      > Cannot find a version of 'androidx.browser:browser' that satisfies the version constraints:
           Dependency path 'android:app:unspecified' --> 'com.github.droibit.plugins.flutter.customtabs:flutter_custom_tabs_android:1.0-SNAPSHOT' (releaseApiElements) --> 'androidx.browser:browser:{strictly 1.5.0}'
           Dependency path 'android:app:unspecified' --> 'com.github.droibit.plugins.flutter.customtabs:flutter_custom_tabs_android:1.0-SNAPSHOT' (releaseApiElements) --> 'com.github.droibit:customtabslauncher:2.0.0-beta01' (releaseApiElements-published) --> 'androidx.browser:browser:1.6.0'

flutter doctor output below:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.13.9, on macOS 14.0 23A344 darwin-arm64, locale de-DE)
[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.3)
[✓] IntelliJ IDEA Community Edition (version 2023.2.4)
[✓] VS Code (version 1.83.1)
[✓] Connected device (2 available)
    ! Device emulator-5562 is offline.
[✓] Network resources

• No issues found!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.