python - Chaquopy 构建失败:app:generateDebugPythonMiscAssets
问题描述
我正在创建一个 kotlin-frontend/python-backend android 应用程序并想使用 Chaquopy,但出现以下错误。相信我正确遵循了https://chaquo.com/chaquopy/doc/current/android.html#development上的说明,但我不断收到此错误。非常感谢。
:app:generateDebugPythonMiscAssets
Could not resolve com.chaquo.python:target:3.8.1-7
你能告诉我如何解决这个问题吗?
摇篮(应用程序):
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-android-extensions'
id 'com.chaquo.python'
}
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.example.inprogress"
minSdkVersion 25
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
sourceSets {
main {
python {
srcDirs = ["replacement/dir"]
srcDir "additional/dir"
}
}
}
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.2.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'com.google.android.material:material:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
//noinspection GradleDependency
implementation "com.squareup.okhttp3:okhttp:3.9.1"
//noinspection GradleDependency
implementation 'com.google.code.gson:gson:2.8.0'
}
摇篮(项目):
buildscript {
ext.kotlin_version = "1.3.61"
repositories {
google()
jcenter()
maven { url "https://chaquo.com/maven" }
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0-alpha04'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "com.chaquo.python:gradle:7.0.3"
// 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 不支持 Android Gradle 插件的预发布版本,您应该已经收到关于此的警告。
以下是解决问题的方法:
- 更改
com.android.tools.build:gradle
为稳定的 Android Studio 版本 (当前为 3.6.3)。 - 编辑 gradle-wrapper.properties 以使用相应的 Gradle 版本(当前为 5.6.4)。
推荐阅读
- android - Flutter:StreamBuilder 没有使用 Firebase 返回我的流
- r - 在读取 csv 文件之前删除两个文件夹之间不匹配的 csv 文件
- ios - iOS UIWebview 错误插件处理负载:无法播放从 android 设备上传的 s3 存储桶 url 中的视频
- react-native - React Native - 在制作动画时更改屏幕内容
- php - 电子邮件发送重复
- node.js - 使用 pm2 运行项目时出现 MongoDB 错误
- ios - 使用带有子字符串限制的正则表达式进行模式匹配
- activex - RDP ActiveX SendKeys Win+L 锁定屏幕
- html - 菜单项无法移动中心位置
- java - 不希望图像作为附件,但需要内联