美文网首页
Could not resolve all files for

Could not resolve all files for

作者: 精巧的中级星光 | 来源:发表于2021-04-09 09:10 被阅读0次

原文 (https://blog.csdn.net/gengbaolong/article/details/104718680/)
运行项目报错:

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring project ':app'.

Could not resolve all files for configuration ':app:apt'.
Could not resolve project :ViewPagerIndecatorLibrary.
Required by:
project :app
Cannot choose between the following configurations of project :ViewPagerIndecatorLibrary:
- 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.api.attributes.VariantAttr 'debug' but wasn't required.
- Found com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' but wasn't required.
- Found org.gradle.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.api.attributes.VariantAttr 'debug' but wasn't required.
- Found com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' but wasn't required.
- Found org.gradle.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.api.attributes.VariantAttr 'release' but wasn't required.
- Found com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' but wasn't required.
- Found org.gradle.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.api.attributes.VariantAttr 'release' but wasn't required.
- Found com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' but wasn't required.
- Found org.gradle.usage 'java-runtime' but wasn't required.

  • 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

再列一下项目中的配置:

》》根build.gradle

》》app下的build.gradle

apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt' // apt相关
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"

defaultConfig {
    applicationId "weather.wu.com.weather"
    minSdkVersion 19
    targetSdkVersion 25
    versionCode 1
    versionName "1.0"

    ndk {
        //选择要添加的对应cpu类型的.so库。
        abiFilters 'armeabi', 'armeabi-v7a', 'armeabi-v8a'
        // 还可以添加 'x86', 'x86_64', 'mips', 'mips64'
    }
    manifestPlaceholders = [
            JPUSH_PKGNAME : applicationId,
            JPUSH_APPKEY : "6f2109852a8798f46f387f62", //JPush上注册的包名对应的appkey.
            JPUSH_CHANNEL : "developer-default", //暂时填写默认值即可.
    ]
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
//md控件
compile 'com.android.support:recyclerview-v7:25.0.1'
compile 'com.android.support:cardview-v7:25.0.1'
compile 'com.android.support:gridlayout-v7:25.0.1'
compile 'com.android.support:design:25.0.1'
compile 'com.android.support:appcompat-v7:25.0.1'
//okhttp框架依赖
compile 'com.squareup.okhttp3:okhttp:3.4.1'
//butterknife框架依赖
apt 'com.jakewharton:butterknife-compiler:8.0.1' // apt相关
compile 'com.jakewharton:butterknife:8.0.1'
//glide框架依赖
compile 'com.github.bumptech.glide:glide:3.7.0'
//logger框架依赖
compile 'com.orhanobut:logger:1.3'
//litepal框架依赖
compile 'org.litepal.android:core:1.4.1'
//易源SDK library
compile files('libs/showapi_sdk.jar')
compile files('libs/android-async-http-1.4.6.jar')
//compile 'com.zaaach:citypicker:1.1'
//三个moudle
compile project(':ViewPagerIndecatorLibrary')
compile project(':SlidingMenulibrary')
compile project(':SwipeMenuListViewLibrary')
compile 'com.melnykov:floatingactionbutton:1.3.0'
// compile files('libs/Bmob_Push_V1.0.0beta_20160627.jar')
compile files('libs/AMap_Location_V3.2.0_20161205.jar')
// compile 'cn.bmob.android:bmob-sdk:3.5.0'
compile 'com.google.code.gson:gson:2.8.0'
compile 'cn.jiguang.sdk:jpush:3.0.0'
// 此处以JPush 3.0.0 版本为例。
compile 'cn.jiguang.sdk:jcore:1.0.0'
// 此处以JCore 1.0.0 版本为例。
compile files('libs/YoumiSdk_v7.0.0_2017-01-06.jar')
}

》》module ViewPagerIndecatorLibrary中 build.gradle

apply plugin: 'com.android.library'

android {
compileSdkVersion 17
buildToolsVersion "25.0.2"

defaultConfig {
    minSdkVersion 4
    targetSdkVersion 4
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    }
}

}

dependencies {
compile 'com.android.support:support-v4:25.0.1'
}

解决办法:

1、根目录project的build.gradle文件,删除“apt”配置:

classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' 删除

2、app的build.gradle,删除 “com.neenbedankt.android-apt”
apply plugin: 'com.neenbedankt.android-apt' //删除
3、app的build.gradle,修改“dependencies”中的“apt”方式 为“annotationProcessor”方式

annotationProcessor 'com.jakewharton:butterknife-compiler:8.0.1'
4、module的build.gradle文件,删除“android-apt”引用(如果有的话):

apply plugin: 'android-apt' //删除
5、module的build.gradle文件,修改“dependencies”中的“apt”方式 为“annotationProcessor”方式(如果有的话):

1)apt "引用项" //老方式,删除

2)annotationProcessor "引用项" //新方式

至此,问题解决。

相关文章

网友评论

      本文标题:Could not resolve all files for

      本文链接:https://www.haomeiwen.com/subject/ivfikltx.html