I trying to run android studio but have grade syn error. There are five errors of dependency, debugging. What is the solution - android-studio

I am using android 3.1.4 and grade version I have tried 4.4 4.5 4.10 and the latest one 5.6.2 but none of them seem to help. The latest version shows some others errors though. What is the solution?

For min api 21 and target 28, I have the following settings my build.gradle(Module:app) file.
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.yourprojectname"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
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.+'
implementation 'com.android.support:support-v4:28.+'
implementation 'com.android.support:design:28.+'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
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'
}
If you have a different min api level, change the property minSdkVersion to your api and sync online again. Hope this helps.

Related

I cant add any library

when I try to add any library then I have simple this error:
Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve androidx.recyclerview:recyclerview:1.2.0.
Show Details
Affected Modules: app
I only add a RecyclerView.
my gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.abbasmehdipur.myapplication"
minSdkVersion 23
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.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.recyclerview:recyclerview:1.2.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
finally I found problem!!! just a bad proxy setting.

Dependencies using groupId com.android.support and androidx.* can not be combined

i synced my project, then i got those error, my manifest code is:
android {
compileSdkVersion 28
defaultConfig {
applicationId "chtaibi.yahya.footballcards"
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 'com.google.android.gms:play-services-ads:18.1.1'
}
Can you help me please?
***** It looks like your post is mostly code; please add some more details.
You can migrate an existing project to AndroidX by selecting Refactor > Migrate to AndroidX from the menu bar.
AndroidX replaces the original support library APIs with packages in
the androidx namespace. Only the package and Maven artifact names
changed; class, method, and field names did not change.
Upgrade version
compileSdkVersion 29
defaultConfig {
targetSdkVersion 29
buildToolsVersion '29.0.2'
}
Your dependencies will
implementation 'com.google.android.material:material:1.2.0-alpha03'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

build gradle failed with analytics setting error what can i do?

i clone a project from github into android studio 3.0.1 and when start build gradle show error message :
Error:(1, 0) com/android/tools/analytics/AnalyticsSettings "Open File"
and then i click open file open build.gradle
this is my build.gradle :
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "test.myapplication"
minSdkVersion 21
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.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'
}
what can i do ?
thank for answer

Failed to load AppCompat ActionBar with unknown error. Tip: Try to refresh the layout

I looked for already asked question but they was on older version of android studio and they doesn't work. As you can see I don;t have buildToolsVersion,compile and classpath
.My gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.illuminat.button"
minSdkVersion 22
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-alpha3'
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'
}
Open app Build.gradle file.
In dependencies replace: 'com.android.support:appcompat-v7:28.0.0-alpha3'by
'com.android.support:appcompat-v7:28.0.0-alpha1'
Clic en Sync.
In res/values/style.xml change style tag to

Why is it giving an error cause compileSdkVersion is not specified in android studio?

apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.debu.mrsarkar.bangalighyam"
minSdkVersion 21
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'])
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:design:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-database:11.8.0'
implementation 'com.google.firebase:firebase-core:11.8.0'
implementation 'com.google.firebase:firebase-storage:11.8.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.squareup.okhttp:okhttp:2.7.2'
testImplementation 'junit:junit:4.12'
implementation 'com.firebaseui:firebase-ui-database:3.1.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
compile 'com.google.android.gms:play-services-basement:11.8.0'
compile 'com.google.android.gms:play-services-auth:11.8.0'
compile 'com.android.support:recyclerview-v7:26.1.0'
compile 'com.android.support:support-vector-drawable:26.1.0'
}
apply plugin: 'com.google.gms.google-services'
Please see bottom left side. The error is showing again and again.
Please help me in solving the error.Please!!

Resources