App stürzt auf Android-API weniger als 5.0(lollipop)

Das problem, das ich konfrontiert ist, dass mein android-Anwendung funktioniert gut auf Geräten mit API 5.0 und höher, aber immer noch Abstürze auf Geräten mit Kitkat(4.4) und der entsprechenden niedrigeren Versionen.Ich weiß, dass Ihr irgendwie mit den build-tools in meinem gradle-Datei,aber noch nicht in der Lage, um das problem herauszufinden.Könnte jemand bitte helfen Sie mir mit diesem.

Dies ist mein gradle-Datei,

     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'
apply plugin: 'android'

repositories {
    maven { url 'https://maven.fabric.io/public' }
    maven { url 'http://clinker.47deg.com/nexus/content/groups/public' }
}


android {
    compileSdkVersion 22
    buildToolsVersion '22.0.1'

    defaultConfig {
        applicationId "com.abc.example"
        minSdkVersion 10
        targetSdkVersion 22
        multiDexEnabled true
        versionCode 12
        versionName "1.0"
    }
    buildTypes {
        release {
            multiDexEnabled true
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    android {
        packagingOptions {
            exclude 'META-INF/LICENSE'
        }
    }
    android {
        packagingOptions {
            exclude 'META-INF/NOTICE'
        }
    }
}



dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:22.2.0'
    compile('com.fortysevendeg.swipelistview:swipelistview:1.0-SNAPSHOT@aar') {
        transitive = true
        exclude module: 'httpclient'
        exclude group: 'httpclient'
    }

    compile 'com.squareup.retrofit:retrofit:1.9.0'
    compile 'com.squareup.okhttp:mockwebserver:2.3.0'
    compile 'de.hdodenhof:circleimageview:1.2.2'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.google.android.gms:play-services-maps:7.5.0'
    compile files('libs/bitlyj-2.0.0.jar')

}

Auch immer diese Fehlermeldung, wenn das Projekt gebaut wird,

Caused by: java.lang.NoClassDefFoundError: com.package.R$styleable
            at com.package.widgets.StyleableTextView.<init>(StyleableTextView.java:23)

Dies ist StyleableTextView Klasse,

public class StyleableTextView extends TextView {

    public StyleableTextView(Context context) {
        super(context);
    }

    public StyleableTextView(Context context, AttributeSet attrs) {
        super(context.getApplicationContext(), attrs);
        UiUtil.setCustomFont(StyleableTextView.this, context, attrs,
                R.styleable.com_eywa_wonk_widgets_StyleableTextView,
                R.styleable.com_eywa_wonk_widgets_StyleableTextView_font);
    }

    public StyleableTextView(Context context, AttributeSet attrs, int defStyle) {
        super(context.getApplicationContext(), attrs, defStyle);
        UiUtil.setCustomFont(StyleableTextView.this, context, attrs,
                R.styleable.com_eywa_wonk_widgets_StyleableTextView,
                R.styleable.com_eywa_wonk_widgets_StyleableTextView_font);
    }

}

Dies ist die styleable in attrs,

<resources>

    <attr name="font" format="string" />

<declare-styleable name="com.package.widgets.StyleableTextView">
        <attr name="font" />

    </declare-styleable>

</resources>
Können Sie genauere Angaben über den Fehler ? Poste den StackTrace
Ja sicher.Ich habe erstellt eine benutzerdefinierte styleable für eine benutzerdefinierte textview in meinem attrs Datei in "Werte" - Ordner.Die styleable wird erkannt bei Geräten mit 5.0, aber in Geräte mit API 4.4 und weniger, Sie sagt, nicht finden können, die benutzerdefinierte TextView in Ihrer app zusammen mit der <declare-styleable /> - Fehler und ich bin mir ziemlich sicher ich haben verwendet es als "com.Paket.CustomTextView"
Nicht die Werte, die Ordner haben eine version counter? Wie /Werte-v22? Wenn dem so ist, werden Sie brauchen, um etwas für andere Versionen, oder fügen Sie die benutzerdefinierte styleable nur für die Lollipop-Geräte.
Nein, es muss nicht eine version counter..
Ich habe aktualisiert die post mit Ihren Fehler-stack.Bitte haben Sie einen Blick.

InformationsquelleAutor Android solutions | 2015-09-01

Schreibe einen Kommentar