Das Problem, mit dem ich konfrontiert ist, dass meine Android-Anwendung funktioniert gut auf Geräten mit API 5.0 und höher, aber stürzt auf Geräte mit Kitkat (4.4) und die entsprechenden niedrigeren Versionen.Ich weiß dass es irgendwie mit den Build-Tools in meiner Gradle-Datei zusammenhängt, aber immer noch nicht in der Lage ist, das Problem herauszufinden. Könnte mir bitte jemand dabei helfen.App Absturz auf Android API weniger als 5.0 (Lollipop)
Das 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:[email protected]') {
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 diesen Fehler beim Projekt
gebautCaused by: java.lang.NoClassDefFoundError: com.package.R$styleable
at com.package.widgets.StyleableTextView.<init>(StyleableTextView.java:23)
Dies wird 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 genauer über den Fehler sein? Post the stack trace – forcewill
Ja sicher.Ich habe ein benutzerdefiniertes Format für eine benutzerdefinierte Textansicht in meiner Attrs-Datei im Ordner "values" erstellt. Das Stilable wird in Geräten mit 5.0 erkannt, aber in Geräten mit API 4.4 und weniger, es sagt, kann die benutzerdefinierte TextView in Ihrer App zusammen mit dem Fehler nicht finden und ich bin ziemlich sicher, ich habe es als "com.package.CustomTextView" verwendet –
Hat der Werte-Ordner einen Versionszähler ? Wie/Werte-v22? Wenn dies der Fall ist, müssen Sie etwas für andere Versionen erstellen oder das benutzerdefinierte Styleable nur für Lollipop-Geräte hinzufügen. – Knossos