【发布时间】:2019-11-12 13:39:17
【问题描述】:
我查找了类似的帖子,但由于我没有使用 com.google.gms,所以我有点迷失在哪里可以查看,我还更新了所有实现(以前编译)参考。
这是我在 app/build.gradle 上收到的警告
警告:API 'variantOutput.getPackageApplication()' 已过时,已替换为 'variant.getPackageApplicationProvider()'。 它将在 2019 年底被删除。 有关详细信息,请参阅https://d.android.com/r/tools/task-configuration-avoidance。 要确定调用 variantOutput.getPackageApplication() 的内容,请在命令行上使用 -Pandroid.debug.obsoleteApi=true 以显示更多信息。 受影响的模块:app
警告:配置“编译”已过时,已替换为“实施”和“API”。 它将在 2018 年底删除。有关更多信息,请参阅:http://d.android.com/r/tools/update-dependency-configurations.html 受影响的模块:app
警告:配置“debugCompile”已过时,已替换为“debugImplementation”和“debugApi”。 它将在 2018 年底删除。有关更多信息,请参阅:http://d.android.com/r/tools/update-dependency-configurations.html 受影响的模块:app
// changed from gradle 2.3.3 to gradle 3.4.1 syntax as per
// google developer sites and gradle blogs
// app/build.gradle:
#import java.text.DateFormat
#import java.text.SimpleDateFormat
// migrate from Android Studio with gradle:2.3.3
// to Android Studio with gradle:3.4.1
// jm*20190531
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
apply plugin: 'com.android.application'
apply plugin: 'hugo'
apply plugin: 'maven'
/* **
some methods to build app names with date, git-commit, version numbers
here omitted
** */
android {
compileSdkVersion 28 // jm*20190405
buildToolsVersion "28.0.3" // "25.0.3"
defaultConfig {
minSdkVersion 16 /*** was: 9, then: 14 ***/
targetSdkVersion 28 /*** was: 21, then: 25 ***/
buildConfigField "String", "BUILD_DATE", "\"" + todayIso8601() + "\""
buildConfigField "String", "SHORT_COMMIT_HASH", "\"" + getShortCommitHash() + "\""
}
signingConfigs {
create("myConfig") {
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeType "jks"
}
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
// signingConfig = signingConfigs.wxConfig
}
}
flavorDimensions 'vox' // jm*20190512
productFlavors {
voxDigits {
applicationId "net.wavvox.VoxDigits13"
versionCode versionCodeVoxDigits()
versionName versionNameVoxDigits()
dimension 'vox'
}
voxChat {
applicationId "net.wavvox.voxchat"
versionCode versionCodeVoxChat()
versionName versionNameVoxChat()
dimension 'vox'
}
// Rename APK for the appropriate productFlavor
applicationVariants.all { variant ->
//variant.outputs.every { output ->
variant.outputs.all { output ->
String flavorName = variant.productFlavors[0].name
System.out.println("***** flavorName: " + flavorName)
def relativeRootDir = output.packageApplication.outputDirectory.toPath()
.relativize(rootDir.toPath()).toFile()
def relativeRootDir0 = "../../.."
switch (flavorName) { // jm*20190405
case "voxChat":
//output.outputFile = new File(output.outputFile.parent,
// output.outputFile.name.replace("app-voxChat", apkNameVoxChat)) );
output.outputFileName = new File("$relativeRootDir"+"/"+"app",
output.outputFileName.replace("app-voxChat", apkNameVoxChat()) )
break
case "voxDigits":
//output.outputFile = new File(output.outputFile.parent,
// output.outputFile.name.replace("app-voxDigits", apkNameVoxDigits()) );
output.outputFileName = new File( "$relativeRootDir"+"/"+"app",
output.outputFileName.replace("app-voxDigits", apkNameVoxDigits()) )
break
default:
System.out.println("!!!!! unknown flavorName: " + flavorName + " !!!!!")
// old method, gradle:2.3.3
//output.outputFile = new File(output.outputFile.parent,
// output.outputFile.name.replace(".apk","-${finalVersion}.apk"))
// new method, gradle:3.4.1
//outputFileName = new File(output.outputFile.parent,
// outputFileName.replace(".apk", "-${finalVersionCode}.apk"))
break
} // switch
System.out.println("relativeRootDir: " + relativeRootDir)
System.out.println("output.outputFileName: " + output.outputFileName)
}
}
} // End productFlavors block
}
dependencies {
/* WavvoxLibrary AAR module */
implementation project(':wavvoxlibrary')
/* Google Android support libraries */
implementation 'com.android.support:support-annotations:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
/* Dagger 2 */
implementation 'com.google.dagger:dagger:2.22.1'
annotationProcessor 'com.google.dagger:dagger-compiler:2.22.1'
compileOnly 'javax.annotation:jsr250-api:1.0'
/* Progress Circle */
implementation 'com.github.jakob-grabner:Circle-Progress-View:v1.3'
}
/* **
not quite sure about Dagger and Progress Circle;
got inherited from some older projects
** */
我想处理这些警告并学习如何调试并找到问题的根源;警告不是描述性的......
谢谢, jm。
【问题讨论】:
-
顺便说一句,我设法将我的项目从 Android Studio & gradle 2.3.3 更新到 3.4.1;我的图书馆甚至从 gradle-experimental 0.9.3 更新;见github.com/jmhoraze/migrate_wavvoxlibrary_in_AndroidStudio
-
你可以在这里查看:stackoverflow.com/questions/52252487/… 注意 Hugo 插件。
-
谢谢,我读到了“雨果”;问题是,通过删除类补丁并应用插件,我现在得到错误:“错误:没有为属性'manifestOutputDirectory'指定值。”而不是三个警告中的前两个。仍然是关于variantOutput的警告:“警告:API'variantOutput.getPackageApplication()'已过时,已被'variant.getPackageApplicationProvider()'取代。(...)受影响的模块:app”和那个(点击在“应用程序”上没有转到导致行)也可能来自指定的额外工具之一......?
-
答案 / cmets re "classPath" 没有解决问题,因为在 gradle 构建期间会出现警告! “实施”部分需要进行审查,因为这里(外部)项目编译时有自己的 build.gradle;如果这些项目没有更新,那么 gradle 将发出警告!就我而言(至少是“编译”与“实施”警告)雅各布·格拉布纳的“圆形进度视图”项目是罪魁祸首。不,之前在 cmets 中列出的 StackOverflow 问题没有重复,并且与“Hugo”插件无关!谢谢。
标签: android-studio android-gradle-plugin build.gradle