【问题标题】:Failed to resolve com.androidAffected Modules and com.loopjAffected Modules in android无法在 android 中解析 com.androidAffected Modules 和 com.loopjAffected Modules
【发布时间】:2019-11-01 07:28:24
【问题描述】:

无法在 android 中解析 com.androidAffected Modules 和 com.loopjAffected Modules。 我检查了不同的链接,但我很困惑。

下面是我的应用构建文件

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.XXX.XXXX"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}


dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:25.3.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'

    implementation 'com.android.support:cardview v7:25.3.1'
    implementation 'com.github.bumptech.glide:glide:3.6.1'
    implementation 'me.dm7.barcodescanner:zxing:1.8.4'
    implementation 'com.loopj.android:androidasync http:1.4.9'
    implementation 'com.google.code.gson:gson:2.6.2'
    implementation project(':merchantsdk')


    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

MerchantSDK 是导入到这个项目中的 aar 文件,然后我构建给出以下异常 无法解析 com.androidAffected 模块和 无法解析 com.loopjAffected Modules

请帮助我。在此先感谢。

【问题讨论】:

    标签: android build.gradle aar


    【解决方案1】:

    如果是 AAR 文件,您可以将其保存在“lib”文件夹中。您可以在 build.gradle 中添加此 AAR 的依赖项,如下所示:-

    implementation "packagename of aar:aar filename:@aar"
    

    替换 AAR 的包名和文件名。

    在主项目的 build.gradle 文件中添加:-

     allprojects {
        repositories {
            flatDir { dirs 'libs' }
            }
    }
    

    【讨论】:

    • 嗨,Prashant,感谢您的回复我很困惑,因为我只有“.aar”文件。如何获取该 .aar 文件的包名?
    • 您可以将其保存在 lib 文件夹中,也可以从文件菜单中添加为模块。
    • 任何参考链接都会对 Prashant 有所帮助。
    • Prashant 我已经检查了上面的链接 2 种方式给出了相同的异常
    猜你喜欢
    • 2019-09-08
    • 1970-01-01
    • 2023-01-08
    • 2022-07-07
    • 2019-07-19
    • 2015-04-05
    • 2022-10-13
    • 2021-12-07
    • 1970-01-01
    相关资源
    最近更新 更多