Как запустить файл Python в Android Studio в WindowsAndroid

Форум для тех, кто программирует под Android
Ответить
Anonymous
 Как запустить файл Python в Android Studio в Windows

Сообщение Anonymous »

Я попытался запустить файл Python, поэтому последовал инструкциям в Интернете. Вот ссылка.
https://chaquo.com/chaquopy/doc/current ... ject-setup
Я установил свой файл build.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" }
}
}

plugins {
id 'com.android.application' version '8.2.2' apply false
}

dependencies {
classpath "com.android.tools.build:gradle:8.0.0"
classpath 'com.chaquo.python:gradle:15.0.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
а вот мой файл build.gradle на уровне приложения.

Код: Выделить всё

plugins {
id 'com.android.application'
id("com.chaquo.python")
}

android {
namespace 'com.example.fouryou'
compileSdk 34

defaultConfig {
applicationId "com.example.fouryou"
minSdk 24
targetSdk 34
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
ndk {
abifilters "arm64-v8a", "x86_64"
}

}

buildTypes {
release {
minifyEnabled 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 {
buildPython("C:/Users/sally/AppData/Local/Programs/Python/Python311/python.exe")
buildPython("python.exe")
}
}

dependencies {

implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.12.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.jakewharton.threetenabp:threetenabp:1.1.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'

implementation 'androidx.fragment:fragment:1.7.1'
implementation 'androidx.navigation:navigation-fragment:2.7.7'
implementation 'androidx.navigation:navigation-ui:2.7.7'

implementation 'com.android.volley:volley:1.2.1'

}
и мой файл settings.gradle похож на

Код: Выделить всё

pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}

plugins {
id("com.chaquo.python") version "15.0.1" apply false
}

rootProject.name = "FourYou"
include ':app'

Я не могу понять, в чем проблема с моим кодом.
Код ошибки:

Код: Выделить всё

Could not find method classpath() for arguments [com.android.tools.build:gradle:8.0.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Пожалуйста, помогите мне запустить файлы Python в Android Studio в Windows.
Большое спасибо.
Я очень хочу запустите файлы Python в моем приложении для Android

Подробнее здесь: https://stackoverflow.com/questions/785 ... on-windows
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Android»