I am trying to work on an application using Android Studio 4.1 Canary 10 but every time it throws build failed. Following is the error.
Execution failed for task ':app:generateDebugBuildConfig'.
Could not get file details of E:\example\exampleapp\app\build\generated\source\buildConfig\debug: could not file attributes (errno 87)
build.gradle file
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-android-extensions'
}
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.example.exampleapp"
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 JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
compose true
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.ui:ui-framework:0.1.0-dev09'
implementation 'androidx.ui:ui-layout:0.1.0-dev09'
implementation 'androidx.ui:ui-material:0.1.0-dev09'
implementation 'androidx.ui:ui-tooling:0.1.0-dev09'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
classpath dependencies :
dependencies {
classpath "com.android.tools.build:gradle:4.1.0-alpha10"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
I did clean and rebuild the project it didn't help. Any help would be great
Thank you
I couldn't to reproduce topic issue. And due to newbie reputation score — comment-section read only for my account now. So I post the answer. Avoid blaming me if it possible, please.
Try to add to application build.gradle file following:
composeOptions {
kotlinCompilerVersion "1.3.70-dev-withExperimentalGoogleExtensions-20200424"
kotlinCompilerExtensionVersion "0.1.0-dev09"
}
just before buildTypes { … } block.
Related
I want to use Glide library in my project but after adding glide's dependencies i got this error when i run the app and gradle offline mode is off :
error image
and this is my app build.geadle :
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'kotlin-kapt'
}
android {
namespace 'com.example.tempapplication'
compileSdk 32
defaultConfig {
applicationId "com.example.tempapplication"
minSdk 26
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'
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
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.github.bumptech.glide:glide:4.14.2'
kapt 'com.github.bumptech.glide:compiler:4.14.2'
}
when i remove the glide's dependencies it work properly.
The problem was my vpn and Gradle could not download dependencies.
if it occur to you check that you connection is available or not.
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'
}
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
I'm completely new to android and I'm trying some stuff. But there is a problem that I can't resolve. I'm trying to import some android support library and even if it seems like I did it properly by adding google() to my Gradle build, and by clicking Sync Now there is an error. I even used the project structure manager to add the dependencies and it still appears red.
Here is my build.gradle module file :
plugins {
id 'com.android.application'
}
allprojects {
repositories {
google()
}
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.avoidspleen.exossupspe"
minSdkVersion 21
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'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
// Appears red from now
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
// End of red
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
I'm using JetBrains toolbox to update Android Studio version 4.1.2.
When I'am trying to run the app I getting the following error
"java.lang.IllegalStateException: Function not found androidx.compose.internal.restartableFunctionInstance"
and the following warning:
C:\Users\amr\.gradle\caches\transforms-2\files-2.1\29795ea219aedbe5401209deaa0aa414\jetified-kotlin-stdlib-jdk7-1.3.60-eap-25.jar: Runtime JAR file has version 1.3 which is older than required for API version 1.4
Here is my code in the activity:
class MainActivity: AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle ? ) {
super.onCreate(savedInstanceState)
setContent {
Text("Hello World")
}
}
}
I am using android studio 4.2 canary 2
Here is the full build.gradle file"
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.myfirstCompse"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
buildFeatures {
compose true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
composeOptions {
kotlinCompilerExtensionVersion "0.1.0-dev09"
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx: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 'androidx.ui:ui-framework:0.1.0-dev09'
implementation 'androidx.ui:ui-tooling:0.1.0-dev09'
implementation 'androidx.ui:ui-layout:0.1.0-dev09'
implementation 'androidx.ui:ui-material:0.1.0-dev09'
}
Update: when I change the dependency version to dev09, and added compileOptions block as the documentation suggests
composeOptions {
kotlinCompilerExtensionVersion "0.1.0-dev09"
}
it produced the following error:
e: java.util.NoSuchElementException: Collection contains no element matching the predicate.
Add kotlinCompilerVersion = "1.3.70-dev-withExperimentalGoogleExtensions-20200424" to your composeOptions closure:
composeOptions {
kotlinCompilerVersion = "1.3.70-dev-withExperimentalGoogleExtensions-20200424"
kotlinCompilerExtensionVersion "0.1.0-dev09"
}
You definitely need this; I am uncertain if it will clear up this specific error.
You may wish to check the version of Kotlin that you are using in your project-level build.gradle file. 1.3.70 is a known safe version (it matches the compiler plugin version from my code snippet).