Comment utiliser appcompat-v7 avec l'API android 19
Tout est dans la questioin
J'ai un module avec cette graddle :
apply plugin: 'com.android.library'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
compileOptions.encoding "ISO-8859-1"
defaultConfig {
minSdkVersion 8
targetSdkVersion 8
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:21.0.3'
}
Quand je change de "compileSdkVersion" à 19 => je obtenir 100+ erreurs sur les ressources non trouvé :
Exemple :
Error:(9, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body1'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body2'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Button'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Caption'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display1'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display2'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display3'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display4'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Headline'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Inverse'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large.Inverse'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Large'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Small'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Medium'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Medium.Inverse'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Menu'.
Error:Error retrieving parent for item: No resource found that matches the given name '@android:TextAppearance.Material.SearchResult.Subtitle'.
Error:Error retrieving parent for item: No resource found that matches the given name '@android:TextAppearance.Material.SearchResult.Title'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Small'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Small.Inverse'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Subhead'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Title'.
essayez cette
targetSdkVersion ne devrait pas être de 8, c'est vraiment vraiment mauvais.
C'est un module de la bibliothèque, j'ai pu me balade de targetSdkVersion je pense
Personnellement, je suis en utilisant la M D de réponse depuis un long moment.
compile 'com.android.support:appcompat-v7:19.+'
targetSdkVersion ne devrait pas être de 8, c'est vraiment vraiment mauvais.
C'est un module de la bibliothèque, j'ai pu me balade de targetSdkVersion je pense
Personnellement, je suis en utilisant la M D de réponse depuis un long moment.
OriginalL'auteur An-droid | 2015-01-26
Vous devez vous connecter pour publier un commentaire.
bien sûr, vous êtes l'obtention de ces erreurs de l'API de<21, parce que
android:TextAppearance.Material
et autres (Matériel) ont été introduits dans l'API 21. AppCompat est de porter des ressources, mais elles sont utilisées sansandroid:
préfixe (je ne peux pas vérifier, en ce moment, si vous les utilisez aussi, mais probablement que oui). Si vous compilez votre application avec l'API 21 et courir sur le bas de l'API de l'appareil les accidents vont se produire aussiandroid:
préfixe reportez-vous à intégré dans les params, qui devrait être dans toutes les versions de l'Api prises en charge (minSDK). Le matériel n'est pas présent dans la pré-API21 systèmesnon, l'utilisation min version du sdk qui vous voulez soutenir. mais si vous voulez utiliser une nouvelle méthode/classe/style (comme ci-dessus) de nouveau SDK garder à l'esprit que l'application sur les appareils avec les anciennes version d'Android (comme ce vieux soutenu minSdk) pourrait jeter
Exception
ou tout simplement omettre ces lignes (par exemple, attrs dans des fichiers XML). la question ci-dessus est d'environAppCompat
de la bibliothèque, qui apporte à votre application de certaines méthodes/classes/styles de nouveau sdk, donc, par exemple, de nouveaux styles (Matériel, partiellement) peut également être utilisé dans les systèmes plus anciens (par exemple ICS), mais note qu'ils ont des appellations différentes qui n'interfère pas avec les noms d'origineOriginalL'auteur snachmsm
Vérifier la compileSdkVersion dans la construction.gradle
par exemple.
Si vous gardez le dernier, ne devrais pas vous donner des maux de tête. Raison à cela est que si il y a plusieurs R les fichiers générés pour la même bibliothèque.
OriginalL'auteur Akshayraj Kore