在flutter项目中添加Facebook登录后出现“请配置Android SDK”错误

问题描述 投票:0回答:1

我正在开发一个使用 firebase 和 Facebook 登录的 flutter 应用程序。

添加 Firebase 身份验证后,我的应用程序运行良好。但在我添加 Facebook 登录后,我无法再构建该项目。控制台显示“已完成,但出现错误:Gradle 任务 assembleDebug 失败,退出代码为 1”。

当我检查 logcat 时,它告诉我“请配置 android SDK”。

当我点击它时,会出现下图

android sdk configuration

这是我的 AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.flutter_bloc_test_project">

    <!-- io.flutter.app.FlutterApplication is an android.app.Application that
         calls FlutterMain.startInitialization(this); in its onCreate method.
         In most cases you can leave this as-is, but you if you want to provide
         additional functionality it is fine to subclass or reimplement
         FlutterApplication and put your custom class here. -->
    <application
        android:name="io.flutter.app.FlutterApplication"
        android:label="flutter_bloc_test_project"
        android:icon="@mipmap/ic_launcher">
        <meta-data android:name="com.facebook.sdk.ApplicationId"
            android:value="@string/facebook_app_id"/>

        <activity android:name="com.facebook.FacebookActivity"
            android:configChanges=
                "keyboard|keyboardHidden|screenLayout|screenSize|orientation"
            android:label="@string/app_name" />
        <activity
            android:name="com.facebook.CustomTabActivity"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="@string/fb_login_protocol_scheme" />
            </intent-filter>
        </activity>

        <activity
            android:name=".MainActivity"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <!-- This keeps the window background of the activity showing
                 until Flutter renders its first frame. It can be removed if
                 there is no splash screen (such as the default splash screen
                 defined in @style/LaunchTheme). -->
            <meta-data
                android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
                android:value="true" />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
    </application>

    <uses-permission android:name="android.permission.INTERNET"/>

</manifest>

我尝试过降级gradle版本之类的方法。但 firebase 无法在低版本上工作,这就是为什么我必须首先升级。

请帮忙

android android-studio flutter facebook-login android-sdk-manager
1个回答
0
投票

一个可能的问题可能是最近添加的插件可能未按预期建立。您在这里可以做的是运行

flutter clean
flutter pub get
来重建添加的包。

如果问题仍然存在,则问题可能是由 Android Studio 中配置的 Flutter 插件引起的。尝试运行

File > Invalidate Caches...
并重新启动 Android Studio 以刷新配置集。

© www.soinside.com 2019 - 2024. All rights reserved.