私のアプリは自分の携帯電話で完全に動作します。一部の古いデバイスでは、それはしかしクラッシュ:古いデバイスでAndroidアプリがクラッシュする
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.blub.bla/com.blub.bla.MainActivity}: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class ImageButton
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2572)
...
Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class ImageButton
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:782)
at
...
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/ic_google_plus_icon.xml from drawable resource ID #0x7f0700ab
at android.content.res.Resources.loadDrawableForCookie(Resources.java:2872)
...
Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #0: invalid color state list tag gradient
at android.content.res.ColorStateList.createFromXmlInner(ColorStateList.java:217)
at
...
私は他の記事をチェックし、それはGradleのとは何かを持っていたほとんどの時間、私は私がvectorDrawables.useSupportLibrary = true
セットを持っていると言うことができます。
のGradleファイル:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
repositories {
mavenCentral()
}
defaultConfig {
applicationId "com.blub.bla"
vectorDrawables.useSupportLibrary = true
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
android {
lintOptions {
disable 'RestrictedApi'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.facebook.android:facebook-login:[4,5)'
implementation 'com.facebook.android:facebook-share:[4,5)'
implementation 'com.android.support:appcompat-v7:27.0.1'
implementation 'com.android.support:design:27.0.1'
implementation 'com.android.support:support-v4:27.0.1'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.squareup.okhttp:okhttp:2.4.0'
implementation 'com.squareup.okhttp:okhttp-urlconnection:2.2.0'
implementation 'com.google.android.gms:play-services-location:10.+'
implementation 'com.google.android.gms:play-services-places:10.+'
implementation 'com.google.maps.android:android-maps-utils:0.4+'
implementation 'eu.the4thfloor.volley:com.android.volley:2015.05.28'
testImplementation 'junit:junit:4.12'
}
編集: activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<include
layout="@layout/app_bar_main"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@drawable/bg"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_main"
app:itemIconTint="@color/white"
app:itemTextColor="@color/white"
app:menu="@menu/activity_main_drawer">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:paddingBottom="10dp"
android:paddingLeft="20dp"
android:paddingRight="20dp"
>
<com.facebook.share.widget.ShareButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:id="@+id/fb_share_button"/>
<ImageButton
android:id="@+id/sm_twitter"
android:layout_width="30dp"
android:layout_height="30dp"
android:scaleType="fitXY"
app:srcCompat="@drawable/ic_twitter_bird_logo"
android:background="@color/transparent"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
/>
<ImageButton
android:id="@+id/sm_facebook"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:scaleType="fitXY"
app:srcCompat="@drawable/ic_f_icon_color"
android:background="@color/transparent"
android:layout_alignParentBottom="true"
android:layout_toLeftOf="@id/sm_twitter"
/>
<ImageButton
android:id="@+id/sm_gplus"
android:layout_width="30dp"
android:layout_height="30dp"
android:scaleType="fitXY"
app:srcCompat="@drawable/ic_google_plus_icon"
android:background="@color/transparent"
android:layout_alignParentBottom="true"
android:layout_toLeftOf="@id/sm_facebook"
/>
</RelativeLayout >
</RelativeLayout>
</android.support.design.widget.NavigationView>>
<android.support.design.widget.NavigationView
android:id="@+id/nav_view_right"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="end"
android:background="@drawable/bg"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_filter"
app:itemIconTint="@color/white"
app:itemTextColor="@color/white">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="175dp"
android:orientation="horizontal">
<include
layout="@layout/filter_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</RelativeLayout>
</android.support.design.widget.NavigationView>
</android.support.v4.widget.DrawerLayout>
はそれを修正する方法を誰もが知っていますか? :(
'MainActivity'が使用しているレイアウトのコードを追加することはできますか? – petey
確かに、その中に –
おそらく、古いデバイスにはリソース 'ic_google_plus_icon.xml'がないのでしょうか?そのリソースにアクセスしようとする前にそのリソースが利用可能かどうかを確認することをお勧めします。 – Barns