我正在尝试使用 python 在我的 android studio 应用程序上进行一些图像处理。我正在使用 Chaquopy 并且 python 脚本需要 igraph 导入。但是当我尝试在 build.gradle(app) 中安装 python-igraph 时:
plugins {
id 'com.android.application'
id 'com.chaquo.python'
}
android {
compileSdk 30
defaultConfig {
applicationId "com.example.chaq"
minSdk 21
targetSdk 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
ndk {
abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
}
python {
buildPython "C:/Users/shani/AppData/Local/Programs/Python/Python39/python.exe"
pip{
install "opencv-contrib-python-headless"
install "pillow"
install "numpy"
install "python-igraph"
}
}
sourceSets {
main {
python.srcDir "src/main/python"
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
同步工作正常,但是当我尝试在模拟器上运行应用程序时,构建失败(我目前正在使用不需要 igraph 的模拟脚本)。
错误如下: igraph 使用 CMake 作为构建系统。编译igraph之前需要安装CMake。 igraph 的 C 核心构建失败。
这是我的 build.gradle(chaq) 文件:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
maven { url "https://chaquo.com/maven" }
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.1"
classpath "com.chaquo.python:gradle:9.1.0"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
如何安装这个 Cmake?