| 
 | 1 | +// The Android Gradle Plugin builds the native code with the Android NDK.  | 
 | 2 | + | 
 | 3 | +group 'com.example.llama_cpp_dart'  | 
 | 4 | +version '1.0'  | 
 | 5 | + | 
 | 6 | +buildscript {  | 
 | 7 | +    repositories {  | 
 | 8 | +        google()  | 
 | 9 | +        mavenCentral()  | 
 | 10 | +    }  | 
 | 11 | + | 
 | 12 | +    dependencies {  | 
 | 13 | +        // The Android Gradle Plugin knows how to build native code with the NDK.  | 
 | 14 | +        classpath 'com.android.tools.build:gradle:7.3.0'  | 
 | 15 | +    }  | 
 | 16 | +}  | 
 | 17 | + | 
 | 18 | +rootProject.allprojects {  | 
 | 19 | +    repositories {  | 
 | 20 | +        google()  | 
 | 21 | +        mavenCentral()  | 
 | 22 | +    }  | 
 | 23 | +}  | 
 | 24 | + | 
 | 25 | +apply plugin: 'com.android.library'  | 
 | 26 | + | 
 | 27 | +android {  | 
 | 28 | +    if (project.android.hasProperty("namespace")) {  | 
 | 29 | +        namespace 'com.example.llama_cpp_dart'  | 
 | 30 | +    }  | 
 | 31 | + | 
 | 32 | +    // Bumping the plugin compileSdkVersion requires all clients of this plugin  | 
 | 33 | +    // to bump the version in their app.  | 
 | 34 | +    compileSdkVersion 31  | 
 | 35 | + | 
 | 36 | +    // Use the NDK version  | 
 | 37 | +    // declared in /android/app/build.gradle file of the Flutter project.  | 
 | 38 | +    // Replace it with a version number if this plugin requires a specfic NDK version.  | 
 | 39 | +    // (e.g. ndkVersion "23.1.7779620")  | 
 | 40 | +    ndkVersion android.ndkVersion  | 
 | 41 | + | 
 | 42 | +    // Invoke the shared CMake build with the Android Gradle Plugin.  | 
 | 43 | +    externalNativeBuild {  | 
 | 44 | +        cmake {  | 
 | 45 | +            path "../src/CMakeLists.txt"  | 
 | 46 | + | 
 | 47 | +            // The default CMake version for the Android Gradle Plugin is 3.10.2.  | 
 | 48 | +            // https://developer.android.com/studio/projects/install-ndk#vanilla_cmake  | 
 | 49 | +            //  | 
 | 50 | +            // The Flutter tooling requires that developers have CMake 3.10 or later  | 
 | 51 | +            // installed. You should not increase this version, as doing so will cause  | 
 | 52 | +            // the plugin to fail to compile for some customers of the plugin.  | 
 | 53 | +            // version "3.10.2"  | 
 | 54 | +        }  | 
 | 55 | +    }  | 
 | 56 | + | 
 | 57 | +    compileOptions {  | 
 | 58 | +        sourceCompatibility JavaVersion.VERSION_1_8  | 
 | 59 | +        targetCompatibility JavaVersion.VERSION_1_8  | 
 | 60 | +    }  | 
 | 61 | + | 
 | 62 | +    defaultConfig {  | 
 | 63 | +        ndk {  | 
 | 64 | +            abiFilters 'arm64-v8a', 'x86_64'  | 
 | 65 | +        }  | 
 | 66 | +        minSdkVersion 23  | 
 | 67 | +        targetSdkVersion 31  | 
 | 68 | +    }  | 
 | 69 | +}  | 
0 commit comments