My question is about an error in Android Studio.
Every time when i try to run a java project in Android Studio i get the below error and my program doesn't not work :
This is my gradle configuration:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.christianmastracco.jsondemo"
minSdkVersion 22
targetSdkVersion 26
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:26.1.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'
}
How i can solve it? Thanks
Change your compileSdkVersion and targetSdkVersion to 27 and this:
implementation 'com.android.support:appcompat-v7:26.1.0'
to this
implementation 'com.android.support:appcompat-v7:27.1.0'
Update your compileSdkVersion and targetSdkVersion, both, into version 27 and implementation version 27.1.1 as shown in error message.
I can't comment at Ernest Zamelczyk answer (reputation 50) but I think the correct answer is 27.1.1, not 27.1.0 as he told.
Related
I wont to implement this design library to my project > https://developer.android.com/topic/libraries/support-library/packages.html#design (com.android.support:design:28.0.0). But when I'm syncing I have got error: Could not get unknown property 'com' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler. Please help. Thanks :)
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.example.pyramid"
minSdkVersion 15
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'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'com.android.support.design:28.0.0'
Ok I think it is solved. I just copied all libraries from second project with Bottom Navigation Activity to my first project. com.google.android.material.bottomnavigation.BottomNavigationView It's all :)
I am new to Android studio. I am facing a problem with the coding part. While running the code it shows an error.
Thw gradle part is shown below
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.fallprediction"
minSdkVersion 14
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'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'android.support:support.v7:29.0.2'
}
The error is
ERROR: Failed to resolve: android.support:support.v7:29.0.2
Show in Project Structure dialog
Affected Modules: app
Please help me to resolve this error
Convert this into androidx or remove this dependency implementation 'android.support:support.v7:29.0.2
A lot of people had the same error and most of their solutions worked, but not for me. I just can't see to run the code.
I tried clean/rebuild, multiDexEnabled true, I also tried tweaking the .gradle file which I just don't understand.
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.qrbarcodescanner"
minSdkVersion 15
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'me.dm7.barcodescanner:zxing:1.9'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.3.0-alpha02'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0-alpha02'
}
I just want to get rid of the pesky Task :app:transformClassesWithMultidexlistForDebug FAILED error. Any help will be appreciated. Thank you
I'm trying to use selendroid in my app as webscraper, but I get this error "More than one file was found with OS independent path 'README.md'" .
Any thoughts on how to fix it?
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "ru.startandroid.testselenium2"
minSdkVersion 15
targetSdkVersion 28
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: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'
implementation files('D:\\chromedriver\\selendroid-client-0.17.0.jar')
implementation files('D:\\chromedriver\\selendroid-standalone-0.17.0-with-dependencies.jar')
}
Add this to your android closure:
packagingOptions {
exclude 'README.md'
}
I want to work with firebase real time database and when I implement firebase core and firebase database library appcompat get error.
My app module code is below?
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.mahdi.smsreviver"
minSdkVersion 15
targetSdkVersion 27
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:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-database:16.1.0'
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.google.firebase:firebase-core:16.0.7'
}
apply plugin: 'com.google.gms.google-services'
from firebase release note you are using the latest version(firebase-core 16.0.7) which conflicts with appcompat version(27.1.1)
so please update gradle
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.mahdi.smsreviver"
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'
implementation 'com.google.firebase:firebase-database:16.0.6'
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'
implementation 'com.google.firebase:firebase-core:16.0.7'
}
apply plugin: 'com.google.gms.google-services'
Don't use appcompat, Use AndroidX the new support version library from Google.
It has better compatibility features and other noticeable features. Besides Appcompat is so Old.