Skip to content

Commit f870a2a

Browse files
authored
Android add notes about using local AAR (#90)
Add an option to use local AAR
1 parent a0cf294 commit f870a2a

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

llm/android/LlamaDemo/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ First it’s important to note that by default, the app depends on [ExecuTorch l
3030

3131
No modification is needed if you want to use the default ExecuTorch library.
3232

33-
However, you can build your own ExecuTorch Android library (an AAR file). In app/build.gradle.kts file, replace `org.pytorch:executorch-android:x.y.z` with `files("path-to-aar")`.
33+
However, you can build your own ExecuTorch Android library (an AAR file). Copy the file to app/libs/executorch.aar. In gradle.properties file, add a line `useLocalAar=true` so that gradle uses that file.
3434

3535
[This page](https://github.com/pytorch/executorch/blob/main/extension/android/README.md) contains the documentation for building the ExecuTorch Android library.
3636

llm/android/LlamaDemo/app/build.gradle.kts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ plugins {
1212
}
1313

1414
val qnnVersion: String? = project.findProperty("qnnVersion") as? String
15+
val useLocalAar: Boolean? = (project.findProperty("useLocalAar") as? String)?.toBoolean()
1516

1617
android {
1718
namespace = "com.example.executorchllamademo"
@@ -59,7 +60,11 @@ dependencies {
5960
implementation("androidx.constraintlayout:constraintlayout:2.2.0-alpha12")
6061
implementation("com.facebook.fbjni:fbjni:0.5.1")
6162
implementation("com.google.code.gson:gson:2.8.6")
62-
implementation("org.pytorch:executorch-android:1.0.0-rc1")
63+
if (useLocalAar == true) {
64+
implementation(files("libs/executorch.aar"))
65+
} else {
66+
implementation("org.pytorch:executorch-android:1.0.0-rc1")
67+
}
6368
implementation("com.google.android.material:material:1.12.0")
6469
implementation("androidx.activity:activity:1.9.0")
6570
implementation("org.json:json:20250107")

0 commit comments

Comments
 (0)