I am getting error shown below, it just came suddenly and I don't know what to do, I tried changing Complile sdk to 29, removed few unused res file. Restarted the android studio but this is same
Error -
Android resource compilation failed
E:\NotificationLog\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1096: error: :style>.
E:\NotificationLog\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1101: error: :style>.
E:\NotificationLog\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1106: error: :style>.
E:\NotificationLog\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1110: error: :style>.
E:\NotificationLog\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml: error: file failed to compile.
Values.xml(error part)-
<!-- <item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>-->
<style name="parent">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
</style>
<style name="viewParent">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
</style>
<style name="parent.TextLayout">
<item name="android:layout_marginLeft">15dp</item>
</style>
<style name="modifiedEditText" parent="parent">
<item name="android:textSize">#dimen/newsMoreTextSize</item>
</style>
App Gradle -
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: 'io.fabric'
android {
compileSdkVersion 29
defaultConfig {
applicationId "com.appnotification.notificationhistorylog"
minSdkVersion 19
targetSdkVersion 28
versionCode 110
versionName "1.1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
manifestPlaceholders = [
onesignal_app_id : 'ID',
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: 'REMOTE']
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.1.0-alpha05'
implementation 'androidx.preference:preference:1.1.0-alpha05'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0-alpha05'
implementation 'com.google.android.material:material:1.1.0-alpha07'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.android.support:multidex:1.0.3'
//gif
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.10'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
//Showcase
implementation 'com.github.mreram:showcaseview:1.1'
//Fav
implementation 'com.github.ivbaranov:materialfavoritebutton:0.1.5'
implementation 'com.google.firebase:firebase-core:17.1.0'
// (Recommended) Add Analytics
implementation 'com.google.firebase:firebase-analytics:17.1.0'
// Add dependency
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
implementation 'com.quinny898.library.persistentsearch:library:1.1.0-SNAPSHOT'
// implementation 'com.google.firebase:firebase-appindexing:10.0.1'
//implementation 'com.android.installreferrer:installreferrer:1.0'
//Firebase
implementation 'com.firebaseui:firebase-ui-database:4.0.0'
implementation 'com.google.firebase:firebase-core:17.0.1'
implementation 'com.google.firebase:firebase-auth:18.1.0'
implementation 'com.google.firebase:firebase-database:18.0.1'
implementation 'com.google.firebase:firebase-storage:18.1.1'
implementation 'com.github.aakira:expandable-layout:1.6.0#aar'
implementation 'com.google.firebase:firebase-perf:19.0.0'
implementation 'com.onesignal:OneSignal:[3.11.2]'
//implementation 'com.google.firebase:firebase-inappmessaging-display:19.0.0'
//remote
implementation "com.google.firebase:firebase-config:19.0.0"
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.gms:play-services-ads:18.1.1'
implementation 'com.google.firebase:firebase-messaging:20.0.0'
}
Project Gradle-
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
maven { url 'https://maven.fabric.io/public'}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'com.google.gms:google-services:4.2.0'
classpath 'com.google.firebase:perf-plugin:1.3.1'
classpath 'io.fabric.tools:gradle:1.30.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven { url 'https://maven.fabric.io/public'}
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
}
maven
{
url "https://maven.google.com"
}
maven
{
url "https://jitpack.io"
//Jitpack
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Please if any can help me in this, I am not finding my way here
I Solved It by Removing below code from style.xml file
<!-- <style name="parent">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
</style>
<style name="viewParent">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
</style>
<style name="parent.TextLayout">
<item name="android:layout_marginLeft">15dp</item>
</style>
<style name="modifiedEditText" parent="parent">
<item name="android:textSize">#dimen/newsMoreTextSize</item>
</style>-->
I by mistake added styles in wrong place. :)
Related
I am trying to use Safe Args with the NavigationComponent. I have followed a tutorial, but I have problems because any class is generated automatically, so I can't pass any arguments because Classes (obviously) are not recognized
These are my Gradle file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
def nav_version = "2.4.1"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
classpath 'com.android.tools.build:gradle:7.1.0'
classpath 'com.google.gms:google-services:4.3.10'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
id 'androidx.navigation.safeargs'
}
android {
compileSdk 31
defaultConfig {
applicationId "com.example.frangela"
minSdk 21
targetSdk 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
viewBinding true
}
}
dependencies {
def nav_version = "2.4.1"
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0'
implementation "androidx.navigation:navigation-fragment:$nav_version"
implementation "androidx.navigation:navigation-ui:$nav_version"
implementation 'com.google.firebase:firebase-database:20.0.3'
implementation 'com.google.firebase:firebase-common-ktx:20.0.0'
implementation 'com.google.android.gms:play-services-maps:18.0.1'
implementation 'com.google.android.gms:play-services-location:19.0.1'
implementation 'com.google.firebase:firebase-crashlytics-buildtools:2.8.1'
testImplementation 'junit:junit:'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation platform('com.google.firebase:firebase-bom:29.0.3')
implementation "androidx.recyclerview:recyclerview:1.2.1"
implementation 'com.firebaseui:firebase-ui-database:6.2.1'
implementation 'com.google.firebase:firebase-auth'
implementation 'com.google.android.gms:play-services-auth:20.1.0'
}
This is the xml code:
<?xml version="1.0" encoding="utf-8"?>
<navigation 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/mobile_navigation"
app:startDestination="#+id/nav_home">
<fragment
android:id="#+id/nav_home"
android:name="com.example.frangela.ui.home.HomeFragment"
android:label="#string/menu_home"
tools:layout="#layout/fragment_home" />
<fragment
android:id="#+id/nav_gallery"
android:name="com.example.frangela.ui.gallery.GalleryFragment"
android:label="#string/menu_gallery"
tools:layout="#layout/fragment_gallery" />
<fragment
android:id="#+id/nav_slideshow"
android:name="com.example.frangela.ui.slideshow.InserisciSpesaFragment"
android:label="#string/menu_slideshow"
tools:layout="#layout/fragment_inserisci" >
<argument
android:name="descrizione"
app:argType="string" />
<argument
android:name="ammontare"
app:argType="float" />
</fragment>
<fragment
android:id="#+id/nav_stipendio"
android:name="com.example.frangela.ui.stipendio.InserisciStipendioFragment"
android:label="#string/menu_stipendio"
tools:layout="#layout/fragment_stipendio" />
<fragment
android:id="#+id/nav_resoconto"
android:name="com.example.frangela.ui.resocard.ResocardFragment"
android:label="#string/Resoconto"
tools:layout="#layout/fragment_resocard" >
<action
android:id="#+id/action_nav_resoconto_to_nav_slideshow"
app:destination="#id/nav_slideshow" />
</fragment>
</navigation>
After that I resync my project and rebuild, but nothing changes.
I tried to follow different tutorials and questions but none of them solved my problem. What am I missing?
Thanks in advance
After some days, I have found that the code has been generated, but in different folders, so that I cannot see them
I've got an error for 'Theme.MaterialComponents.Light.NoActionBar' in styles.xml (the 'Theme.MaterialComponents.Light.NoActionBar' is colored red because of error) after several gradle update. My component are also not well arranged according to my idea of designing.
I've already clean and rebuild project, invalidate caches/restart, update the gradle (maybe not the correct answer) and there's no answer for this. I just think maybe I'm the only one that have this problem maybe for my beginner level problem :')
styles.xml
`
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/hitam</item>
<item name="colorAccent">#color/colorAccent</item>
</style>
`
Project gradle
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
'
App gradle
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 29
defaultConfig {
applicationId "blablabla"
minSdkVersion 23
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildToolsVersion '29.0.1'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_6
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.ar.sceneform.ux:sceneform-ux:1.10.0'
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'com.google.firebase:firebase-core:17.0.1'
implementation 'com.google.firebase:firebase-auth:18.1.0'
implementation 'com.google.firebase:firebase-database:18.0.0'
implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2'
}
apply plugin: 'com.google.gms.google-services'
buildToolsVersion = '29.0.1'
}
`
I expect the error is not visible when there's like no one in this earth that have this error. PLEASE HELP T_T
The Material Components themes are included in the Material Components for Android library.
Since you are using androidx library just add this dependency in you app/build.gradle file.
dependencies {
// ...
implementation 'com.google.android.material:material:x.x.x'
// ...
}
Currently (April 29, 2022) the latest stable version is
implementation 'com.google.android.material:material:1.5.0'
Here you can find all the info the setup.
The reason why the MaterialComponents theme does not show is because you did not include the required Material Components library in your app/build.gradle:
dependencies {
implementation 'com.google.android.material:material:<version>'
}
The currently available versions are listed on the project's GitHub releases.
Add the dependency on Android’s Material in /android/app/build.gradle:
dependencies {
// ...
implementation 'com.google.android.material:material:<version>'
// ...
}
To find out the latest version, visit Google Maven.
Set the theme in /android/app/src/main/res/values/styles.xml:
//<style name="LaunchTheme" parent="Theme.AppCompat"> - remove
<style name="LaunchTheme" parent="Theme.MaterialComponents.NoActionBar"> - add
i'm trying to add some library in my application like me.itangqi.waveloadingview.WaveLoadingView from : Github The first time works well but after first RUN I have this error :
The following classes could not be instantiated:
- me.itangqi.waveloadingview.WaveLoadingView (Open Class, Show Exception, Clear Cache)
I already tried Clean/Rebuild but still the same ( doesn't work ).
My build.Gradle :
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "maa.maxbattery_batterypowersave"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
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 'com.android.support:appcompat-v7:25.3.0'
compile 'com.android.support:design:25.3.0'
compile 'me.itangqi.waveloadingview:library:0.3.5'
testCompile 'junit:junit:4.12'
}
My Style.xml :
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#262626</item>
<item name="colorPrimaryDark">#262626</item>
<item name="colorAccent">#262626</item>
</style>
I imported a working project from github and I find myself unable to run/rebuild project because of a problem with my styles.xml and build.grable.
Here are the links that I visited regarding this issue:
Theme.AppCompat.Light.DarkActionBar - No resource found
Android Errors : No resource found - Theme.AppCompat.Light.DarkActionBar, and Android Virtual Device
No resource found that matches the given name 'Theme.AppCompat.Light'
Fixing Error in styles.xml to generate R.java : No resource found name 'Theme.AppCompat.Light'
No resource found - Theme.AppCompat.Light.DarkActionBar
Can't Find Theme.AppCompat.Light for New Android ActionBar Support
And many more..Most solutions are old (5+ years) and the ones I tried did not work:
Add compile 'com.android.support:appcompat-v7:25.3.1' in your build.gradle dependencies
Import appcompat, the import button disappeared in the current version it seems
Recompile/Resync/Invalidate cache/Close project/Reimport from github
Adding library dependance in the module settings (I am asked to upload a file?)
Please be very explicit in your answers as to what to do (open X file, do Y) as I'm new with Android Studio.
Here are the main files:
Styles.xml:
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
</resources>
Build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.app.game.quizee"
minSdkVersion 21
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:support-vector-drawable:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
And the errors :
Thank you for your time!
Gradle version: "2.3.1" was causing this in my case, fixed it by returning to version "2.2.3".
In another words change this line:
classpath 'com.android.tools.build:gradle:2.3.1'
to:
classpath 'com.android.tools.build:gradle:2.2.3'
I just downloaded Android Studio and have created a new project.
Right off the bat, I'm getting two errors:
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.
Here is my gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.example.test.testapp"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.1'
}
and my installed packages:
What is messed up here? Thanks
In your gradle, compileSdkVersion is 22 while your support library version is 23. The two should match.
See Error retrieving parent for item: No resource found that matches the given name after upgrading to AppCompat v23
I also had same problem now. I tried below steps and worked perfectly.
In .gradle change like this
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:support-v13:23.0.1'
}
You'll get error in style file change it as below
<style name="AppTheme">
<!-- Customize your theme here. -->
</style>
modify your main_menu.xml
<menu 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" tools:context=".MainActivity">
<item android:id="#+id/action_settings" android:title="#string/action_settings"
android:orderInCategory="100" android:showAsAction="never" />
</menu>
In MainActivity remove AppCompatActivity like
MainActivity extends Activity