Arn*_*r Z 188 android compilation android-studio android-gradle-plugin google-fabric
在Syncing Gradle时突然,我收到此错误:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'io.fabric'
android {
compileSdkVersion 28
buildToolsVersion "28.0.2"
defaultConfig {
applicationId "..."
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "..."
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
versionNameSuffix = version_suffix
[...]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
[...]
}
debug {
[...]
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.2.61"
implementation 'androidx.appcompat:appcompat:1.0.0-rc02'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation "com.android.support:preference-v7:28.0.0"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
implementation 'com.google.android.material:material:1.0.0-rc02'
[...]
}
Run Code Online (Sandbox Code Playgroud)
我已经build.gradle为app模块做了这个:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'io.fabric'
android {
compileSdkVersion 28
buildToolsVersion "28.0.2"
defaultConfig {
applicationId "..."
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "..."
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
versionNameSuffix = version_suffix
[...]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
[...]
}
debug {
[...]
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.2.61"
implementation 'androidx.appcompat:appcompat:1.0.0-rc02'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation "com.android.support:preference-v7:28.0.0"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
implementation 'com.google.android.material:material:1.0.0-rc02'
[...]
}
Run Code Online (Sandbox Code Playgroud)
我可以正确编译应用程序,但它有点麻烦,而且正如我所看到的,某些东西将在2019年底停止工作.任何想法是什么,以及如何解决它?
Ewo*_*oks 88
更新到3.3.0后我遇到了这个问题
如果你没有在gradle文件中执行什么错误状态,那么它仍然没有更新到导致此错误的新API.要找出哪个插件,请执行以下操作(如3.3.0声明中的"使用过时API时更好的调试信息"中所述):
希望它能帮助别人
M.N*_*man 73
此问题已通过更新Fabric Gradle版本1.30.0修复:
更新版本:2019年3月19日
请查看此链接:https : //docs.fabric.io/android/changelog.html#march-15-2019
请在项目级别Gradle中更新您的类路径依赖项:
buildscript {
// ... repositories, etc. ...
dependencies {
// ...other dependencies ...
classpath 'io.fabric.tools:gradle:1.30.0'
}
}
Run Code Online (Sandbox Code Playgroud)
Num*_*lan 60
In my case, it was caused from gms services 4.3.0. So i had to change it to:
com.google.gms:google-services:4.2.0
Run Code Online (Sandbox Code Playgroud)
I have found this by running:
gradlew sync -Pandroid.debug.obsoleteApi=true
Run Code Online (Sandbox Code Playgroud)
in terminal. Go to view -> tool windows -> Terminal in Android Studio.
Har*_*hah 34
这只是一个警告,它可能会在2019年之前修复插件更新,所以不用担心.我建议你使用兼容版本的插件和gradle.
您可以在此处查看插件版本和gradle版本,以获得更好的体验和性能.
https://developer.android.com/studio/releases/gradle-plugin
尝试使用稳定版本获得平滑且无警告/无错误的代码.
Fah*_*ved 24
我也面临同样的问题。经过一段时间的搜索,我发现警告是由于使用最新版本的google-services插件(版本4.3.0)引起的。顺便说一下,我在我的应用程序中将此插件用于Firebase功能。我所做的就是google-services在build.gradle(Project)级别文件中的buildscript中降级我的插件,如下所示:
buildscript{
dependencies {
// From =>
classpath 'com.google.gms:google-services:4.3.0'
// To =>
classpath 'com.google.gms:google-services:4.2.0'
}
}
Run Code Online (Sandbox Code Playgroud)
Mor*_*Koh 10
1) 添加android.debug.obsoleteApi=true到您的gradle.properties. 它将显示哪些模块受到警告日志的影响。
2) 更新这些已弃用的函数。
variant.javaCompile 到 variant.javaCompileProvider
variant.javaCompile.destinationDir 到
variant.javaCompileProvider.get().destinationDir
小智 9
从以下位置更改您的Google服务版本build.gradle:
dependencies {
classpath 'com.google.gms:google-services:4.2.0'
}
Run Code Online (Sandbox Code Playgroud)
这是构建工具发出的警告,原因有两个.
1.其中一个插件依赖于Task而不是TaskProvider,我们无能为力.
2.您已配置任务的使用,因为它支持TaskProvider.
WARNING: API 'variant.getGenerateBuildConfig()' is obsolete and has been replaced with 'variant.getGenerateBuildConfigProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance
WARNING: API 'variant.getJavaCompile()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance
WARNING: API 'variant.getMergeResources()' is obsolete and has been replaced with 'variant.getMergeResourcesProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance
Run Code Online (Sandbox Code Playgroud)
请注意下面的片段并更新.
android {
<library|application>Variants.all { variant ->
/* Disable Generating Build config */
// variant.generateBuildConfig.enabled = true // <- Deprecated
variant.generateBuildConfigProvider.configure {
it.enabled = true // Replacement
}
}
}
Run Code Online (Sandbox Code Playgroud)
同样,找到'variant.getJavaCompile()'或'variant.javaCompile','variant.getMergeResources()'或的用法'variant.mergeResources'.如上所述替换.
有关任务配置规避的更多信息
在我的情况下,将Kotlin(插件和stdLib)版本升级到 1.3.1解决了该警告。通过将现有 Kotlin 版本替换为以下内容来更新整个项目中的 Kotlin 版本:
ext.kotlin_version = '1.3.50'
Run Code Online (Sandbox Code Playgroud)
小智 5
降级 Gradle 的版本对我有用:
classpath 'com.android.tools.build:gradle:3.2.0'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
116426 次 |
| 最近记录: |