gpt4 book ai didi

android - 无法使用 Facebook 帐户工具包 : Error inflating class com. facebook.accountkit.ui.ConstrainedLinearLayout

转载 作者:可可西里 更新时间:2023-11-01 18:53:17 25 4
gpt4 key购买 nike

我正在尝试集成 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()。

我的简单登录 Activity ,由两个按钮组成:

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 添加到您的 themes.xml 中:

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

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

...
<activity android:name="com.facebook.accountkit.ui.AccountKitActivity" />
...

关于android - 无法使用 Facebook 帐户工具包 : Error inflating class com. facebook.accountkit.ui.ConstrainedLinearLayout,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36718119/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com