I have to upgrade old android project.
I have done some changes to build.gradle file as below :
build.gradle file:
plugins {
id 'com.android.application'
id 'io.fabric'
}
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
//apply plugin: 'com.android.application'
//apply plugin: 'io.fabric'
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdk 30
buildToolsVersion '30.0.3'
defaultConfig {
applicationId "com.brian.skyazul"
minSdk 30
targetSdk 32
versionCode 3
versionName "1.2"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
checkReleaseBuilds false
}
}
dependencies {
implementation 'com.google.android.material:material:1.6.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'com.squareup.retrofit:retrofit:1.9.0'
// implementation 'com.github.bumptech.glide:glide:3.5.2'
implementation 'com.android.support:cardview-v7:23.2.1'
implementation 'com.squareup.retrofit:converter-jackson:1.9.0'
implementation 'com.squareup.okhttp:okhttp:2.0.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.3.1'
implementation files('libs/picasso-2.5.2.jar')
implementation('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
transitive = true;
}
}
Currently, Getting below error :
A problem occurred configuring root project ‘skyazul-android’.
Could not resolve all artifacts for configuration ‘:classpath’.
Could not find any version that matches com.android.tools.build:gradle:7.0+.
Versions that do not match:
– 2.5.0-alpha-preview-02
– 2.5.0-alpha-preview-01
– 2.4.0-alpha7
– 2.4.0-alpha6
– 2.4.0-alpha5
– + 145 more
Searched in the following locations:
– https://jcenter.bintray.com/com/android/tools/build/gradle/maven-metadata.xml
Required by:
project :Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
Can anyone guide me?
Edit :
build.gradle (project level)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.5.31'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.10'
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
allprojects {
repositories {
jcenter()
}
}
2
Answers
change this in your build.gradle(Module)
Add this in your build.gradle(Project)
Define the
repositories
insettings.gradle
:Then the
build.gradle
can set up these plugins:There is no
jcenter()
and do not mixcom.android.support
withandroidx
libraries; which means that packagecom.android.support:cardview-v7
needs to be replaced altogether, also in XML and code. And replacecom.crashlytics.sdk.android:crashlytics
; Fabric Crashlytics is now Firebase Crashlytics.targetSdk 32
meanscompileSdk 32
andJavaVersion.VERSION_11
. While being unable to setandroid.enableJetifier=false
, you might still have a dependency issue, even if it may build.And I’d suggest to better ignore all
alpha
andbeta
packages with alint.xml
: