I have develop with Gradle (Android Studio), and i give the next error:
I dont undestart why dont run, and i dont understand this error
Code build.gradle
`plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}
android {
namespace 'com.example.tareapmydm02'
compileSdk 32
defaultConfig {
applicationId "com.example.tareapmydm02"
minSdk 21
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
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 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation project(path: ':app')
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
}`
What is the problem?? I try compile and run but appear this error. I try all, but i dont get the compile and run
Circular dependency between the following tasks:
:app:processDebugResources
\--- :app:processDebugResources (*)
* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Exception is:
org.gradle.api.CircularReferenceException: Circular dependency between the following tasks:
:app:processDebugResources
\--- :app:processDebugResources (*)
(*) - details omitted (listed previously)
I dont understand why not run
Related
I fail to run the OboeAudioRecorder with the most recent Android Studio update.
Could you please tell me what's wrong?
It is probably due to a librairy in conflict with other ones.
Error message:
Build file '/Users/*****/Documents/OboeAudioRecorder-master/app/build.gradle' line: 1
A problem occurred evaluating project ':app'.
> Failed to apply plugin 'com.android.internal.application'.
> The option 'android.enablePrefab' is deprecated.
It was removed in version 4.1 of the Android Gradle plugin.
This property has been replaced by android.buildFeatures.prefab (DSL)
Gradle project:
to all sub-projects/modules. buildscript {
ext.kotlin_version = "1.5.21"
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
} }
allprojects {
repositories {
google()
jcenter()
} }
task clean(type: Delete) {
delete rootProject.buildDir }
Those lines are correctly built.
Gradle module:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
defaultConfig {
applicationId "com.example.oboeaudiorecorder"
minSdkVersion 23
targetSdkVersion 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
cppFlags ""
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
externalNativeBuild {
cmake {
path "src/main/cpp/CMakeLists.txt"
version "3.18.1"
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
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'
}
I've also applied all the necessary updates in order to have the correct versions of gradle and CMake.
Source code: https://github.com/reuniware/OboeAudioRecorder
I'm having this error
ERROR: Unable to resolve dependency for ':app#debug/compileClasspath':
Could not find any version that matches
com.android.support:appcompat-v7:29.+.
I slept while the Android studio was downloading gradle ,so My laptop went in sleep mode and stopped everything.
Now I'm getting the error above. I think something is missing from the first run download ,How can i fix it ?
----------EDIT
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 15
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:29.+'
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'
}
and the second one
// 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.3.0'
// 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
}
According to Google: This is the stable release of Support Library 28.0.0 and is suitable for use in production. This will be the last feature release under the android.support packaging, and developers are encouraged to migrate to AndroidX.
Refer to https://developer.android.com/topic/libraries/support-library/revisions
This is why you are getting error on
implementation 'com.android.support:appcompat-v7:29.+'
Either migrate to androidX or you can use
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
in your gradle
Hope this will help you
Happy Coding
I am developing an Android library. So, I have a module that will be the .aar file.
This is the Graddle file of this module:
apply plugin: 'com.android.library'
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
implementation 'com.esri.arcgis.android:arcgis-android:10.2.9'
implementation 'com.squareup.okhttp3:okhttp:3.11.0'
implementation 'com.android.support:appcompat-v7:28.0.0-rc02'
implementation (name:'offending_library_2.0.0', ext:'aar')
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'
}
Aside, I have another module (app module) which I use to test this library, asa dummy app. I have that library loaded here too, since if I don`t have it it will not compile, This is the Graddle of the app module:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.my.company.domain"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
packagingOptions{
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
implementation 'com.esri.arcgis.android:arcgis-android:10.2.9'
implementation 'com.squareup.okhttp3:okhttp:3.11.0'
implementation 'com.android.support:appcompat-v7:28.0.0-rc02'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation (name:'offending_library_2.0.0', ext:'aar')
implementation project (':arcgislibrary')<----- This is the other module
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'
}
This way, I am having the error Program type already present: com.folder.servicehelper.BuildConfig
Message{kind=ERROR, text=Program type already present: com.folder.servicehelper.BuildConfig, sources=[Unknown source file], tool name=Optional.of(D8)}
The BuildConfig class is inside the offending_library of my graddle files.
I tried to delete the .aar file of the libs folder of the app module, but that way it doesn't compiles. Tried to do
implementation (name:'offending_library_2.0.0', ext:'aar'){
exclude group:'com.folder.servicehelper'
}
but the result is the same.
Any idea of how could I get rid of that error?
Thank you.
that there are two BuildConfig included, comes from the AAR being referenced twice:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
implementation (name:'offending_library_2.0.0', ext:'aar')
}
when only including ['*.jar'], this should be resolved.
to nevertheless include the AAR, one can define the libs directory as flat repository:
allprojects {
repositories {
...
flatDir { dirs "libs" }
}
}
and then use this syntax in the module-level build.gradle:
dependencies {
...
implementation "com.my.company.domain:offending_library:2.0.0#aar"
}
the documentation: Managing Transitive Dependencies.
I try to use Selenium library, but when compile selenium in gradle the project is not built.
// when I add selenium , I can not build project
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:transformClassesWithDexBuilderForDebug'.
com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException
My Gradle is:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.cagri.sdkchange"
minSdkVersion 14
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'
}
}
buildToolsVersion '28.0.3'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'org.seleniumhq.selenium:selenium-java:3.14.0'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.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'
}
When I put a library for pdf view in dependencies in android studio 3.1.3 ,It shows the error message "All com.android.support libraries must use the exact same version specification ".What is the way to read pdf in this situation?
build.gradle file has the following code:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.lenovo.myapplication"
minSdkVersion 15
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-beta01'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
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'
implementation 'com.github.barteksc:android-pdf-viewer:3.1.0-beta.1'
}