Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle build: resource android:style/TextAppearance.Material not found

I just installed AndroidStudio and imported an old Eclipse ADT project (API level 18). However, when trying to build this project in AndroidStudio, I get the following errors:

resource android:style/TextAppearance.Material not found.   
resource android:style/TextAppearance.Material.Body1 not found. 
resource android:style/TextAppearance.Material.Body2 not found. 
resource android:style/TextAppearance.Material.Button not found.    
resource android:style/TextAppearance.Material.Caption not found.   
resource android:style/TextAppearance.Material.Display1 not found.  
resource android:style/TextAppearance.Material.Display2 not found.  
resource android:style/TextAppearance.Material.Display3 not found.  
resource android:style/TextAppearance.Material.Display4 not found.  
resource android:style/TextAppearance.Material.Headline not found.  
resource android:style/TextAppearance.Material.Inverse not found.   
resource android:style/TextAppearance.Material.Large not found. 
resource android:style/TextAppearance.Material.Large.Inverse not found. 
resource android:style/TextAppearance.Material.Widget.PopupMenu.Large not found.    
resource android:style/TextAppearance.Material.Widget.PopupMenu.Small not found.    
resource android:style/TextAppearance.Material.Medium not found.    
resource android:style/TextAppearance.Material.Medium.Inverse not found.    
resource android:style/TextAppearance.Material.Menu not found.  
resource android:style/TextAppearance.Material.SearchResult.Subtitle not found. 
resource android:style/TextAppearance.Material.SearchResult.Title not found.    

How can I fix this error? Which further information shall I provide?

This is the import protocol, in case it helps:

ECLIPSE ANDROID PROJECT IMPORT SUMMARY
======================================

Manifest Merging:
-----------------
Your project uses libraries that provide manifests, and your Eclipse
project did not explicitly turn on manifest merging. In Android Gradle
projects, manifests are always merged (meaning that contents from your
libraries' manifests will be merged into the app manifest. If you had
manually copied contents from library manifests into your app manifest
you may need to remove these for the app to build correctly.

Ignored Files:
--------------
The following files were *not* copied into the new Gradle project; you
should evaluate whether these are still needed in your project and if
so manually move them:

* .gitignore
* ic_launcher-web.png
* proguard-project.txt

Replaced Jars with Dependencies:
--------------------------------
The importer recognized the following .jar files as third party
libraries and replaced them with Gradle dependencies instead. This has
the advantage that more explicit version information is known, and the
libraries can be updated automatically. However, it is possible that
the .jar file in your project was of an older version than the
dependency we picked, which could render the project not compileable.
You can disable the jar replacement in the import wizard and try again:

android-support-v4.jar => com.android.support:support-v4:18.0.0

Replaced Libraries with Dependencies:
-------------------------------------
The importer recognized the following library projects as third party
libraries and replaced them with Gradle dependencies instead. This has
the advantage that more explicit version information is known, and the
libraries can be updated automatically. However, it is possible that
the source files in your project were of an older version than the
dependency we picked, which could render the project not compileable.
You can disable the library replacement in the import wizard and try
again:

google-play-services_lib => [com.google.android.gms:play-services:+]

Moved Files:
------------
Android Gradle projects use a different directory structure than ADT
Eclipse projects. Here's how the projects were restructured:

* AndroidManifest.xml => app\src\main\AndroidManifest.xml
* assets\ => app\src\main\assets
* libs\commons-net-3.3.jar => app\libs\commons-net-3.3.jar
* res\ => app\src\main\res\
* src\ => app\src\main\java\

Next Steps:
-----------
You can now build the project. The Gradle project needs network
connectivity to download dependencies.

Bugs:
-----
If for some reason your project does not build, and you determine that
it is due to a bug or limitation of the Eclipse to Gradle importer,
please file a bug at http://b.android.com with category
Component-Tools.

(This import summary is for your information only, and can be deleted
after import once you are satisfied with the results.)
like image 716
stefan.at.wpf Avatar asked Jun 01 '18 11:06

stefan.at.wpf


People also ask

What is a style resource in XML?

Note: A style is a simple resource that is referenced using the value provided in the name attribute (not the name of the XML file). As such, you can combine style resources with other simple resources in the one XML file, under one <resources> element. The filename is arbitrary.

How do I implement material theming on Android?

On Android, Material Theming can be implemented using the Material Components (MDC) library, from version 1.0.0 onwards. If you’re looking to migrate from the Design Support Library or MDC 1.0.0, take a look at our migration guide.

What SDK level should I use for Material Design themed apps?

For material design themed apps you can either use a sdk level of min 21 (Android 5.0) or the support lib. Read this post here. chris.banes.me/2014/10/17/appcompat-v21

What is textfontweight and textstyle in Android?

android:textFontWeight is the weight of the font, used to select the closest match from a font family, but is only available on API 28 and above. android:textStyle can also be used to apply transformations such as bold and italic. <!-- In res/values/type.xml -->


1 Answers

Your compile SDK version MUST match the support library. so here is an example with latest version. Do something similar with yours or update to the latest version (recommended) like below:

1.In your Build.gradle change:

implementation 'com.android.support:appcompat-v7:28.0.0'

2.Change compileSdkVersion and buildToolsVersion to:

compileSdkVersion 28
buildToolsVersion "28.0.3"

3.Update Project gradle file:

classpath 'com.android.tools.build:gradle:3.4.1'

And i suggest you to update all your dependencies in your project in the latest version, i would help you more if you provide us gradle files. Hope this help you.

like image 98
Paraskevas Ntsounos Avatar answered Oct 18 '22 19:10

Paraskevas Ntsounos