[英]building AAR in Android Studio
It's my first time building AAR这是我第一次构建 AAR
The official site says that All I hate to do is build APK and AAR will be assembled官方网站说我讨厌做的就是构建 APK 和 AAR 将被组装
Here's the quote:这是报价:
But when I choose "Build Apk(s)" nothing happens.但是当我选择“Build Apk(s)”时,什么也没有发生。
Another tutorial says I have to choose Gradle-> library name -> tasks-> build-> :assembleRelease
.另一个教程说我必须选择 Gradle-> library name -> tasks-> build->
:assembleRelease
。
But there is no such thing:但是没有这样的事情:
How can I assemble library as AAR?如何将库组装为 AAR?
here's my gradle:这是我的 gradle:
plugins {
id 'com.android.library'
id 'kotlin-android'
id 'kotlin-kapt'
}
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
minSdkVersion 17
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
def room_version = "2.2.3"
implementation "androidx.room:room-runtime:$room_version"
kapt "androidx.room:room-compiler:$room_version"
implementation "androidx.room:room-ktx:$room_version"
implementation "androidx.room:room-rxjava2:$room_version"
implementation 'com.google.code.gson:gson:2.8.2'
}
Just click assemble
or add buildTypes.debug
.只需单击
assemble
或添加buildTypes.debug
。 While you don't have buildTypes.debug
defined, it won't generate the tasks you are looking for (as there only is one configuration present there and so there is nothing to tell apart).虽然您没有定义
buildTypes.debug
,但它不会生成您正在寻找的任务(因为那里只有一个配置,因此没有什么可区分的)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.