为什么我不能建立APK不AAR?

时间:2019-09-12 22:48:43

标签: java android android-studio gradle

构建项目时,在输出文件夹中找到aar文件而不是apk文件。

请告诉我发生了什么事,是gradle.Build发出的错误还是在哪里?

这是我的gradle.Build

apply plugin: 'com.android.library'

def computeVersionName() {
    return "1.0.12"
}
android {
    compileSdkVersion 28
    defaultConfig {
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 40
        versionName computeVersionName()
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    lintOptions {
        abortOnError false
    }
}

dependencies {

    implementation fileTree(dir: 'libs', include: ['*.jar'])
    // android framework
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    // firebase sdk
    implementation 'com.google.firebase:firebase-core:17.2.0'
    implementation 'com.google.firebase:firebase-database:19.1.0'
    implementation 'com.google.firebase:firebase-storage:19.0.1'
    implementation 'com.google.firebase:firebase-crash:16.2.1'
    implementation 'com.google.firebase:firebase-messaging:20.0.0'
    implementation 'com.google.firebase:firebase-auth:19.0.0'
    implementation 'com.google.firebase:firebase-firestore:21.1.0'
    implementation 'com.google.firebase:firebase-analytics:17.2.0'
    implementation 'com.github.bumptech.glide:glide:3.7.0'
    annotationProcessor 'com.github.bumptech.glide:glide:3.7.0'
    implementation 'org.apache.httpcomponents:httpcore:4.4.10'
    implementation 'com.vanniktech:emoji-ios:0.5.1'

    implementation "com.daimajia.swipelayout:library:1.2.0@aar"
}
configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '26.1.0'
            }
        }
        // firebase resolution
        if (details.requested.group == 'com.google.firebase' ||
                details.requested.group == 'com.google.android.gms') {
            details.useVersion '11.8.0'
        }
    }
}
ext {

 bintrayRepo = 'maven'
    bintrayName = 'qchat'
    publishedGroupId = 'org.qchat.android'
    libraryName = 'qchat'
    artifact = 'qchat'
    libraryDescription = 'Android Chat SDK built on Firebase'
    libraryVersion = computeVersionName()
    developerId = 'qasimsalim'
    developerName = 'qasim salim'
    developerEmail = 'qqasimq2000@gmail.com'
    licenseName = 'AGPL-V3'
    allLicenses = ["AGPL-V3"]
}

1 个答案:

答案 0 :(得分:2)

您已应用库插件而不是应用程序插件。在gradle文件中将“ com.android.library”替换为“ com.android.application”。