Skip to content

Commit 33c8f76

Browse files
authored
Add qnn deps to LlamaDemo gradle (#13912)
Now for QNN users, they can use the dependency `implementation "com.qualcomm.qti:qnn-runtime:$qnnVersion"` to add the runtime deps Define `qnnVersion` in gradle.properties
1 parent f0368db commit 33c8f76

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

examples/demo-apps/android/LlamaDemo/app/build.gradle.kts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ plugins {
1111
id("org.jetbrains.kotlin.android")
1212
}
1313

14+
val qnnVersion: String? = project.findProperty("qnnVersion") as? String
15+
1416
android {
1517
namespace = "com.example.executorchllamademo"
1618
compileSdk = 34
@@ -61,6 +63,9 @@ dependencies {
6163
implementation("com.google.android.material:material:1.12.0")
6264
implementation("androidx.activity:activity:1.9.0")
6365
implementation("org.json:json:20250107")
66+
if (!qnnVersion.isNullOrEmpty()) {
67+
implementation("com.qualcomm.qti:qnn-runtime:$qnnVersion")
68+
}
6469
testImplementation("junit:junit:4.13.2")
6570
androidTestImplementation("androidx.test.ext:junit:1.1.5")
6671
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")

examples/demo-apps/android/LlamaDemo/docs/delegates/qualcomm_README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,8 @@ sh examples/demo-apps/android/LlamaDemo/setup-with-qnn.sh
212212
This is running the shell script which configures the required core ExecuTorch, Llama2/3, and Android libraries, builds them into AAR, and copies it to the app.
213213
Note: If you are building the Android app mentioned in the next section on a separate machine (i.e. MacOS but building and exporting for QNN backend on Linux), make sure you copy the aar file generated from setup-with-qnn script to "examples/demo-apps/android/LlamaDemo/app/libs" before building the Android app.
214214

215+
6. Set up the correct QNN version in gradle rule
216+
Currently, the gralde rule searches for the property `qnnVersion`. When this variable is defined, it will add QNN runtime library to the dependency. To use it, append the string `qnnVersion=<version>` (ex. `qnnVersion=2.37.0`) to the end of the `gradle.properties` file.
215217

216218
## Run the Android Demo App
217219

0 commit comments

Comments
 (0)