2017-08-13 9 views
2

からファイルres/drawable/ic_email_black.xmlファイルをエミュレータでテストすると、正常に動作しています。実際のデバイスでテストする場合Android4 .4(19)このログエラーが発生しています 私は多くの代替ソリューションを試しましたが、動作しません。

さらに、 を.Javaファイルに追加します。

私のGradleのバージョンは `distributionUrl = HTTPSです://services.gradle.org/distributions/gradle-4.1-milestone-1-all.zipここ

は私のログのエラーが

です
Caused by: android.view.InflateException: Binary XML file line #11: Error inflating class EditText 
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:720) 
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:762) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:354) 
    at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:289) 
    at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139) 
    at com.redrockdigimark.doot.activities.OwnerLogin.onCreate(OwnerLogin.java:27) 
    at android.app.Activity.performCreate(Activity.java:5442) 
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094) 
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2393) 
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2493)  
    at android.app.ActivityThread.access$800(ActivityThread.java:166)  
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1283)  
    at android.os.Handler.dispatchMessage(Handler.java:102)  
    at android.os.Looper.loop(Looper.java:136)  
    at android.app.ActivityThread.main(ActivityThread.java:5584)  
    at java.lang.reflect.Method.invokeNative(Native Method)  
    at java.lang.reflect.Method.invoke(Method.java:515)  
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)  
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)  
    at dalvik.system.NativeStart.main(Native Method)  
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/ic_email_black.xml from drawable resource ID #0x7f02007e 
    at android.content.res.Resources.loadDrawable(Resources.java:3451) 
    at android.content.res.TypedArray.getDrawable(TypedArray.java:614) 
    at android.widget.TextView.<init>(TextView.java:896) 
    at android.widget.EditText.<init>(EditText.java:60) 
    at android.support.v7.widget.AppCompatEditText.<init>(AppCompatEditText.java:62) 
    at android.support.v7.widget.AppCompatEditText.<init>(AppCompatEditText.java:58) 
    at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:112) 
    at android.support.v7.app.AppCompatDelegateImplV9.createView(AppCompatDelegateImplV9.java:1026) 
    at android.support.v7.app.AppCompatDelegateImplV9.onCreateView(AppCompatDelegateImplV9.java:1083) 
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:691) 
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:762)  
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:771)  
    at android.view.LayoutInflater.inflate(LayoutInflater.java:499)  
    at android.view.LayoutInflater.inflate(LayoutInflater.java:398)  
    at android.view.LayoutInflater.inflate(LayoutInflater.java:354)  
    at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:289)  
    at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)  
    at com.redrockdigimark.doot.activities.OwnerLogin.onCreate(OwnerLogin.java:27)  
    at android.app.Activity.performCreate(Activity.java:5442)  
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)  
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2393)  
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2493)  
    at android.app.ActivityThread.access$800(ActivityThread.java:166)  
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1283)  
    at android.os.Handler.dispatchMessage(Handler.java:102)  
    at android.os.Looper.loop(Looper.java:136)  
    at android.app.ActivityThread.main(ActivityThread.java:5584)  
    at java.lang.reflect.Method.invokeNative(Native Method)  
    at java.lang.reflect.Method.invoke(Method.java:515)  
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)  
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)  
    at dalvik.system.NativeStart.main(Native Method)  
Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #1: invalid drawable tag vector 
    at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:969) 
    at android.graphics.drawable.Drawable.createFromXml(Drawable.java:913) 
    at android.content.res.Resources.loadDrawable(Resources.java:3447) 
    at android.content.res.TypedArray.getDrawable(TypedArray.java:614)  
    at android.widget.TextView.<init>(TextView.java:896)  
    at android.widget.EditText.<init>(EditText.java:60)  
    at android.support.v7.widget.AppCompatEditText.<init>(AppCompatEditText.java:62)  
    at android.support.v7.widget.AppCompatEditText.<init>(AppCompatEditText.java:58)  

`

アプリケーションレベルのGradle:

apply plugin: 'com.android.application' 


android { 
    compileSdkVersion 26 
    buildToolsVersion "26.0.1" 
    defaultConfig { 
     applicationId "com.redrockdigimark.doot" 
     minSdkVersion 19 
     targetSdkVersion 26 
     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
     vectorDrawables.useSupportLibrary = true 
     multiDexEnabled true 

    } 
    buildTypes { 
     release { 
      shrinkResources true 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 


dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    }) 
    compile 'de.hdodenhof:circleimageview:2.1.0' 
    compile 'com.android.support:appcompat-v7:26.0.0-alpha1' 
    compile 'com.android.support:design:26.0.0-alpha1' 
    compile 'com.android.support.constraint:constraint-layout:1.0.2' 
    compile 'com.android.support:support-vector-drawable:26.0.0-alpha1' 
    compile 'com.android.support:support-v4:26.0.0-alpha1' 
    ------ 
    testCompile 'junit:junit:4.12' 
} 

apply plugin: 'com.google.gms.google-services' 

XMLファイル:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:background="@drawable/loginbg" 
android:orientation="vertical"> 

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_margin="40dp"> 
    <EditText 
     android:id="@+id/et_email" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentTop="true" 
     android:layout_centerHorizontal="true" 
     android:layout_marginTop="194dp" 
     android:background="@color/white" 
     android:drawableStart="@drawable/ic_email_black" 
     android:drawablePadding="5dp" 
     android:hint="Email" 
     android:padding="10dp" /> 

    <EditText 
     android:id="@+id/et_password" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/et_email" 
     android:layout_marginTop="20dp" 
     android:background="@color/white" 
     android:drawableStart="@drawable/ic_logout" 
     android:drawablePadding="5dp" 
     android:drawableTint="@color/primary" 
     android:hint="Password" 
     android:padding="10dp" /> 


    <TextView 
     android:id="@+id/txt_forgot_pwd" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentEnd="true" 
     android:layout_below="@+id/et_password" 
     android:layout_marginEnd="10dp" 
     android:layout_marginTop="20dp" 
     android:text="Forgot Password" 
     android:textColor="@color/white" /> 

</RelativeLayout> 

編集: ic_email_black.xml

<vector xmlns:android="http://schemas.android.com/apk/res/android" 
    android:width="24dp" 
    android:height="24dp" 
    android:viewportWidth="24.0" 
    android:viewportHeight="24.0"> 
<path 
    android:fillColor="#FFC107" 
    android:pathData="M20,4L4,4c-1.1,0 -1.99,0.9 -1.99,2L2,18c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,6c0,-1.1 -0.9,-2 -2,-2zM20,8l-8,5 -8,-5L4,6l8,5 8,-5v2z"/> 
</vector> 
+0

android.content.res.Resources $ NotFoundException:描画可能リソースのID番号の0x7f02007eからファイルのres /描画可能/ ic_email_black.xml:このエラーは、ic_email_black.xmlがプロジェクトに追加されていないことを示しています。 –

+0

それはプロジェクトのドロウアブルフォルダにあります –

+0

あなたのXMLでどのように追加したのですか?** app:srcCompat ** –

答えて

0

それはのEditTextにエラーが表示されます。

Binary XML file line #11: Error inflating class EditText 

ベクター描画可能でも正常に動作します。おそらくその問題Android 19デバイス。

代わりEditText

<android.support.v7.widget.AppCompatEditText 
     android:id="@+id/et_email" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentTop="true" 
     android:layout_centerHorizontal="true" 
     android:layout_marginTop="194dp" 
     android:background="@color/white" 
     android:drawableStart="@drawable/ic_email_black" 
     android:drawablePadding="5dp" 
     android:hint="Email" 
     android:padding="10dp"/> 

AppcompatEditTextを使用してみてください、それが役に立てば幸い:)

+0

を試してみてください私にとってはうまくいかない。 –

+0

プロジェクトフォルダに移動し、ビルドフォルダを削除してプロジェクトを再構築します。 –

+0

あなたのプロジェクトでリソースファイル** ic_email_black.xml **を使用した場所を投稿できますか?あなたが使った編集テキストXMLを見る必要があります。 –

関連する問題