darwin-morocho / flutter-facebook-auth

A flutter plugin to add login with facebook in your flutter app
193 stars 127 forks source link

Unable to build for Android (Flutter Latest Version) #339

Closed vilorel closed 12 months ago

vilorel commented 1 year ago

What version are you using?

5.0.8

What OS and version are you using to local deploy your application?

macOS 13.3.1

What platforms are you seeing the problem on?

Android

pubspec.yaml

name: voyager
description: our description

# The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1

environment:
  sdk: ">=2.19.6 <3.9.0"

dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter
  animations: ^2.0.7
  audioplayers: ^4.0.1
  cookie_jar: ^3.0.1
  cupertino_icons: ^1.0.5
  crypto: ^3.0.2
  device_info_plus: ^8.1.0
  dio: ^5.1.1
  dio_cache_interceptor: ^3.4.2
  firebase_analytics: ^10.2.1
  firebase_auth: ^4.4.0
  firebase_core: ^2.9.0 # Firebase APIs and SDKs
  firebase_messaging: ^14.4.1
  firebase_storage: ^11.1.1
  flutter_facebook_auth: ^5.0.8
  flutter_lyric: ^2.0.4+6
  flutter_native_splash: ^2.2.14
  flutter_segment: ^3.13.0
  flutter_svg: ^2.0.4
  flutter_dotenv: ^5.0.2
  geolocator: ^9.0.2
  get: ^4.6.5
  get_storage: ^2.0.3
  google_fonts: ^4.0.0
  google_sign_in: ^6.0.2
  health: ^6.0.0
  intl: ^0.17.0
  js: ^0.6.5
  lottie: ^2.0.0
  rive: ^0.10.3
  mixpanel_flutter: ^2.0.0
  package_info_plus: ^3.0.2
  path_drawing: ^1.0.1
  path_provider: ^2.0.11
  permission_handler: ^10.2.0
  sentry_flutter: ^7.4.0
  sign_in_with_apple: ^4.2.0
  vector_math: ^2.1.4
  url_launcher: ^6.1.10

#dependency_overrides:

dev_dependencies:
  flutter_lints: ^2.0.1
  flutter_test:
    sdk: flutter
  dio_http_formatter: ^3.1.0

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter.
flutter:
  #this is for internationalization
  generate: true

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  # To add assets to your application, add an assets section, like this:
  assets:
    - app-config.env
    - assets/

Describe the Bug

./gradlew build
Starting a Gradle Daemon (subsequent builds will be faster)

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':flutter_facebook_auth'.
> The 'java' plugin has been applied, but it is not compatible with the Android plugins.

* 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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.6.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 18s

Expected Behavior

To compile without problems.

To Reproduce

Just download the latest version of flutter, this plugin and try to build for android. The same error occured with the firebase packages too but the most recent version that was pushed out fixed the issue.

Relevant log output

No response

flutter doctor -v

flutter doctor -v
[✓] Flutter (Channel stable, 3.7.12, on macOS 13.3.1 22E772610a darwin-arm64, locale en-US)
    • Flutter version 3.7.12 on channel stable at /Users/voyager/Documents/Applications/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 4d9e56e694 (2 weeks ago), 2023-04-17 21:47:46 -0400
    • Engine revision 1a65d409c7
    • Dart version 2.19.6
    • DevTools version 2.20.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/voyager/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E222b
    • CocoaPods version 1.11.3

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

[✓] Android Studio (version 2022.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 11.0.15+0-b2043.56-8887301)

[✓] IntelliJ IDEA Ultimate Edition (version 2023.1.1)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin version 73.0.4
    • Dart plugin version 231.8770.15

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-arm64   • macOS 13.3.1 22E772610a darwin-arm64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 112.0.5615.137

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

Info.plist (iOS)

No response

Podfile (iOS)

No response

AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.voyager">
   <application
        android:label="voyager"
        android:name="${applicationName}"
        android:icon="@mipmap/ic_launcher">
        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <!-- Specifies an Android theme to apply to this Activity as soon as
                 the Android process has started. This theme is visible to the user
                 while the Flutter UI initializes. After that, this theme continues
                 to determine the Window background behind the Flutter UI. -->
            <meta-data
              android:name="io.flutter.embedding.android.NormalTheme"
              android:resource="@style/NormalTheme"
              />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <!-- Don't delete the meta-data below.
             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
    </application>
</manifest>

MainActivity.java

package com.example.voyager

import io.flutter.embedding.android.FlutterActivity

class MainActivity: FlutterActivity() {
}

MainActivity.kt

No response

index.html

No response

Info.plist (macOS)

No response

darwin-morocho commented 1 year ago

@vilorel I have tried to reproduce the issue without success. It seems to be a problem with your gradle version.

Go to/android/gradle/wrapper/gradle-wrapper.properties and try to use distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip

vilorel commented 1 year ago

@darwin-morocho thank you for the swift response. I followed your advice and downgraded my gradle from 7.6.1 to 7.5 but I get the same error. Any other clues as to what might be causing this?

darwin-morocho commented 1 year ago

Maybe your android/build.gradle is wrong please check the example https://github.com/darwin-morocho/flutter-facebook-auth/blob/master/examples/with_provider/android/build.gradle

darwin-morocho commented 1 year ago

Please try to tun the example https://github.com/darwin-morocho/flutter-facebook-auth/tree/master/examples/with_provider and let me know if you still are not able to compile the project

Also you can try running flutter clean if this does not work you can try cleaning the Gradle cache on Android

vilorel commented 1 year ago

I tried the above example on my macOS and Ubuntu. The latter is building find on Ubuntu but macOS faces the same issue (which appears to be connected to gradle somehow). I tried using both the wrapper itself and installing a wrapper via the gradle command. Both failed with the above error showing up.

darwin-morocho commented 1 year ago

@vilorel could you try with flutter_facebook_auth 5.0.10 ?

vilorel commented 12 months ago

@darwin-morocho I tried it with flutter_facebook_auth 5.0.11, and the issue has been addressed. Unfortunately, I made several changes to address some other issues too, and I'm not entirely sure if the version upgrade alone or the combination of changes delivered the fix. In any case, I'm glad it's working nicely now. We can close this ticket, and thank you for your help!