Unable to include dependence library when export aar file - android

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?

Related

beginner Gradle error "dependency's AAR metadata"

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'
}

Android Studio : Failed to resolve: fragment-1.1.0

I want to add a library called material to my projects but it gives me the mentioned error in the title when I try to sync it. Android Studio 4.0.1.
build.gradle(app module)
apply plugin: 'com.android.application'
android {
compileSdkVersion 30
buildToolsVersion "30.0.1"
defaultConfig {
applicationId "com.example.app"
minSdkVersion 14
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'
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
/*implemention for material shown below*/
implementation 'com.google.android.material:material:1.3.0-alpha02'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

Execution failed for task ':app:processDebugResources' while building project

earlier was working fine but the time i updated the versions of libraries it went wrong
here is the app.gradle file, also tested with compile version 27 and 28 as well
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.test"
minSdkVersion 19
targetSdkVersion 26
multiDexEnabled true
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.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
}
packagingOptions {
exclude 'META-INF/proguard/androidx-annotations.pro'
}
}
after changing dependendencies to androidX version , issue is there
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0-alpha02'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
implementation 'com.google.android.material:material:1.1.0-alpha04'
implementation 'androidx.recyclerview:recyclerview:1.1.0-alpha03'
implementation 'com.lsjwzh:materialloadingprogressbar:0.5.8-RELEASE'
implementation 'com.jakewharton:butterknife:10.1.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:multidex:1.0.1'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
in build.gradle file
classpath 'com.android.tools.build:gradle:3.1.2'

Is it possible to target Android 28 (eg`targetSdkVersion 28`) and use both appcompat-v7 and Firebase?

Has anyone managed to target Android 28 (eg set targetSdkVersion 28) and use Firebase? My build.gradle is as below:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.google.firebase.example.fireeats"
minSdkVersion 28
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-rc02'
implementation 'com.google.firebase:firebase-core:16.0.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
apply plugin: 'com.google.gms.google-services'
Android Studio warns of mixed versions: Found versions 28.0.0-rc02, 26.1.0. Examples include com.android.support:animated-vector-drawable:28.0.0-rc02 and com.android.support:support-media-compat:26.1.0
Is Firebase 16.0.3 incompatible with the Android 28 support lib?
At time of writing, Firebase depends on the support library versions 27 so you do need to provide explicit overrides. See the working build file below.
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.google.firebase.example.fireeats"
minSdkVersion 28
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0' // NEED TO ADD
implementation 'com.android.support:support-v4:28.0.0' //NEED TO ADD
implementation 'com.google.firebase:firebase-core:16.0.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
apply plugin: 'com.google.gms.google-services'

android CMake can not determine linker language for target

I have created a very simple project about android and c++ in android studio.
the struct of project(module) is like:
enter image description here
And build.gradle is:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.shuyi.study.myapplication"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"a
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
externalNativeBuild {
cmake {
path 'CMakeLists.txt'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
when I start Gradle sync, it logged the informations:
enter image description here
I can not find the reason of this error.
Pleas give me some ides.Thanks!!!

Categories

Resources