2

当我将数字作为单个模块运行时..它运行良好。但是当我将它与我的主要项目整合时,它会给出 inflateException。

这个异常的原因可能是什么。

当我单击“不使用我的手机”(按钮)时出现此异常 单击此处查看按钮

这是我的日志文件

03-29 02:01:31.308 2906-2906/earn.free.cashback.snapcash E/AndroidRuntime: FATAL EXCEPTION: main
                                                                       Process: earn.free.cashback.snapcash, PID: 2906
                                                                       java.lang.RuntimeException: Unable to start activity ComponentInfo{earn.free.cashback.snapcash/com.digits.sdk.android.PhoneNumberActivity}: android.view.InflateException: Binary XML file line #65: Error inflating class com.digits.sdk.android.StateButton
                                                                           at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
                                                                           at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
                                                                           at android.app.ActivityThread.access$800(ActivityThread.java:144)
                                                                           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
                                                                           at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                           at android.os.Looper.loop(Looper.java:135)
                                                                           at android.app.ActivityThread.main(ActivityThread.java:5221)
                                                                           at java.lang.reflect.Method.invoke(Native Method)
                                                                           at java.lang.reflect.Method.invoke(Method.java:372)
                                                                           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
                                                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
                                                                        Caused by: android.view.InflateException: Binary XML file line #65: Error inflating class com.digits.sdk.android.StateButton
                                                                           at android.view.LayoutInflater.createView(LayoutInflater.java:633)
                                                                           at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)
                                                                           at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
                                                                           at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
                                                                           at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
                                                                           at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
                                                                           at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
                                                                           at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:377)
                                                                           at android.app.Activity.setContentView(Activity.java:2144)
                                                                           at com.digits.sdk.android.DigitsActivity.onCreate(DigitsActivity.java:41)
                                                                           at android.app.Activity.performCreate(Activity.java:5933)
                                                                           at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
                                                                           at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
                                                                           at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360) 
                                                                           at android.app.ActivityThread.access$800(ActivityThread.java:144) 
                                                                           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278) 
                                                                           at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                           at android.os.Looper.loop(Looper.java:135) 
                                                                           at android.app.ActivityThread.main(ActivityThread.java:5221) 
                                                                           at java.lang.reflect.Method.invoke(Native Method) 
                                                                           at java.lang.reflect.Method.invoke(Method.java:372) 
                                                                           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) 
                                                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694) 
                                                                        Caused by: java.lang.reflect.InvocationTargetException
                                                                           at java.lang.reflect.Constructor.newInstance(Native Method)
                                                                           at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
                                                                           at android.view.LayoutInflater.createView(LayoutInflater.java:607)
                                                                           at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743) 
                                                                           at android.view.LayoutInflater.rInflate(LayoutInflater.java:806) 
                                                                           at android.view.LayoutInflater.rInflate(LayoutInflater.java:809) 
                                                                           at android.view.LayoutInflater.inflate(LayoutInflater.java:504) 
                                                                           at android.view.LayoutInflater.inflate(LayoutInflater.java:414) 
                                                                           at android.view.LayoutInflater.inflate(LayoutInflater.java:365) 
                                                                           at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:377) 
                                                                           at android.app.Activity.setContentView(Activity.java:2144) 
                                                                           at com.digits.sdk.android.DigitsActivity.onCreate(DigitsActivity.java:41) 
                                                                           at android.app.Activity.performCreate(Activity.java:5933) 
                                                                           at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105) 
                                                                           at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251) 
                                                                           at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360) 
                                                                           at android.app.ActivityThread.access$800(ActivityThread.java:144) 
                                                                           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278) 
                                                                           at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                           at android.os.Looper.loop(Looper.java:135) 
                                                                           at android.app.ActivityThread.main(ActivityThread.java:5221) 
                                                                           at java.lang.reflect.Method.invoke(Native Method) 
                                                                           at java.lang.reflect.Method.invoke(Method.java:372) 
                                                                           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) 
                                                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694) 
                                                                        Caused by: android.view.InflateException: Binary XML file line #24: Error inflating class <unknown>
                                                                           at android.view.LayoutInflater.createView(LayoutInflater.java:633)
                                                                           at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)
                                                                           at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682)
                                                                           at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741)
                                                                           at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
                                                                           at android.view.LayoutInflater.inflate(LayoutInflater.java:479)
                                                                           at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
                                                                           at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
                                                                           at android.view.View.inflate(View.java:18415)
                                                                           at com.digits.sdk.android.StateButton.initView(StateButton.java:101)
                                                                           at com.digits.sdk.android.StateButton.initAttrs(StateButton.java:62)
                                                                           at com.digits.sdk.android.StateButton.<init>(StateButton.java:52)
                                                                           at com.digits.sdk.android.StateButton.<init>(StateButton.java:47)
                                                                           at java.lang.reflect.Constructor.newInstance(Native Method) 
                                                                           at java.lang.reflect.Constructor.newInstance(Constructor.java:288) 
                                                                           at android.view.LayoutInflater.createView(LayoutInflater.java:607) 
                                                                           at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743) 
                                                                           at android.view.LayoutInflater.rInflate(LayoutInflater.java:806) 
                                                                           at android.view.LayoutInflater.rInflate(LayoutInflater.java:809) 
                                                                           at android.view.LayoutInflater.inflate(LayoutInflater.java:504) 
                                                                           at android.view.LayoutInflater.inflate(LayoutInflater.java:414) 
                                                                           at android.view.LayoutInflater.inflate(LayoutInflater.java:365) 
                                                                           at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:377) 
                                                                           at android.app.Activity.setContentView(Activity.java:2144) 
                                                                           at com.digits.sdk.android.DigitsActivity.onCreate(DigitsActivity.java:41) 
                                                                           at android.app.Activity.performCreate(Activity.java:5933) 
                                                                           at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105) 
                                                                           at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251) 
                                                                           at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360) 
                                                                           at android.app.ActivityThread.access$800(ActivityThread.java:144) 
                                                                           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278) 
                                                                           at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                           at android.os.Looper.loop(Looper.java:135) 
                                                                           at android.app.ActivityThread.main(ActivityThread.java:5221) 
                                                                           at java.lang.reflect.Method.invoke(Native Method) 
                                                                           at java.lang.reflect.Method.invoke(Method.java:372) 
                                                                           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) 
                                                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694) 
                                                                        Caused by: java.lang.reflect.InvocationTargetException
                                                                           at java.lang.reflect.Constructor.newInstance(Native Method)
                                                                           at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
                                                                           at android.view.LayoutInflater.createView(LayoutInflater.java:607)
                                                                           at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55) 
                                                                           at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682) 
                                                                           at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741) 
                                                                           at android.view.LayoutInflater.rInflate(LayoutInflater.java:806) 
                                                                           at android.view.LayoutInflater.inflate(LayoutInflater.java:479) 
                                                                           at android.view.LayoutInflater.inflate(LayoutInflater.java:414) 
                                                                           at android.view.LayoutInflater.inflate(LayoutInflater.java:365) 
                                                                           at android.view.View.inflate(View.java:18415) 
                                                                           at com.digits.sdk.android.StateButton.initView(StateButton.java:101) 
                                                                           at com.digits.sdk.android.StateButton.initAttrs(StateButton.java:62) 
                                                                           at com.digits.sdk.android.StateButton.<init>(StateButton.java:52) 
                                                                           at com.digits.sdk.android.StateButton.<init>(StateButton.java:47) 
                                                                           at java.lang.reflect.Constructor.newInstance(Native Method) 
                                                                           at java.lang.reflect.Constructor.newInstance(Constructor.java:288) 
                                                                           at android.view.LayoutInflater.createView(LayoutInflater.java:607) 
                                                                           at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743) 
                                                                           at android.view.LayoutInflater.rInflate(LayoutInflater.java:806) 
                                                                           at android.view.LayoutInflater.rInflate(LayoutInflater.java:809) 
                                                                           at android.view.LayoutInflater.inflate(LayoutInflater.java:504) 
                                                                           at android.view.LayoutInflater.inflate(LayoutInflater.java:414) 
                                                                           at android.view.LayoutInflater.inflate(LayoutInflater.java:365) 
                                                                           at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:377) 
                                                                           at android.app.Activity.setContentView(Activity.java:2144) 
                                                                           at com.digits.sdk.android.DigitsActivity.onCreate(DigitsActivity.java:41) 
                                                                           at android.app.Activity.performCreate(Activity.java:5933) 
                                                                           at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105) 
                                                                           at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251) 
                                                                           at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360) 
                                                                           at android.app.ActivityThread.access$800(ActivityThread.java:144) 
                                                                           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278) 
                                                                           at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                           at android.os.Looper.loop(Looper.java:135) 
                                                                           at android.app.ActivityThread.main(ActivityThread.java:5221) 
                                                                           at java.lang.reflect.Method.invoke(Native Method) 
                                                                           at java.lang.reflect.Method.invoke(Method.java:372) 
                                                                           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) 
                                                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694) 
                                                                        Caused by: java.lang.ArrayIndexOutOfBoundsException: length=20; index=718
                                                                           at android.content.res.StringBlock.get(StringBlock.java:65)
                                                                           at android.content.res.XmlBlock$Parser.getPooledString(XmlBlock.java:458)
                                                                           at android.content.res.TypedArray.loadStringValueAt(TypedArray.java:967)
                                                                           at android.content.res.TypedArray.getString(TypedArray.java:176)
                                                                           at android.widget.TextView.<init>(TextView.java:1011)
                                                                        at android.widget.TextView.<init
03-29 02:01:33.595 2906-2906/? I/Process: Sending signal. PID: 2906 SIG: 9

这是我的 jAVA 文件

package earn.free.cashback.snapcash;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.telephony.TelephonyManager;
import android.util.Log;
import android.widget.Toast;

import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;

import com.digits.sdk.android.AuthCallback;
import com.digits.sdk.android.Digits; 
import com.digits.sdk.android.DigitsAuthButton;
import com.digits.sdk.android.DigitsException;
import com.digits.sdk.android.DigitsSession;
import com.twitter.sdk.android.core.TwitterAuthConfig;
import com.twitter.sdk.android.core.TwitterCore;
import io.fabric.sdk.android.Fabric;
import java.util.HashMap;
import java.util.Map;
import com.android.volley.toolbox.StringRequest;


public class SplashActivity extends AppCompatActivity {

// Note: Your consumer key and secret should be obfuscated in your source code before shipping.
private static final String TWITTER_KEY = "HkVPREzxYhw8YKBjFq2sTy3ZJ";
private static final String TWITTER_SECRET = "k57a32hiSSpqMBtaVW6k3MVtSrGWColKNuRryijyg8Jbal2prC";


private static final String IMEI_URL = "http://ec2-54-191-118-200.us-west-2.compute.amazonaws.com/detail.php";
public static final String KEY_DEVICEID = "device";
// Splash screen timer
private static int SPLASH_TIME_OUT = 3000;
SharedPreferences sp;


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    TwitterAuthConfig authConfig = new TwitterAuthConfig(TWITTER_KEY, TWITTER_SECRET);
    Fabric.with(this, new TwitterCore(authConfig), new Digits());
    setContentView(R.layout.activity_splash);
    getSupportActionBar().hide();
    DigitsAuthButton digitsButton = (DigitsAuthButton) findViewById(R.id.auth_button);
    digitsButton.setCallback(new AuthCallback() {
        @Override
        public void success(DigitsSession session, String phoneNumber) {
            // TODO: associate the session userID with your user model
            Toast.makeText(getApplicationContext(), "Authentication successful for "
                    + phoneNumber, Toast.LENGTH_LONG).show();
        }

        @Override
        public void failure(DigitsException exception) {
            Log.d("Digits", "Sign in with Digits failure", exception);
        }
    });

}

}

这是我的 xml 文件

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"

    android:gravity="center"
    tools:context="earn.free.cashback.snapcash">

  <com.digits.sdk.android.DigitsAuthButton
      android:id="@+id/auth_button"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content" />

</RelativeLayout>

构建.gradle

 buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}


android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"



    defaultConfig {
        applicationId "earn.free.cashback.snapcash"
        minSdkVersion 17
        targetSdkVersion 23
        versionCode 10
        versionName "1.0.1.8"

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
        transitive = true;

}

compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
compile 'com.android.support:recyclerview-v7:23.2.1'
compile 'com.android.support:cardview-v7:23.2.1'
compile 'de.hdodenhof:circleimageview:1.2.1'
compile 'com.squareup.retrofit2:retrofit:2.0.0-beta4'
compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta4'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'io.branch.sdk.android:library:1.10.8'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'com.github.traex.rippleeffect:library:1.3'
compile 'com.android.support:support-v4:23.2.1'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.weiwangcn.betterspinner:library-material:1.1.0'

}

4

2 回答 2

1

twitter 的数字不支持 2.0.0 以上的改造,因此您可以等待支持发布或尝试使用低于 2.0.0 版本的改造库。:) 这应该够了吧。

于 2016-04-07T20:10:18.003 回答
1

我有同样的错误,我终于解决了删除:

<item name="android:fontFamily">sans-serif-light</item> 

来自我在 res/styles.xml 中的 AppTheme。

希望它可以帮助你。

于 2016-12-30T14:18:23.623 回答