Resource linking failed in Android Studio - android

I am working with Android Studio, and I am trying to use google material library
I am getting the following error (Android resource linking failed):
ERROR:AAPT: C:\Users\ANDRES\Desktop\cursillo_android\TipTime2\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v31\values-v31.xml:3: error: resource android:color/system_neutral1_1000 not found.
Mi grade files are:
plugins {
id 'com.android.application'
id 'kotlin-android'
}
android {
compileSdk 30
compileSdkVersion 30
defaultConfig {
applicationId "com.example.tiptime2"
minSdk 24
targetSdk 30
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
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
viewBinding = true
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
implementation 'com.google.android.material:material:1.5.0-alpha05'
}
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.3"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.0"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I would like to share a picture of the error with you:
Thank you

When your targetSdk is below 31 then the support library associated
with material resources will be in conflict with your build configuration.
During the build, gradle will use a task to check all support .aar libraries
metadata, where build target compatibility is set; in the case of
com.google.android.material:material:1.5.0-alpha05' the target compatibility
is set above 30 (may be 31, or even higher);
Remedy is this:
So go to an earlier material support library from
here https://mvnrepository.com/artifact/com.google.android.material/material
to use an earlier support version of the material support class;

Related

Kotlin library was complied with a newer Kotlin compiler and can't be read

Hello I tried to run Kotlin file on Android Studio (version 4.1) and I got an error:
Kotlin library {0} was compiled with a newer Kotlin compiler and can't be read. Please update Kotlin plugin.
Even I got this error I'm able to run kotlin files but Ide don't gives me tips when I use kotlin functions and methods are marked by red colour. Kotlin version in gradle is 1.6.0, if I'm return to older version I can see tips about method names and red colour is not showed.
Gradle build(app):
plugins {
id 'com.android.application'
id 'kotlin-android'
}
android {
compileSdkVersion 31
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.example.kotlin_udemy4"
minSdkVersion 26
targetSdkVersion 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
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'com.google.android.material:material:1.6.1'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
Gradle build:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = "1.6.0"
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.0"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Does anyon know how to resolve that issue ?
Besides Kotlin version 1.6.21 ...
That version of Android Studio appears rather outdated; eg. the current version "Chipmunk" uses:
com.android.tools.build:gradle:7.2.1
jcenter() should be replaced with mavenCentral().
And also, use JavaVersion.VERSION_11.
I have similar problem. To solve this, I do the following things:
I try to Rebuild the project, then this error log appear:
The minCompileSdk (32) specified in a
dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
is greater than this module's compileSdkVersion (android-31).
Dependency: androidx.appcompat:appcompat-resources:1.5.0.
AAR metadata file: C:\Users..........
Lower androidx.appcompat:appcompat version to 1.4.0, and then sync gradle. That's it.
Maybe you can try this way.
Next to isssue popup i selected "Details" link and there was information about expected version. Probably because I'm using older Android studio I got the problem. I updated Kotlin in gradle build to: 1.4.32 according to message.

Failed to resolve: org.jitsi.react:jitsi-meet-sdk:3.+

I tried changing the compilesdk and mindsdk versions as told here. I read all the other posts regarding the same but none worked so far. I have looked at the previous answers ans1 and ans2 . They didn't helped.
When I try to run the project it throws multplie errors. I think the main problem is because of this one
Could not find any matches for org.jitsi.react:jitsi-meet-sdk:3.+ as no versions of org.jitsi.react:jitsi-meet-sdk are available.
build.gradle(My application)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
maven {
url "https://github.com/jitsi/jitsi-maven-repository/raw/master/releases"
}
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.4"
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
}
build.gradle(app)
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}
android {
compileSdk 30
defaultConfig {
applicationId "com.example.myapplication"
minSdk 21
targetSdk 30
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
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.google.firebase:firebase-auth:19.2.0'
implementation 'com.google.firebase:firebase-common-ktx:20.0.0'
implementation 'com.google.firebase:firebase-firestore:24.0.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation platform('com.google.firebase:firebase-bom:29.0.3')
implementation ('org.jitsi.react:jitsi-meet-sdk:3.+') { transitive = true }
}
Any help is appreciated.
I find a workaround for this. You've to paste the maven URL into settings.gradle file. Some other user was facing a problem similar to this here . I did the same and it's working fine.
+1 / Failed to resolve: org.jitsi.react:jitsi-meet-sdk:3.+
5 min
I had added the maven dependency in the wrong place. It goes in the project gradle, under allprojects->repositories.
new fail
A problem occurred evaluating root project 'My Application'.
Build was configured to prefer settings repositories over project repositories but repository 'maven' was added by build file 'build.gradle'
For me the problem was with the SDK version
I replaced this line
implementation ('org.jitsi.react:jitsi-meet-sdk:+') { transitive = true }
with this line
implementation ('org.jitsi.react:jitsi-meet-sdk:5.1.0') { transitive = true }
If you are using React-Native < 0.60, you should use a version < 2.0.0.
For versions higher than 2.0.0, you need to add the following piece of code in your metro.config.js file to avoid conflicts between react-native-jitsi-meet and react-native in metro bundler.
const blacklist = require('metro-config/src/defaults/blacklist');
module.exports = {
resolver: {
blacklistRE: blacklist([
/ios/Pods/JitsiMeetSDK/Frameworks/JitsiMeet.framework/assets/node_modules/react-native/.*/,
]),
},
};
ref: https://github.com/skrafft/react-native-jitsi-meet

Failed to calculate the value of task ':app:mergeLibDexDebug' property 'numberOfBuckets'. Expected minSdkVersion >= 21 but found 1

Have a good day everyone. I am starting my studies in Kotlin using Android Studio in its version 4.2.2. I have created a project from 0 using the IDE itself and I get the error:
Execution failed for task ':app:mergeLibDexDebug'
Failed to calculate the value of task ':app:mergeLibDexDebug' property
'numberOfBuckets'.
Expected minSdkVersion >= 21 but found 1
I was looking in other publications that spoke of compilation problems mainly due to incompatibilities in the dependencies included in the project, but none spoke exactly about the error that I am presenting...
The gradle module has the default code when creating the application which is the following:
plugins {
id 'com.android.application'
id 'kotlin-android'
}
android {
compileSdkVersion 30
defaultConfig {
applicationId "com.example.nueva"
minSdkVersion 28
targetSdkVersion 30
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
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
The gradle project also has the default configuration that it brings when the application is created:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = "1.5.20"
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:4.2.2"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
mavenCentral()
// jcenter() // Warning: this repository is going to shut down soon
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I don't have any additional implementation either in MainActivity.kt or another project file. If anyone has been through this error and fixed it please I would really appreciate if you would share with me how to eliminate this error. Maybe the solution is simple, but as I said before I am new to the world of Kotlin and I would like very much in the future to be able to be involved in the world of developing applications for smartphones. Without further ado, thank you very much in advance to anyone who can help
Can you make sure test on a Device >= API Level 21 ? Also check from Settings for New Projects to be selected Android 11.0 (R) or Android 9.0 Pie (check also these versions are installed in sdk manager)

Could not find viewpager2-1.0.0.aar (androidx.viewpager2:viewpager2:1.0.0)

My Android project used to be built without any problems. And I did not change the code. But now I have this error. I updated Android Studio to version 202.7188722 and created a new project without any activity, but I got this error again:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find viewpager2-1.0.0.aar (androidx.viewpager2:viewpager2:1.0.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/androidx/viewpager2/viewpager2/1.0.0/viewpager2-
1.0.0.aar
Possible solution:
- Declare repository providing the artifact, see the documentation at
https://docs.gradle.org/current/userguide/declaring_repositories.html
Note: I tested the internet connection and HTTP proxy and it had no problem.
These are my new project gradle files:
project:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:4.2.0-beta06"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
mavenCentral()
jcenter() // Warning: this repository is going to shut down soon
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
app:
plugins {
id 'com.android.application'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.hyapp.tebgeram"
minSdkVersion 16
targetSdkVersion 30
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
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
gradle-wrapper.properties:
#Tue Mar 16 22:03:28 IRST 2021
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
I had the same problem. in my case it was from the proxy and connection problems. make sure that your proxy is working fine.

How to "compileOnly" my android repository from github

I'm implementing my android-module from github using jitpack,
and i want to do compileOnly instead of implementation
but when I use the code compileOnly it shows me
that the complieOnly not supported
I'm creating an application to read plugins
all application and plugins depends on a library I have created
the plugin well have a classes that extends a class on the library
and the application should read those classes and invoke methods on them
as you know the application SHOULD contains the library classes
and the plugin SHOULDN'T, else we'll face a doublecated classes exception or/and class cast exception
I worked on it and it worked perfectly while the application and
the plugins all compiled the library using an aar file of it
but when i decied to move on to github implementation
it worked for the application but not for the plugin
and the issue is i can't tell gradle to do compileOnly to the library
plugin's module build.gradle :
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.0"
defaultConfig {
minSdkVersion 24
targetSdkVersion 29
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 = '1.8'
targetCompatibility = '1.8'
}
}
dependencies {
compileOnly 'com.github.LSaferSE:Services-Android:master'//<--- here is the problem
implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
testImplementation 'junit:junit:4.13-beta-3'
androidTestImplementation 'androidx.test:runner:1.3.0-alpha02'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0-alpha02'
}
plugin's project build.gradle :
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
// 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://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
expecting a build success but faced :
ERROR: Android dependency 'com.github.LSaferSE:Services-Android:master' is set to compileOnly/provided which is not supported
one more thing, I tried using api instead but I'm not sure what's the diffrent from implementation, but I'm sure it'll pack library classes in the plugin's apk, so please tell me if you know it'll not effect while loading the apk using DexClassLoader (fyi it'll effect using implementation)

Categories

Resources