无法使用 Facebook Account Kit:错误膨胀类 com.facebook.accountkit.ui.ConstrainedLinearLayout

2024-02-27

我正在尝试集成 Facebook AccountKit 以允许用户使用他们的电子邮件或电话号码进行注册。但是,当启动 AccountKitActivity 时,应用程序崩溃,因为它无法膨胀“ConstrainedLayout”。

错误信息 :

java.lang.RuntimeException: Unable to start activity
android.view.InflateException: Binary XML file line #45: 
Error inflating class com.facebook.accountkit.ui.ConstrainedLinearLayout

以及下面:

Caused by: java.lang.UnsupportedOperationException: 
   Failed to resolve attribute at index 12: 
   TypedValue{t=0x3/d=0x512 "res/drawable/scrollbar_handle_material.xml" a=1 r=0x10805cd}

我在我的 gradle 中使用:

compile 'com.facebook.android:facebook-android-sdk:4.11.0'
compile 'com.facebook.android:account-kit-sdk:4.11.0'

我在尝试启动 AccountKitActivity 之前调用 AccountKit.initialize() 。

我的简单登录活动由两个按钮组成:

public class LoginActivity extends Activity implements View.OnClickListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
        Button buttonSMS = (Button) findViewById(R.id.buttonSignInSms);
        Button buttonEmail = (Button) findViewById(R.id.buttonSignInEmail);

        buttonSMS.setOnClickListener(this);
        buttonEmail.setOnClickListener(this);
    }

    public static int APP_REQUEST_CODE = 42;

    public void onLoginPhone(final View view) {
        final Intent intent = new Intent(this, AccountKitActivity.class);
        AccountKitConfiguration.AccountKitConfigurationBuilder configurationBuilder =
                new AccountKitConfiguration.AccountKitConfigurationBuilder(
                        LoginType.PHONE,
                        AccountKitActivity.ResponseType.CODE); // or .ResponseType.TOKEN
        // ... perform additional configuration ...
        intent.putExtra(
                AccountKitActivity.ACCOUNT_KIT_ACTIVITY_CONFIGURATION,
                configurationBuilder.build());
        startActivityForResult(intent, APP_REQUEST_CODE);
    }

    public void onLoginEmail(final View view) {
        final Intent intent = new Intent(this, AccountKitActivity.class);
        AccountKitConfiguration.AccountKitConfigurationBuilder configurationBuilder =
                new AccountKitConfiguration.AccountKitConfigurationBuilder(
                        LoginType.EMAIL,
                        AccountKitActivity.ResponseType.CODE); // or .ResponseType.TOKEN
        // ... perform additional configuration ...
        intent.putExtra(
                AccountKitActivity.ACCOUNT_KIT_ACTIVITY_CONFIGURATION,
                configurationBuilder.build());
        startActivityForResult(intent, APP_REQUEST_CODE);
    }


    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.buttonSignInSms : {
                onLoginPhone(v);
                break;
            }
            case R.id.buttonSignInEmail : {
                onLoginEmail(v);
                break;
            }
        }
    }
}

有人出主意吗?


我今天在集成 Account Kit 时遇到了完全相同的问题。他们的文档对此没有明确说明,但您需要将 AppLoginTheme 添加到您的 theme.xml 中:

<style name="AppLoginTheme" parent="Theme.AccountKit" />

另一种可能的解决方案是删除清单中 AccountKitActivity 的主题覆盖,如下所示:

...
<activity android:name="com.facebook.accountkit.ui.AccountKitActivity" />
...
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

无法使用 Facebook Account Kit:错误膨胀类 com.facebook.accountkit.ui.ConstrainedLinearLayout 的相关文章

  • 自定义相机预览问题(拉伸)

    我的相机应用程序出现问题 我的应用程序有 1 CameraActivity class和 2 CameraPreview class CameraPreview实施一个surfaceView它是从哪里调用的CameraActivity以进行
  • Android:直接截屏到字节 - 跳过保存到文件

    我使用以下代码在 root 设备上截取屏幕截图 sh Runtime getRuntime exec su null null os sh getOutputStream os write system bin screencap p sd
  • IllegalStateException:预期配置 ':module:debugFeatureCompileClasspath' 仅包含一个文件,但是,它包含 2 个文件

    我正在使用带有即时应用程序和穿戴应用程序的多功能Android应用程序 在这里我能够成功运行我的应用程序但在期间出现以下错误构建 APK 或重建项目 java lang IllegalStateException Expected conf
  • ANDROID:Webview 和 httpclient 之间共享会话

    我的 WebView 中实际上有一个记录的会话 但我也使用 httpclient 从网络发送和获取数据 我在互联网上看到不可能获取WebView的内容 所以我需要使用我的httpclient从Web服务获取数据 问题是这个Web服务使用会话
  • 使用 API 8 及以上版本获取用户/所有者个人资料联系人 URI 和用户图像

    从 API 14 Android 4 0 起 开始我可以使用ContactsContract Profile CONTENT URI得到手机所有者的联系个人资料 Uri 并通过该信息获取他们的头像 联系照片 我想知道如何从 API 8 An
  • 如何使用 Gson 跳过空条目

    使用 Gson 反序列化 JSON 时 有没有办法跳过 JSON 数组中的空条目 text adsfsd title asdfsd null text adsfsd title asdfsd 生成的 List 有 3 个条目 第二个条目为空
  • Android问题:Eclipse找不到ADB.exe

    首先 我知道这个问题之前已经被问过 即 在我的工具文件夹中找不到 adb exe https stackoverflow com questions 4659014 could not find adb exe on my tools fo
  • Android模拟器收不到推送通知

    我在谷歌云上使用推送通知 但是由于某种原因我无法在模拟器上接收推送通知 然而 当我在真实设备上测试时 同一个应用程序确实会收到通知 有其他人遇到过这个问题或找到解决方案吗 模拟设备具有网络访问权限 并且与真实设备具有相同的 Android
  • 如何在 jetpack compose 中预览对话框?

    我有这个代码 Composable fun SomeDialog Dialog onDismissRequest properties DialogProperties Preview showBackground true Composa
  • 在 Android Webview 中加载 Angular JS 网站的问题

    大家好我正在尝试加载GTV http gtvqa com Android WebView 中 它在移动浏览器中加载得很好 但在 webview 中则不行 这是我的代码 WebView theWebPage new WebView this
  • 如何将点击事件从片段传递到容器活动?

    我正在实现一个导航抽屉活动 其中导航抽屉中有一个片段 由回收器视图组成 可以动态地将项目添加到导航抽屉 我已经成功实现了这个概念 但面临一个小问题 即当我单击片段中的任何项目时 导航抽屉不会关闭 这是因为我无法从片段访问 DrawerLay
  • 改造2:使用json对象发送文件

    我在请求正文中发送对象 如下所示 title test description test images POST create data Call
  • 如何从代码中检测 Android 设备上的双核 cpu?

    我遇到了一个似乎仅影响双核的问题Android设备运行Android 2 3 姜饼 或更大 我想就这个问题进行一次对话 但仅限于符合该标准的用户 我知道如何检查OS级别 但还没有找到任何可以明确告诉我该设备正在使用多核的信息 有任何想法吗
  • Android Studio 上的 Twitter Kit Fabric Android 模块库

    我在使用适用于 Android 的 Twitter Kit SDK 时遇到问题 我需要将 Twitter Kit SDK 导入到我的项目中的库 模块 我正在使用 Android Studio 我正在使用适用于 Android 的 Fabri
  • 在 RadioButton 旁边添加 EditText

    我有一个习惯DialogPreference我想在其中有一个子类RadioGroup与三个单选按钮 前两个是香草RadioButton带有标题的组件 但对于第三个我想放置一个EditText直接在它的右侧 这样当选择该按钮时我可以输入自定义
  • 注意通知持续时间

    是否可以将抬头通知的持续时间设置为无限 现在它只显示 5 秒 已经尝试过不同的事情 例如更改类别 但持续时间始终为 5 秒 这是我的代码 Notification notification notificationBuilder setCa
  • 如何在屏幕上拖动图像

    谁能帮助我如何为可以在屏幕上拖动的图像编写程序 你能给我一个示例代码吗 多谢 我怎样才能为它制作游戏得分 我将感谢您的回复 imageView setOnLongClickListener new OnLongClickListener p
  • 如何在android中创建nanohttpd服务器?

    其实我也查过一些问题 然后去github上找了一下 但我是新来的 我无法理解这个例子 我想在android中创建http服务器 这样我就可以在PC浏览器中访问它 我有一个类扩展 nanohttpd 的实例 但服务器无法工作 不知道为什么 我
  • Android - 下载 JSON 数据并保存到共享首选项

    我正在从 PHP 服务读取 JSON 数据 每当该 JSON 的版本发生变化时 我想将其存储在 Android 上 用新数据替换旧数据 JSON 仅用于填充 Spinner 我的问题是 JSON 有 36KB 可以将其存储在共享首选项中有一
  • 如何解决“布局有超过 80 个视图,对性能不利”?

    我正在做一个有点复杂的布局 只是我无法修复 LINT 指示的错误 黑莓浏览次数超过 80 对性能不利 这是布局

随机推荐