beginner Gradle error "dependency's AAR metadata" - android

this my Gradle
plugins {
id 'com.android.application'
}
android {
compileSdkVersion 26
buildToolsVersion '29.0.2'
defaultConfig {
applicationId "com.example.tablayout"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner defaultTestInstrumentationRunner
}
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.4.2'
implementation 'com.android.support:design:26.0.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
testImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
this output:
The minCompileSdk (31) specified in a dependency's AAR metadata
(META-INF/com/android/build/gradle/aar-metadata.properties) is greater
than this module's compileSdkVersion (android-26). Dependency:
androidx.appcompat:appcompat:1.4.2.

compileSdkVersion and targetSdkVersion You have to get it to level 31
Version 28 (intended for Android Pie and below) is the last version of the legacy support library, so we recommend that you migrate to AndroidX libraries when using Android Q and moving forward.
Old:
implementation 'com.android.support:design:26.0.0'
New:
implementation 'com.google.android.material:material:1.6.1'
You can update the file like this:
android {
compileSdkVersion 31
defaultConfig {
applicationId "com.example.tablayout"
minSdkVersion 19
targetSdkVersion 31
versionCode 1
versionName "1.0"
testInstrumentationRunner defaultTestInstrumentationRunner
}
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.4.2'
implementation 'com.google.android.material:material:1.6.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
testImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

Related

Error "error: package com.google.firebase.messaging does not exist" even though dependency is added

I have the following line in my MainActivity.java that is giving the error...
import com.google.firebase.messaging.FirebaseMessaging;
Which gives error:
error: package com.google.firebase.messaging does not exist
My app level build.gradle has the dependency added...
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.tenera.fcm_reliability_test_android_native_client"
minSdk 21
targetSdk 32
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.5.1'
implementation 'com.google.android.material:material:1.7.0'
implementation platform('com.google.firebase:firebase-bom:31.1.0')
implementation platform('com.google.firebase:firebase-messaging')
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
}
The build process does not complain about any issue with the build.gradle, so I assume it is configured correctly (according to the firebase docs). I am not sure what else I can do to diagnose this issue, since there is no indication that the build file is misconfigured.

App is showing gradle error before connecting to android app

I was using Firebase as I was new into the firebase whenever I try to connect my app with firebase it shows me error. Could not parse the Android Application Module's Gradle config. Resolve gradle build issues and/or resync.. I had tried to change my sdkversion from 32 to 31 but it was showing different error after that The minCompileSdk (32) specified in a
dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties) . So, if someone knows the answer please let me know. I have stucked in this for a while now
This is my gradle(App) file
plugins {
id 'com.android.application'
id 'kotlin-android'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.example.login_firebase"
minSdk 21
targetSdk 32
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'
}
compileSdkVersion 32
buildToolsVersion '32.0.0'
}
dependencies {
implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.appcompat:appcompat:1.5.0'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

Android Studio - ActivityInstrumentationTestCase2 not found?

I am trying to unit test my MainActivty. My project cannot find ActivityInstrumentationTestCase2 and android.test package. I changed the target SDK to 27 to see if that resolves that problem but to no avail.
This is how my gradle looks like:
plugins {
id 'com.android.application'
}
android {
compileSdk 32
defaultConfig {
applicationId "aziz.ai.gpsspeedometer"
minSdk 21
targetSdk 32
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
}
sourceSets {
main {
java {
srcDirs 'src\\main\\java', 'src\\main\\java\\common'
}
}
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'com.google.android.gms:play-services-location:19.0.1'
}
ActivityInstrumentationTestCase2 is deprecated on API level 24
put compileSdkVersion 23 or upgrade the test class to the new test classes

How can I fix "Could not GET jcenter.bintray.com/com/google/dagger/dagger-android-processor/2.35.1/dagger-android-processor-2.35.1.pom"?

I'm practicing Dagger 2 from this tutorial:
vogella.com Dagger tutorial.
But I got this error while running my Android project:
Could not GET 'https://jcenter.bintray.com/com/google/dagger/dagger-android-processor/2.35.1/dagger-android-processor-2.35.1.pom'
How can I fix this issue?
This is my build.gradle Module:
plugins {
id 'com.android.application'
}
android {
compileSdkVersion 31
buildToolsVersion "31.0.0"
defaultConfig {
applicationId "com.vogella.android.dagger2simple"
minSdkVersion 17
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
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.4.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
implementation 'com.google.dagger:dagger:2.35.1'
implementation 'com.google.dagger:dagger-android:2.35.1'
annotationProcessor 'com.google.dagger:dagger-android-processor:2.35.1'
annotationProcessor 'com.google.dagger:dagger-compiler:2.35.1'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
android {
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
}
Replace jcenter() with mavenCentral() in all your build.gradle files.
As mentioned in migrating away from JCenter guide

Unable to include dependence library when export aar file

I created a module and now I am trying to export the .aar file but I cannot include the gradle dependencies I used in the module to the .aar file. I tried the solution of this post with no success. Here is how my app level .build file looks like:
apply plugin: 'com.android.library'
android {
compileSdkVersion 28
buildToolsVersion "29.0.2"
defaultConfig {
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation ('com.daimajia.androidanimations:library:2.3#aar')
{transitive=true}
implementation ('com.google.android.exoplayer:exoplayer-core:2.10.0')
{transitive=true}
implementation ('tyrantgit:explosionfield:1.0.1')
{transitive=true}
}
What am I missing?

Categories

Resources