AndroidStudioでアプリHelloWorld+ライブラリ作成


概要

AndroidStudioでアプリHelloWorld、ライブラリ作成してHelloworldAppからライブラリ内関数を呼ぶ。

環境

前の記事と同様

メモ

https://developer.android.com/studio/projects/android-library.html
https://github.com/TechBooster/AndroidSamples

本文

普通にHelloWorld作成する。Add New Moduleでライブラリを作成する。
その後、build.gradle(Module:app)のdependenciesタグに次を追加する。


implementation project(":AARPlugin")
 


dependencies {
    implementation project(":AARPlugin") //!!!!

    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

}