升级到3.0版本时编译错误

时间:2017-12-13 06:30:29

标签: android build.gradle updates android-studio-3.0

我想在android 3.0版本中运行我的旧项目。但它显示运行时错误,请任何人帮我解决我的问题。

我的项目包含子模块。

如果我在显示compile的{​​{1}}中将implementation更改为gradle,我也会使用apt。我所做的。请帮我。提前谢谢。

这是错误。

apt error

这是我的主要内容:

 Error:Cannot choose between the following configurations of project :library:
  - debugApiElements
   - debugRuntimeElements
  - releaseApiElements
  - releaseRuntimeElements
All of them match the consumer attributes:
   - Configuration 'debugApiElements':
    - Found com.android.build.api.attributes.BuildTypeAttr 'debug' but wasn't required.
    - Found com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' but wasn't required.
    - Found com.android.build.gradle.internal.dependency.VariantAttr 'debug' but wasn't required.
    - Found org.gradle.api.attributes.Usage 'java-api' but wasn't required.
 - Configuration 'debugRuntimeElements':
    - Found com.android.build.api.attributes.BuildTypeAttr 'debug' but wasn't required.
  - Found com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' but wasn't required.
  - Found com.android.build.gradle.internal.dependency.VariantAttr 'debug' but wasn't required.
  - Found org.gradle.api.attributes.Usage 'java-runtime' but wasn't required.
  - Configuration 'releaseApiElements':
  - Found com.android.build.api.attributes.BuildTypeAttr 'release' but wasn't required.
  - Found com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' but wasn't required.
  - Found com.android.build.gradle.internal.dependency.VariantAttr 'release' but wasn't required.
  - Found org.gradle.api.attributes.Usage 'java-api' but wasn't required.
   - Configuration 'releaseRuntimeElements':
  - Found com.android.build.api.attributes.BuildTypeAttr 'release' but wasn't required.
  - Found com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' but wasn't required.
  - Found com.android.build.gradle.internal.dependency.VariantAttr 'release' but wasn't required.
  - Found org.gradle.api.attributes.Usage 'java-runtime' but wasn't required.

这是我的应用Gradle

      buildscript {
repositories {
    jcenter()
    google()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.0.1'
    classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
    classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.1'
    classpath 'com.google.gms:google-services:3.0.0'
    classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'


}
 }

 allprojects {
repositories {
    jcenter()
    maven {
        url "https://github.com/QuickBlox/quickblox-android-sdk-releases/raw/master/"
    }
    google()
}


ext {
    compileSdkVersion = 26
    buildToolsVersion = "26.0.1"

    minSdkVersion = 14
    targetSdkVersion = 23

    sourceCompatibility = JavaVersion.VERSION_1_7
    targetCompatibility = JavaVersion.VERSION_1_7

    lintAbortOnError = false

    // QuickBlox SDK version
    qbSdkVersion = '3.1.0'

    versionName = "3.0"

    testRunnerVersion = "0.4.1"


    // Dependency versions
    playServicesVersion = '9.8.0'
    supportV4Version = '23.1.1'
    appcompatV7Version = '23.1.1'
    recyclerviewV7Version = '23.2.1'
    supportAnnotationsVersion = '23.1.1'
    designVersion = '23.1.1'

    uilVersion = '1.9.0'
    glideVersion = '3.6.1'
    pullToRefreshVersion = '3.2.3'
    stickyListHeaders = '2.7.0'
    robotoTextViewVersion = '2.4.3'
    stickersVersion = '0.7.3'
    crashlyticsVersion = '2.2.2'
}


 }

请帮我解决我的问题。

3 个答案:

答案 0 :(得分:0)

更改此

compile project(':library')
compile project(':simpl3r')

compile project(path: ':library', configuration: 'default')
compile project(path: ':simpl3r', configuration: 'default')

UPDATE1

implementation project(path: ':library')
implementation project(path: ':simpl3r')
.
. 
.

答案 1 :(得分:0)

改变这个。希望这个帮助。

 compile project(':library')
 compile project(':simpl3r')
 compile project(':androidHorizontalListView')
 compile project(':swipelibrary')
 compile project(':sample-chat')
 compile project(':sample-pushnotifications')

 implementation project(':library')
 implementation project(':simpl3r')
 implementation project(':androidHorizontalListView')
 implementation project(':swipelibrary')
 implementation project(':sample-chat')
 implementation project(':sample-pushnotifications')

<强>更新 您可以删除该行:

apply plugin: 'com.neenbedankt.android-apt'

您的应用级别Gradle依赖项应包括

compile 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

答案 2 :(得分:0)

我在这里看到了多个问题:

  1. 使用不同版本的android支持库(例如:您的recyclerview为23.0.+但支持设计为23.4.0等。)

  2. 使用您的lib版本声明一个ext,但实际上从未在任何地方使用它们?

  3. 在app gradle和项目gradle中声明了相同的ext? (并没有在两者中使用它们?)

  4. compileSdkVersion 26与支持库的版本不匹配(您使用的是各种版本的23)

  5. 使用非常旧的版本,例如google play services 9.8.0等。

  6. 仍在使用已弃用compile而不是implementation

  7. 该列表可能不完整,但我希望这有助于您开始组织您的gradle文件