当前位置:   article > 正文

Android Studio 升级gradle异常_the following dependencies do not satisfy the requ

the following dependencies do not satisfy the required version:
升级gradle
dependencies {
    classpath 'com.android.tools.build:gradle:3.4.1'
    classpath 'com.jakewharton:butterknife-gradle-plugin:8.5.1'
}

各种惊喜:

Cannot set the value of read-only property 'outputFile' for ApkVariantOutputImpl_Decorated{apkData=Main{type=MAIN, fullName=choutiDebug, filters=[], versionCode=300330, versionName=3.3.3}} of type com.android.build.gradle.internal.api.ApkVariantOutputImpl.

 解决方法:

  1. applicationVariants.all { variant ->
  2. variant.outputs.each { output ->
  3. def outputFile = output.outputFile
  4. def fileName = "name_${getVersionName()}_${variant.productFlavors[0].name}.apk"
  5. output.outputFileName = fileName
  6. }
  7. }

ERROR: The Android Gradle plugin supports only Butterknife Gradle plugin version 9.0.0-rc2 and higher.
The following dependencies do not satisfy the required version:
root project 'chouti-android' -> com.jakewharton:butterknife-gradle-plugin:8.5.1
Affected Modules: chouti-android

解决方法:

升级Butterknife 版本,并且把compile 全部替换为implementation

ERROR: All flavors must now belong to a named flavor dimension. Learn more at https://d.android.com/r/tools/flavorDimensions-missing-error-message.html
Affected Modules: chouti-android

解决方法:

  1. flavorDimensions "channel"
  2. productFlavors {
  3. productFlavors.all { flavor ->
  4. dimension "channel"
  5. }
  6. }

ERROR: The SourceSet 'instrumentTest' is not recognized by the Android Gradle Plugin. Perhaps you misspelled something?
Affected Modules: chouti-android

解决方法:

instrumentTest.setRoot('tests') 替换为:androidTest.setRoot('tests')

> Task :mergeExtDexChoutiDebug FAILED
AGPBI: {"kind":"error","text":"Static interface methods are only supported starting with Android N (--min-api 24): void butterknife.Unbinder.lambda$static$0()","sources":[{}],"tool":"D8"}

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':mergeExtDexChoutiDebug'.
> Could not resolve all files for configuration ':choutiDebugRuntimeClasspath'.
   > Failed to transform artifact 'butterknife-runtime.aar (com.jakewharton:butterknife-runtime:9.0.0-rc2)' to match attributes {artifactType=android-dex, dexing-is-debuggable=true, dexing-min-sdk=16}.
      > Execution failed for DexingTransform: ******\.gradle\caches\transforms-2\files-2.1\e7c412e8645b205cce2243e763339353\jars\classes.jar.
         > Error while dexing.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 19s
56 actionable tasks: 6 executed, 50 up-to-date
 

解决方法:

  1. compileOptions {
  2. sourceCompatibility JavaVersion.VERSION_1_8
  3. targetCompatibility JavaVersion.VERSION_1_8
  4. }

D:\chouti\chouti-android\AndroidManifest.xml:28:13-35 Error:
    Attribute meta-data#android.support.VERSION@value value=(26.0.0) from [com.android.support:design:26.0.0] AndroidManifest.xml:28:13-35
    is also present at [com.android.support:support-v4:26.1.0] AndroidManifest.xml:28:13-35 value=(26.1.0).
    Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:26:9-28:38 to override.

See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':processChoutiDebugManifest'.
> Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(26.0.0) from [com.android.support:design:26.0.0] AndroidManifest.xml:28:13-35
      is also present at [com.android.support:support-v4:26.1.0] AndroidManifest.xml:28:13-35 value=(26.1.0).
      Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:26:9-28:38 to override.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 11s
 

解决方法:

在build.gradle中添加如下内容

  1. configurations.all {
  2. resolutionStrategy.eachDependency { DependencyResolveDetails details ->
  3. def requested = details.requested
  4. if (requested.group == 'com.android.support') {
  5. if (!requested.name.startsWith("multidex")) {
  6. details.useVersion '26.1.0'//support版本号
  7. }
  8. }
  9. }
  10. }

 

ERROR: The minSdk version should not be declared in the android manifest file. You can move the version from the manifest to the defaultConfig in the build.gradle file.
Remove minSdkVersion and sync project
Affected Modules: chouti-android

解决方法:

删除AndroidManifest.xml中

  1. <uses-sdk
  2. android:minSdkVersion="16"
  3. android:targetSdkVersion="26" />

 

所有问题解决 编译成功运行正常。

 

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/IT小白/article/detail/251236
推荐阅读
相关标签
  

闽ICP备14008679号