Obtenir cet avertissement (même lorsque variant.getAssemble()
n'est utilisé nulle part):
API 'variant.getAssemble()' is obsolete and has been replaced with 'variant.getAssembleProvider()'.
J'ai mis à jour les composants suivants: Android Studio
v3.3
Plugin Gradle
v3.3
URL de distribution de Gradle (gradle-wrapper.properties)
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.Zip
gradle.properties
Android.debug.obsoleteApi=true
J'ai eu le même avertissement !!
Et voici mon fichier Gradle au niveau de l'application:
apply plugin: 'com.Android.application'
Android {
compileSdkVersion 28
defaultConfig {
applicationId 'com.lauszus.facerecognitionapp'
minSdkVersion 16
targetSdkVersion 28
versionCode 6
versionName '1.2.3'
vectorDrawables.useSupportLibrary = true
ndk {
stl 'c++_static'
cFlags '-std=gnu++11 -fexceptions -frtti -DANDROID_STL=c++_static'
}
setProperty('archivesBaseName', rootProject.name + '-' + defaultConfig.versionName)
}
splits {
abi {
enable true
reset()
universalApk true
include 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
}
}
project.ext.abiCodes = ['armeabi-v7a':1, 'arm64-v8a':2, 'x86':3, 'x86_64':4]
applicationVariants.all { variant ->
variant.outputs.each { output ->
def baseAbiVersionCode = project.ext.abiCodes.get(output.getFilter(com.Android.build.OutputFile.ABI))
// Because abiCodes.get() returns null for ABIs that are not mapped by ext.abiCodes,
// the following code does not override the version code for universal APKs.
if (baseAbiVersionCode != null) {
output.versionCodeOverride = baseAbiVersionCode * 1000000 + variant.versionCode
}
}
if (variant.getBuildType().isMinifyEnabled()) {
variant.assemble.doLast {
variant.mappingFile.renameTo(variant.mappingFile.parent +
"/$archivesBaseName-$variant.baseName-mapping.txt")
}
}
}
signingConfigs {
release
}
buildTypes {
debug {
jniDebuggable true
externalNativeBuild {
ndkBuild {
arguments 'NDK_DEBUG=1', 'NDEBUG=null'
}
}
}
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-Android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
externalNativeBuild {
ndkBuild {
path 'src/main/cpp/Android.mk'
}
}
lintOptions {
abortOnError false
}
}
dependencies {
implementation 'com.Android.support:appcompat-v7:28.0.0'
implementation 'com.Android.support:design:28.0.0'
implementation project(':opencv')
}
// These values are all set in my global gradle.properties file
if (project.hasProperty('storeFile') && project.hasProperty('storePassword') &&
project.hasProperty('keyAlias') && project.hasProperty('keyPassword')) {
Android.signingConfigs.release.storeFile = file(storeFile)
Android.signingConfigs.release.storePassword = storePassword
Android.signingConfigs.release.keyAlias = keyAlias
Android.signingConfigs.release.keyPassword = keyPassword
} else {
Android.buildTypes.release.signingConfig = null
}
Si votre fichier gradle de niveau d'application contient le bloc variant.assemble.doLast, alors; Essayez de remplacer "variant.assemble.doLast
" Par "variant.assembleProvider.get().doLast
"
comme ceci:
if (variant.getBuildType().isMinifyEnabled()) {
variant.assembleProvider.get().doLast { //HERE
variant.mappingFile.renameTo(variant.mappingFile.parent +
"/$archivesBaseName-$variant.baseName-mapping.txt")
}
}
référé lien web.
Ce type d'avertissement peut apparaître si une bibliothèque utilisée est votre projet utilise cette méthode