Код: Выделить всё
Unable to load class 'com.android.build.api.variant.Variant'
com.android.build.api.variant.Variant
Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)
The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)
Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.
In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
Код: Выделить всё
plugins {
id("com.chaquo.python") version "15.0.1" apply false
}
Код: Выделить всё
plugins {
alias(libs.plugins.android.application)
id("com.chaquo.python")
}
android {
namespace = "com.example.pythontestwithjava"
compileSdk = 34
flavorDimensions += "pyVersion"
productFlavors {
create("py310") { dimension = "pyVersion" }
create("py311") { dimension = "pyVersion" }
}
defaultConfig {
applicationId = "com.example.pythontestwithjava"
minSdk = 24
targetSdk = 34
versionCode = 1
versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
ndk {
// On Apple silicon, you can omit x86_64.
abiFilters += listOf("arm64-v8a", "x86_64")
}
python {
version "3.11"
pip {
// A requirement specifier, with or without a version number:
install "scipy"
install "requests==2.24.0"
// An sdist or wheel filename, relative to the project directory:
// install "MyPackage-1.2.3-py2.py3-none-any.whl"
// A directory containing a setup.py, relative to the project
// directory (must contain at least one slash):
// install "./MyPackage"
// "-r"` followed by a requirements filename, relative to the
// project directory:
// install "-r", "requirements.txt"
}
}
}
buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
buildFeatures {
viewBinding = true
}
}
chaquopy {
defaultConfig { }
productFlavors { }
sourceSets { }
productFlavors {
getByName("py310") { version = "3.10" }
getByName("py311") { version = "3.11" }
}
}
dependencies {
implementation(libs.appcompat)
implementation(libs.material)
implementation(libs.constraintlayout)
implementation(libs.navigation.fragment)
implementation(libs.navigation.ui)
testImplementation(libs.junit)
androidTestImplementation(libs.ext.junit)
androidTestImplementation(libs.espresso.core)
}
Код: Выделить всё
undefined reference: python
undefined reference: pip
undefined reference: install
Подробнее здесь: https://stackoverflow.com/questions/784 ... -android-s
Мобильная версия