2016-09-17 8 views
0

なぜこのエラーが発生するのですか?それはなぜ機能するのですか?あなたの助けが大変ありがとうございます。エラー:(72)アイテムの親を取得中にエラーが発生しました:指定された名前 'TextAppearance.AppCompat.Display1'に一致するリソースが見つかりません

マイGradleのファイルは以下の通りです:

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 24 
    buildToolsVersion "24.0.2" 

    packagingOptions { 
     exclude 'META-INF/notice.txt' 
     exclude 'META-INF/license.txt' 
     exclude 'LICENSE.txt' 
    } 

    defaultConfig { 
     applicationId "com.mycompany.myapp" 
     minSdkVersion 18 
     targetSdkVersion 24 
     versionCode 4 
     versionName "4.0" 

     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
    } 

    buildTypes { 
     release { 
      minifyEnabled true 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
     debug { 
      applicationIdSuffix '.d' 
      versionNameSuffix '-debug' 
     } 
    } 
} 

ext { 
    supportLibraryVersion = '24.2.1' 
    junitVersion = '4.12' 
    mockitoVersion = '1.10.19' 
    hamcrestVersion = '1.3' 
    espressoVersion = '2.2.2' 
    runnerVersion = '0.5' 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    compile "com.android.support:appcompat-v7:$supportLibraryVersion" 
    compile "com.android.support:support-v4:$supportLibraryVersion" 

    testCompile "junit:junit:$junitVersion" 
    testCompile "org.mockito:mockito-all:$mockitoVersion" 
    testCompile "org.hamcrest:hamcrest-all:$hamcrestVersion" 

    androidTestCompile "com.android.support.test:runner:$runnerVersion" 
    androidTestCompile "com.android.support.test:rules:$runnerVersion" 
    androidTestCompile "com.android.support.test.espresso:espresso-core:$espressoVersion" 
    androidTestCompile "com.android.support.test.espresso:espresso-intents:$espressoVersion" 
    androidTestCompile "com.android.support.test.espresso:espresso-contrib:$espressoVersion" 
    //androidTestCompile "com.android.support.test.espresso:espresso-web:$espressoVersion" 
    //androidTestCompile "com.android.support.test.espresso:espresso-idling-resource:$espressoVersion" 
} 

configurations.all { 
    resolutionStrategy.force "com.android.support:support-v4:$supportLibraryVersion" 
    resolutionStrategy.force "com.android.support:support-annotations:$supportLibraryVersion" 
    //resolutionStrategy.force "com.android.support:recyclerview-v7:$supportLibraryVersion" 
} 

configurations.compile.dependencies.each { compileDependency -> 
    println "Excluding compile dependency: ${compileDependency.getName()}" 
    configurations.androidTestCompile.dependencies.each { androidTestCompileDependency -> 
     configurations.androidTestCompile.exclude module: "${compileDependency.getName()}" 
    } 
} 

のAndroid StudioのIDEからビルドを行うときに私が得るエラーは以下の通りです:

Error:(72) Error retrieving parent for item: No resource found that matches the given name 'TextAppearance.AppCompat.Display1'. 
Error:(75) Error retrieving parent for item: No resource found that matches the given name 'TextAppearance.AppCompat.Caption'. 
Error:(89) Error retrieving parent for item: No resource found that matches the given name 'TextAppearance.AppCompat.Button'. 
Error:(97, 5) No resource found that matches the given name: attr 'textAllCaps'. 
Error:(102, 5) No resource found that matches the given name: attr 'elevation'. 
Error:(113, 5) No resource found that matches the given name: attr 'backgroundTint'. 
Error:(113, 5) No resource found that matches the given name: attr 'elevation'. 
+0

@ cricket_007あなたは正しいです。私はそれを受け入れることができるようにあなたの考えを答えとして書いてください。あなたがAndroidのドキュメントからこの推論をどのように行ったのか説明してください。前もって感謝します! – karthiks

答えて

1

は、私はあなたがアンドロイドのサポートが欠けていると思います設計ライブラリ

この

compile "com.android.support:design:$supportLibraryVersion" 
を追加してみてください

あなたが紛失しているテーマであることが理由です。私はそれらが実際にデザインライブラリに含まれていることを証明することはできませんが、彼らがどこから来たのかはわかります。

また、その依存関係を含めると、これらの行は実際には必要ありません。

compile "com.android.support:appcompat-v7:$supportLibraryVersion" 
compile "com.android.support:support-v4:$supportLibraryVersion" 
+0

あなたはそうです。つまり、私がコンパイルするcom.android.support:support-v4:$supportLibraryVersion " "を追加しない限り、私のエスプレッソテストは失敗します。 Wierd: -/ – karthiks

+0

これは、 'configurations.all'の下のセクションとその後の例外のためです。サポートデザインライブラリにはこれらの2つが一時的に含まれているので、なぜエラーが発生するのかわかりません –

関連する問題

 関連する問題