У меня ранее был проект библиотеки Android, который встраивал aar
в папку build\outputs\aar
.Чтобы проверить aar, мы перетянем его в другой проект и построим его оттуда.Чтобы сэкономить время, чтобы упростить процесс, мы объединили эти проекты, но теперь, похоже, AAR больше не создается.
Кажется, что-то не так с нашим файлом Gradle, но я не могу понять, что.Есть идеи, что нам нужно изменить, чтобы этот проект также генерировал aar?
Глядя на старые коммиты, не похоже, что библиотечный проект gradle отличается от обновленных версий appcompat
иgoogle-play-ads
.Дайте мне знать, если вы хотите, чтобы я опубликовал старый код gradle.
Gradle проекта библиотеки:
apply plugin: 'com.android.library'
ext {
bintrayRepo = 'maven'
bintrayName = 'library-project'
publishedGroupId = 'com.library'
libraryName = 'library'
artifact = 'library'
libraryDescription = 'My library project.'
siteUrl = 'https://github.com/library/library-jCenter'
gitUrl = 'https://github.com/library/library-jCenter.git'
libraryVersion = '3.3.1'
developerId = 'developerId'
developerName = 'developer'
developerEmail = 'developer@gmail.com'
licenseName = 'The Apache Software License, Version 2.0'
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
allLicenses = ["Apache-2.0"]
}
android {
compileSdkVersion 26
buildToolsVersion '27.0.3'
defaultConfig {
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName libraryVersion
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}
// Include the library version in the output.
libraryVariants.all { variant ->
variant.outputs.all { output ->
if (outputFile != null && outputFileName.endsWith('.aar')) {
outputFileName = "${archivesBaseName}-${libraryVersion}.aar"
}
}
}
}
dependencies {
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.google.android.gms:play-services-ads:15.0.1'
implementation files('libs/unity.jar')
}
// Copy all of the libraries dependencies into library/build/dependencies/release/
// Makes it easier to include necessary dependencies with the Unity Package
// run the library:copyDependenciesRelease gradle task to fetch the dependencies.
android.libraryVariants.all { variant ->
task "copyDependencies${variant.name.capitalize()}"(type: Copy) {
println "classPath: " + variant.compileConfiguration
from variant.compileConfiguration
into "build/dependencies/${variant.name}"
}
}
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle'
И gradle тестового проекта:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "exampleapp.android.library.com.libraryandroidexampleapp"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:design:27.1.0'
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation project(':library')
testImplementation 'junit:junit:4.12'
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
}
В действительности, единственное изменение в графе примера проекта - замена 'com.library: 3.3.1' implementation
на implementation project (': library')
для компиляции проекта, с которым он теперь связан.Заранее спасибо за любой ответ!