Having a lot of errors while trying to create new porject in Android Studio 3.5.3 - android-studio

I want to create a project in Android Studio 3.5.3 by using Kotlin, but I've got a lot of errors.
the first error is:
Could not find androidx.appcompat:appcompat:1.1.0.
Required by:
project :app
After a lot of searching I added maven to repositories:
allprojects {
repositories {
google()
jcenter()
maven { url 'https://maven.google.com' }
}
}
now I get these errors:
ERROR: Failed to resolve: androidx.core:core-ktx:1.2.0
Show in Project Structure dialog
Affected Modules: app
ERROR: Failed to resolve: constraintlayout-solver
Affected Modules: app
ERROR: Failed to resolve: androidx.test.espresso:espresso-core:3.2.0
Show in Project Structure dialog
Affected Modules: app
I don't know what I should do to eliminate these errors. I've tried many ways but I couldn't solve these errors.
this is my build.gradle file:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 17
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"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.2.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'
}

Related

failed linking references - android studio

I'm getting the following error in my android studio project build
failed linking references,
error: resource id/edit_query (aka package:id/edit_query) not found.Message{kind=ERROR, text=error: resource id/edit_query (aka
package:id/edit_query) not found.,
sources=[C:\gradle\caches\transforms-1\files-1.1\appcompat-v7-28.0.0.aar\3482cd36ff1fc3489bd4ff1aeced93ab\res\values\values.xml:2689:5-2691:13],
original message=, tool name=Optional.of(AAPT)}
my project build.gradle file:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:4.0.1'
// 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
}
my module build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.weprcl.lathikashetty.weparcel"
minSdkVersion 16
targetSdkVersion 28
vectorDrawables.useSupportLibrary = true
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.constraint:constraint-layout:1.1.3'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.7'
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.google.android.gms:play-services-ads:17.1.2'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.jakewharton:butterknife:8.8.1'
implementation 'org.parceler:parceler-api:1.1.11'
implementation "android.arch.persistence.room:runtime:1.1.1"
implementation "android.arch.lifecycle:extensions:1.1.1"
annotationProcessor "android.arch.lifecycle:compiler:1.1.1"
annotationProcessor "android.arch.persistence.room:compiler:1.1.1"
annotationProcessor 'org.parceler:parceler:1.1.11'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.volley:volley:1.1.0'
implementation 'com.android.support:preference-v7:28.0.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'
}
I tried every answer in the same issue questions but without benefit so any help will be appreciated
Thanks in advance
**

How change Android Studio project api version to 23

I use Android Studio3.2.
I create a project use api version 28.
Now I need change api version to 23.
So I edit build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
defaultConfig {
applicationId "com.example.administrator.myapplication"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
cppFlags ""
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.0.0-alpha1'
implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha3'
}
And I change "AppCompatActivity" to "Activity"
But building faild:
Android resource linking failed
Output: error: resource android:style/TextAppearance.Material.Widget.Button.Borderless.Colored not found.
error: resource android:style/TextAppearance.Material.Widget.Button.Colored not found.
.............................
Try to look inside you XML for a view that has style type mentioned in that error.
Also, try to go File/ InvalidateCaches
compileSdkVersion and targetSdkVersion should match and apart from that
you have to include the following support library to support api 23
implementation 'com.android.support:appcompat-v7:23.0.0'
then now sync project and check.
Hope this will help

Where is com.android.support:animated-vector-drawable located? (Android Studio)

In build.gradle (Module:app) my implementation 'com.android.support:appcompat-v7:27.1.1' is underlined with red saying version mismatch with com.android.support:animated-vector-drawable (which apparently is v24). I cannot find anything named vector-drawable anywhere in the project though. The app won't start as long as the red marking remains, stating that it is unable to merge dex.
App grade looks like this:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.healthandchocolate.sjostedtafzelius.healthchocolateandroid"
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
//FIREBASE
implementation 'com.google.firebase:firebase-database:10.0.1'
implementation 'com.google.firebase:firebase-core:10.0.1'
//GLIDE for images
/*
compile 'com.github.bumptech.glide:glide:4.2.0'
kapt 'com.github.bumptech.glide:compiler:4.2.0'
compile 'com.android.support:support-compat:27'
annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'
*/
compile 'com.master.android:glideimageview:1.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.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'
//FORCES 27. RESOLVES VERSION CONFLICT
configurations.all {
resolutionStrategy {
force 'com.android.support:support-annotations:26.+'
}
}
}
apply plugin: 'com.google.gms.google-services'
apply plugin: 'kotlin-kapt'
It's probably because of dependencies, (most probably your com.master.android:glideimageview:1.0, or maybe other).
So, just add another implementation that refer to animated-vector-drawable:
implementation 'com.android.support:animated-vector-drawable:27.1.1'
Make sure to include google() repository in your top-level build.gradle

lombok fails when compile with Gradle 4.5 in Android Studio 3.1.2

I want to use lombok in my Android Studio project.
My current build.gradle project file looks like this:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And my app build.gradle file looks like this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "app.getter.android"
minSdkVersion 16
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'
}
customDebugType {
debuggable true
}
}
}
dependencies {
compileOnly 'org.projectlombok:lombok:1.16.20'
annotationProcessor 'org.projectlombok:lombok:1.16.20'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
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'
}
I've already installed Lombok Plugin in my Android Studio 3.1.2 and all seems correct. All the lombok tools are available tu use it. The content assist shows all lombok dependencies and there isn't compilation errors in my workspace. However when I try to run a test, Gradle compiles my code and it can't find the lombok generated code like getters/setters or val variables are not transformed to my Java type so it seems that annotationProcessor is not invoked before the compilation or the generated code by the annotationProcessor isn't in the classpath when gradle makes the compilation.
I've tried to use gradle-lombok-plugin but nothing works for me. What I'm doing wrong?

Unable to resolve dependency for ':app#debugAndroidTest/compileClasspath': Could not resolve com.google.android.gms:play-services-maps:11.8.0

I'm getting the below error:
Unable to resolve dependency for
':app#debugAndroidTest/compileClasspath': Could not resolve
com.google.android.gms:play-services-maps:11.8.0
This error arises while creating a new map project in android studio.
My build.gradle:
apply plugin: 'com.android.application'android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.phaniteja.maps"
minSdkVersion 15
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.google.android.gms:play-services-maps:11.8.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'
}
Can any one help me?
allprojects {
repositories {
jcenter()
maven { url "https://maven.google.com" }
}}
Add this in build.gradle. If you are using google_service.json ensure this apply plugin: 'com.google.gms.google-services' comes after your dependencies to avoid version issues.
Add classpath too .classpath 'com.google.gms:google-services:3.2.0'

Resources