gradle 构建时无法应用插件 [id 'com.chaquo.python']
Failed to apply plugin [id 'com.chaquo.python'] while gradle build
我正在尝试通过使用 chaquopy 在我的 android 应用程序中使用 python。我在 android here 中找到了集成 chaquopy 的教程。
我为应用程序和项目级别更新了我的 gradle 文件评估项目“:app”时出现问题。
Failed to apply plugin [id 'com.chaquo.python']
No such property: dslScope for class: com.android.build.gradle.internal.api.DefaultAndroidSourceDirectorySet.
这是我的 build.gradle 应用级别
代码
apply plugin: 'com.android.application'
apply plugin: 'com.chaquo.python'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
sourceSets {
python {
srcDirs = ["src/main/python"]
}
}
python {
buildPython "usr/bin/python3"
buildPython "python3"
}
ndk {
abiFilters "armeabi-v7a", "x86"
}
applicationId "com.softvision.nowyouseeus"
minSdkVersion 19
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
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.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.google.mlkit:face-detection:16.0.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
bild.gradle 项目级别
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
maven {url "https://chaquo.com/maven"}
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.0"
classpath 'com.chaquo.python:gradle:6.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Chaquopy 6.3.0 与 Android Gradle 插件版本 4.1.0 不兼容,您应该已经收到有关此的警告。
有关兼容的组合,请参阅 here。您可能应该升级到当前的 Chaquopy 版本 9.0.0。
我正在尝试通过使用 chaquopy 在我的 android 应用程序中使用 python。我在 android here 中找到了集成 chaquopy 的教程。 我为应用程序和项目级别更新了我的 gradle 文件评估项目“:app”时出现问题。
Failed to apply plugin [id 'com.chaquo.python'] No such property: dslScope for class: com.android.build.gradle.internal.api.DefaultAndroidSourceDirectorySet.
这是我的 build.gradle 应用级别
代码apply plugin: 'com.android.application'
apply plugin: 'com.chaquo.python'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
sourceSets {
python {
srcDirs = ["src/main/python"]
}
}
python {
buildPython "usr/bin/python3"
buildPython "python3"
}
ndk {
abiFilters "armeabi-v7a", "x86"
}
applicationId "com.softvision.nowyouseeus"
minSdkVersion 19
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
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.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.google.mlkit:face-detection:16.0.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
bild.gradle 项目级别
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
maven {url "https://chaquo.com/maven"}
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.0"
classpath 'com.chaquo.python:gradle:6.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Chaquopy 6.3.0 与 Android Gradle 插件版本 4.1.0 不兼容,您应该已经收到有关此的警告。
有关兼容的组合,请参阅 here。您可能应该升级到当前的 Chaquopy 版本 9.0.0。